Drop TypeConstructor.getAnnotations(), uninherit TypeConstructor from Annotated
The method was unused on TypeConstructor instances, and almost all implementations returned EMPTY anyway
This commit is contained in:
@@ -20,8 +20,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorBase;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassConstructorDescriptorImpl;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorBase;
|
||||
import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorImpl;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
@@ -151,9 +151,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
||||
|
||||
public void createTypeConstructor() {
|
||||
assert typeConstructor == null : typeConstructor;
|
||||
this.typeConstructor = new ClassTypeConstructorImpl(
|
||||
this, Annotations.Companion.getEMPTY(), ModalityKt.isFinalClass(this), typeParameters, supertypes
|
||||
);
|
||||
this.typeConstructor = new ClassTypeConstructorImpl(this, ModalityKt.isFinalClass(this), typeParameters, supertypes);
|
||||
for (FunctionDescriptor functionDescriptor : getConstructors()) {
|
||||
((ClassConstructorDescriptorImpl) functionDescriptor).setReturnType(getDefaultType());
|
||||
}
|
||||
|
||||
-6
@@ -656,12 +656,6 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
return LazyClassDescriptor.this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Annotations getAnnotations() {
|
||||
return Annotations.Companion.getEMPTY(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return LazyClassDescriptor.this.getName().toString();
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ open class KnownClassDescriptor(
|
||||
fun initialize(declaredTypeParameters: List<TypeParameterDescriptor>, supertypes: List<KotlinType>) {
|
||||
this.declaredTypeParameters = declaredTypeParameters
|
||||
this.supertypes = supertypes
|
||||
this.typeConstructor = ClassTypeConstructorImpl(this, annotations, true, declaredTypeParameters, supertypes)
|
||||
this.typeConstructor = ClassTypeConstructorImpl(this, true, declaredTypeParameters, supertypes)
|
||||
this.defaultType = TypeUtils.makeUnsubstitutedType(this, unsubstitutedMemberScope)
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -216,8 +216,6 @@ class LazyJavaClassDescriptor(
|
||||
override val supertypeLoopChecker: SupertypeLoopChecker
|
||||
get() = c.components.supertypeLoopChecker
|
||||
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
|
||||
override fun isFinal(): Boolean = isFinalClass
|
||||
|
||||
override fun isDenotable() = true
|
||||
|
||||
-1
@@ -143,7 +143,6 @@ class FunctionClassDescriptor(
|
||||
override fun getDeclarationDescriptor() = this@FunctionClassDescriptor
|
||||
override fun isDenotable() = true
|
||||
override fun isFinal() = false
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
|
||||
override fun toString() = declarationDescriptor.toString()
|
||||
|
||||
|
||||
-4
@@ -88,10 +88,6 @@ abstract class AbstractTypeAliasDescriptor(
|
||||
override fun getBuiltIns(): KotlinBuiltIns =
|
||||
declarationDescriptor.builtIns
|
||||
|
||||
override val annotations: Annotations
|
||||
get() = declarationDescriptor.annotations
|
||||
|
||||
override fun toString(): String = "[typealias ${declarationDescriptor.name.asString()}]"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-6
@@ -183,12 +183,6 @@ public abstract class AbstractTypeParameterDescriptor extends DeclarationDescrip
|
||||
return AbstractTypeParameterDescriptor.this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Annotations getAnnotations() {
|
||||
return AbstractTypeParameterDescriptor.this.getAnnotations();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public KotlinBuiltIns getBuiltIns() {
|
||||
|
||||
@@ -53,9 +53,7 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
|
||||
this.modality = modality;
|
||||
this.kind = kind;
|
||||
|
||||
this.typeConstructor = new ClassTypeConstructorImpl(
|
||||
this, Annotations.Companion.getEMPTY(), false, Collections.<TypeParameterDescriptor>emptyList(), supertypes
|
||||
);
|
||||
this.typeConstructor = new ClassTypeConstructorImpl(this, false, Collections.<TypeParameterDescriptor>emptyList(), supertypes);
|
||||
}
|
||||
|
||||
public final void initialize(
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
||||
|
||||
this.annotations = annotations;
|
||||
this.typeConstructor = new ClassTypeConstructorImpl(
|
||||
this, getAnnotations(), true, Collections.<TypeParameterDescriptor>emptyList(), Collections.singleton(supertype)
|
||||
this, true, Collections.<TypeParameterDescriptor>emptyList(), Collections.singleton(supertype)
|
||||
);
|
||||
|
||||
this.scope = new EnumEntryScope(storageManager);
|
||||
|
||||
+1
-3
@@ -84,9 +84,7 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
||||
supertypes.add(substitutor.substitute(supertype, Variance.INVARIANT));
|
||||
}
|
||||
|
||||
typeConstructor = new ClassTypeConstructorImpl(
|
||||
this, originalTypeConstructor.getAnnotations(), originalTypeConstructor.isFinal(), typeConstructorParameters, supertypes
|
||||
);
|
||||
typeConstructor = new ClassTypeConstructorImpl(this, originalTypeConstructor.isFinal(), typeConstructorParameters, supertypes);
|
||||
}
|
||||
|
||||
return typeConstructor;
|
||||
|
||||
-2
@@ -54,8 +54,6 @@ class CapturedTypeConstructor(
|
||||
|
||||
override fun getDeclarationDescriptor() = null
|
||||
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
|
||||
override fun toString() = "CapturedTypeConstructor($typeProjection)"
|
||||
|
||||
override fun getBuiltIns(): KotlinBuiltIns = typeProjection.type.constructor.builtIns
|
||||
|
||||
+1
-4
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import java.util.*
|
||||
@@ -55,13 +54,11 @@ class IntegerValueTypeConstructor(
|
||||
|
||||
override fun getDeclarationDescriptor() = null
|
||||
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
|
||||
fun getValue(): Long = value
|
||||
|
||||
override fun getBuiltIns(): KotlinBuiltIns {
|
||||
return builtIns
|
||||
}
|
||||
|
||||
override fun toString() = "IntegerValueType(" + value + ")"
|
||||
override fun toString() = "IntegerValueType($value)"
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.SupertypeLoopChecker;
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
|
||||
@@ -31,21 +30,18 @@ import java.util.List;
|
||||
|
||||
public class ClassTypeConstructorImpl extends AbstractClassTypeConstructor implements TypeConstructor {
|
||||
private final ClassDescriptor classDescriptor;
|
||||
private final Annotations annotations;
|
||||
private final List<TypeParameterDescriptor> parameters;
|
||||
private final Collection<KotlinType> supertypes;
|
||||
private final boolean isFinal;
|
||||
|
||||
public ClassTypeConstructorImpl(
|
||||
@NotNull ClassDescriptor classDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isFinal,
|
||||
@NotNull List<? extends TypeParameterDescriptor> parameters,
|
||||
@NotNull Collection<KotlinType> supertypes
|
||||
) {
|
||||
super(LockBasedStorageManager.NO_LOCKS);
|
||||
this.classDescriptor = classDescriptor;
|
||||
this.annotations = annotations;
|
||||
this.isFinal = isFinal;
|
||||
this.parameters = Collections.unmodifiableList(new ArrayList<TypeParameterDescriptor>(parameters));
|
||||
this.supertypes = Collections.unmodifiableCollection(supertypes);
|
||||
@@ -89,10 +85,4 @@ public class ClassTypeConstructorImpl extends AbstractClassTypeConstructor imple
|
||||
protected SupertypeLoopChecker getSupertypeLoopChecker() {
|
||||
return SupertypeLoopChecker.EMPTY.INSTANCE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Annotations getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,12 +460,6 @@ public class ErrorUtils {
|
||||
return DefaultBuiltIns.getInstance();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Annotations getAnnotations() {
|
||||
return Annotations.Companion.getEMPTY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return debugName;
|
||||
@@ -631,12 +625,6 @@ public class ErrorUtils {
|
||||
return errorTypeConstructor.getDeclarationDescriptor();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Annotations getAnnotations() {
|
||||
return errorTypeConstructor.getAnnotations();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public KotlinBuiltIns getBuiltIns() {
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.types
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
|
||||
class FunctionPlaceholders(private val builtIns: KotlinBuiltIns) {
|
||||
fun createFunctionPlaceholderType(
|
||||
@@ -65,10 +64,6 @@ class FunctionPlaceholderTypeConstructor(
|
||||
return errorTypeConstructor.declarationDescriptor
|
||||
}
|
||||
|
||||
override val annotations: Annotations get(): Annotations {
|
||||
return errorTypeConstructor.annotations
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return errorTypeConstructor.toString()
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotatedImpl;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.TypeIntersectionScope;
|
||||
|
||||
@@ -110,10 +108,4 @@ public class IntersectionTypeConstructor implements TypeConstructor {
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Annotations getAnnotations() {
|
||||
return Annotations.Companion.getEMPTY();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,11 @@ import org.jetbrains.annotations.ReadOnly;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotated;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface TypeConstructor extends Annotated {
|
||||
public interface TypeConstructor {
|
||||
/**
|
||||
* It may differ from ClassDescriptor.declaredParameters if the class is inner, in such case
|
||||
* it also contains additional parameters from outer declarations.
|
||||
|
||||
@@ -116,8 +116,6 @@ class NewCapturedTypeConstructor(val projection: TypeProjection, private var sup
|
||||
override fun isDenotable() = false
|
||||
override fun getDeclarationDescriptor(): ClassifierDescriptor? = null
|
||||
override fun getBuiltIns(): KotlinBuiltIns = projection.type.builtIns
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
|
||||
override fun toString() = "CapturedType($projection)"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -89,9 +89,7 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo
|
||||
) : ClassDescriptorBase(storageManager, container, name, SourceElement.NO_SOURCE) {
|
||||
private val typeParameters = createTypeParameters(this, numberOfDeclaredTypeParameters)
|
||||
|
||||
private val typeConstructor = ClassTypeConstructorImpl(
|
||||
this, Annotations.EMPTY, /* isFinal = */ true, typeParameters, setOf(module.builtIns.anyType)
|
||||
)
|
||||
private val typeConstructor = ClassTypeConstructorImpl(this, /* isFinal = */ true, typeParameters, setOf(module.builtIns.anyType))
|
||||
|
||||
override fun getKind() = ClassKind.CLASS
|
||||
override fun getModality() = Modality.FINAL
|
||||
|
||||
-2
@@ -176,8 +176,6 @@ class DeserializedClassDescriptor(
|
||||
|
||||
override fun getDeclarationDescriptor() = this@DeserializedClassDescriptor
|
||||
|
||||
override val annotations: Annotations get() = Annotations.EMPTY // TODO
|
||||
|
||||
override fun toString() = name.toString()
|
||||
|
||||
override val supertypeLoopChecker: SupertypeLoopChecker
|
||||
|
||||
Reference in New Issue
Block a user