Prevent unsafe publication of not fully initialized instance

#KT-54085 Fixed
#EA-757831
This commit is contained in:
Vladimir Dolzhenko
2022-12-08 15:19:18 +01:00
committed by Space Team
parent 1c1b6ff92a
commit 79b8954814
@@ -122,10 +122,6 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
this.c = c;
classOrObject = classLikeInfo.getCorrespondingClassOrObject();
if (classOrObject != null) {
this.c.getTrace().record(BindingContext.CLASS, classOrObject, this);
}
this.c.getTrace().record(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR, DescriptorUtils.getFqName(this), this);
this.declarationProvider = c.getDeclarationProviderFactory().getClassMemberDeclarationProvider(classLikeInfo);
@@ -345,6 +341,11 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
return contextReceiverDescriptors;
});
if (classOrObject != null) {
this.c.getTrace().record(BindingContext.CLASS, classOrObject, this);
}
this.c.getTrace().record(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR, DescriptorUtils.getFqName(this), this);
}
private static boolean isIllegalInner(@NotNull DeclarationDescriptor descriptor) {