diff --git a/compiler/frontend/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java index 8669eb2684e..bb75235e71f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java @@ -20,9 +20,7 @@ import com.google.common.collect.Sets; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.*; -import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.kotlin.descriptors.annotations.Annotations; -import org.jetbrains.kotlin.descriptors.annotations.AnnotationsImpl; import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.resolve.scopes.*; import org.jetbrains.kotlin.storage.LockBasedStorageManager; @@ -37,20 +35,16 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class private final ClassKind kind; private final boolean isInner; - private Annotations annotations; private Modality modality; private Visibility visibility; private TypeConstructor typeConstructor; private List typeParameters; private Collection supertypes = new ArrayList(); - private MutableClassDescriptor companionObjectDescriptor; - private final Set constructors = Sets.newLinkedHashSet(); private ConstructorDescriptor primaryConstructor; private final Set declaredCallableMembers = Sets.newLinkedHashSet(); - private final Set allCallableMembers = Sets.newLinkedHashSet(); // includes fake overrides private final Set properties = Sets.newLinkedHashSet(); private final Set functions = Sets.newLinkedHashSet(); @@ -95,28 +89,13 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class @Nullable @Override public MutableClassDescriptor getCompanionObjectDescriptor() { - return companionObjectDescriptor; - } - - public void setCompanionObjectDescriptor(@NotNull MutableClassDescriptor classObjectDescriptor) { - assert this.companionObjectDescriptor == null : "classObjectDescriptor already assigned in " + this; - this.companionObjectDescriptor = classObjectDescriptor; + return null; } @NotNull @Override public Annotations getAnnotations() { - if (annotations == null) { - annotations = new AnnotationsImpl(new ArrayList(0)); - } - return annotations; - } - - public void addAnnotations(@NotNull Iterable annotationsToAdd) { - List annotations = ((AnnotationsImpl) getAnnotations()).getAnnotationDescriptors(); - for (AnnotationDescriptor annotationDescriptor : annotationsToAdd) { - annotations.add(annotationDescriptor); - } + return Annotations.EMPTY; } public void setModality(@NotNull Modality modality) { @@ -152,7 +131,6 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class @Override public boolean isCompanionObject() { - //TODO: return false; } @@ -197,13 +175,6 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class } } - public void addConstructorParametersToInitializersScope(@NotNull Collection variables) { - WritableScope scope = getWritableScopeForInitializers(); - for (VariableDescriptor variable : variables) { - scope.addVariableDescriptor(variable); - } - } - @NotNull @Override public Set getConstructors() { @@ -232,11 +203,6 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class return declaredCallableMembers; } - @NotNull - public Set getAllCallableMembers() { - return allCallableMembers; - } - public void setTypeParameterDescriptors(@NotNull List typeParameters) { if (this.typeParameters != null) { throw new IllegalStateException("Type parameters are already set for " + getName()); @@ -252,7 +218,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class assert typeConstructor == null : typeConstructor; this.typeConstructor = TypeConstructorImpl.createForClass( this, - Annotations.EMPTY, // TODO : pass annotations from the class? + Annotations.EMPTY, !getModality().isOverridable(), getName().asString(), typeParameters, @@ -305,28 +271,12 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class return scopeForMemberLookup; } - @NotNull - private WritableScope getScopeForMemberLookupAsWritableScope() { - // hack - return (WritableScope) scopeForMemberLookup; - } - @NotNull @Override public JetScope getStaticScope() { return staticScope; } - public void lockScopes() { - getScopeForMemberLookupAsWritableScope().changeLockLevel(WritableScope.LockLevel.READING); - if (companionObjectDescriptor != null) { - companionObjectDescriptor.lockScopes(); - } - scopeForSupertypeResolution.changeLockLevel(WritableScope.LockLevel.READING); - scopeForMemberResolution.changeLockLevel(WritableScope.LockLevel.READING); - getWritableScopeForInitializers().changeLockLevel(WritableScope.LockLevel.READING); - } - @Override public String toString() { return DeclarationDescriptorImpl.toString(this);