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:
Alexander Udalov
2014-09-03 12:03:13 +04:00
parent 7ad88f7799
commit 75df4a9ad8
10 changed files with 98 additions and 3 deletions
@@ -36,6 +36,7 @@ import org.jetbrains.jet.lang.resolve.DescriptorFactory;
import org.jetbrains.jet.lang.resolve.OverridingUtil;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.resolve.scopes.StaticScopeForKotlinClass;
import org.jetbrains.jet.lang.types.AbstractClassTypeConstructor;
import org.jetbrains.jet.lang.types.ErrorUtils;
import org.jetbrains.jet.lang.types.JetType;
@@ -61,8 +62,8 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
private final NotNullLazyValue<Annotations> annotations;
private final NullableLazyValue<ClassDescriptor> classObjectDescriptor;
private final NestedClassDescriptors nestedClasses;
private final JetScope staticScope = new StaticScopeForKotlinClass(this);
private final NotNullLazyValue<DeclarationDescriptor> containingDeclaration;
private final DeserializedClassTypeConstructor typeConstructor;
@@ -194,6 +195,12 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
return memberScope;
}
@NotNull
@Override
public JetScope getStaticScope() {
return staticScope;
}
@Nullable
private ConstructorDescriptor computePrimaryConstructor() {
if (!classProto.hasPrimaryConstructor()) return null;