mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-03 03:37:58 +07:00
[global inspections] try to avoid race conditions by waiting until elements are initialized before building references
GitOrigin-RevId: de52d36337741d435ea14a81b77d5340b355f905
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5b7c6af5af
commit
b3ac7c53f3
@@ -327,6 +327,7 @@ public class RefJavaUtilImpl extends RefJavaUtil {
|
||||
|
||||
if (refClass != null) {
|
||||
boolean hasConstructorsMarked = false;
|
||||
refClass.waitForInitialized();
|
||||
|
||||
if (defaultConstructorOnly) {
|
||||
WritableRefElement refDefaultConstructor = (WritableRefElement)refClass.getDefaultConstructor();
|
||||
@@ -485,6 +486,7 @@ public class RefJavaUtilImpl extends RefJavaUtil {
|
||||
|
||||
@Override
|
||||
public RefClass getTopLevelClass(@NotNull RefElement refElement) {
|
||||
LOG.assertTrue(refElement.isInitialized(), refElement.getName() + " not initialized");
|
||||
RefEntity refParent = refElement.getOwner();
|
||||
|
||||
while (refParent instanceof RefElement && !(refParent instanceof RefFile)) {
|
||||
@@ -564,6 +566,7 @@ public class RefJavaUtilImpl extends RefJavaUtil {
|
||||
@Override
|
||||
@Nullable
|
||||
public RefClass getOwnerClass(RefElement refElement) {
|
||||
LOG.assertTrue(refElement.isInitialized(), refElement.getName() + " not initialized");
|
||||
RefEntity parent = refElement.getOwner();
|
||||
|
||||
while (!(parent instanceof RefClass) && parent instanceof RefElement) {
|
||||
|
||||
Reference in New Issue
Block a user