Introduce ClassDescriptor#getStaticScope()
Will be used to exterminate hacks related to static Java methods in our codebase: synthetic class object for enum, synthetic package for static members of Java classes, etc.
This commit is contained in:
+8
-1
@@ -57,8 +57,9 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
||||
private final WritableScope scopeForMemberResolution;
|
||||
// This scope contains type parameters but does not contain inner classes
|
||||
private final WritableScope scopeForSupertypeResolution;
|
||||
private WritableScope scopeForInitializers = null; //contains members + primary constructor value parameters + map for backing fields
|
||||
private WritableScope scopeForInitializers; //contains members + primary constructor value parameters + map for backing fields
|
||||
private JetScope scopeForMemberLookup;
|
||||
private final JetScope staticScope = new StaticScopeForKotlinClass(this);
|
||||
|
||||
public MutableClassDescriptor(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@@ -295,6 +296,12 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
||||
return (WritableScope) scopeForMemberLookup;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JetScope getStaticScope() {
|
||||
return staticScope;
|
||||
}
|
||||
|
||||
public void lockScopes() {
|
||||
getScopeForMemberLookupAsWritableScope().changeLockLevel(WritableScope.LockLevel.READING);
|
||||
if (classObjectDescriptor instanceof MutableClassDescriptor) {
|
||||
|
||||
+7
@@ -88,6 +88,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
private final MemoizedFunctionToNotNull<JetClassObject, ClassDescriptor> extraClassObjectDescriptors;
|
||||
|
||||
private final LazyClassMemberScope unsubstitutedMemberScope;
|
||||
private final JetScope staticScope = new StaticScopeForKotlinClass(this);
|
||||
|
||||
private final NotNullLazyValue<JetScope> scopeForClassHeaderResolution;
|
||||
private final NotNullLazyValue<JetScope> scopeForMemberDeclarationResolution;
|
||||
@@ -300,6 +301,12 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
scope, getScopeForMemberDeclarationResolution());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JetScope getStaticScope() {
|
||||
return staticScope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<ConstructorDescriptor> getConstructors() {
|
||||
|
||||
Reference in New Issue
Block a user