From 85cffd9e900f6c7f606e8412d6fca1411be8b8c4 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 29 May 2012 11:10:37 +0400 Subject: [PATCH] Unused methods removed --- .../descriptors/TypeParameterDescriptor.java | 3 -- .../TypeParameterDescriptorImpl.java | 13 +----- .../jet/lang/resolve/DescriptorUtils.java | 43 +------------------ 3 files changed, 3 insertions(+), 56 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/TypeParameterDescriptor.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/TypeParameterDescriptor.java index 07afc2a3866..85444a1fdd0 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/TypeParameterDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/TypeParameterDescriptor.java @@ -54,7 +54,4 @@ public interface TypeParameterDescriptor extends ClassifierDescriptor { TypeParameterDescriptor substitute(TypeSubstitutor substitutor); int getIndex(); - - @NotNull - TypeParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/TypeParameterDescriptorImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/TypeParameterDescriptorImpl.java index 1ccd4ff68ee..de949fcab80 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/TypeParameterDescriptorImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/TypeParameterDescriptorImpl.java @@ -16,7 +16,6 @@ package org.jetbrains.jet.lang.descriptors; -import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; @@ -202,7 +201,7 @@ public class TypeParameterDescriptorImpl extends DeclarationDescriptorImpl imple @NotNull @Override - @Deprecated // Use the static method TypeParameterDescriptor.substitute() + @Deprecated public TypeParameterDescriptor substitute(TypeSubstitutor substitutor) { throw new UnsupportedOperationException(); } @@ -262,14 +261,4 @@ public class TypeParameterDescriptorImpl extends DeclarationDescriptorImpl imple checkInitialized(); return index; } - - @Override - @NotNull - public TypeParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner) { - TypeParameterDescriptorImpl - copy = new TypeParameterDescriptorImpl(newOwner, Lists.newArrayList(getAnnotations()), reified, variance, getName(), index); - copy.upperBounds.addAll(this.upperBounds); - copy.initialized = this.initialized; - return copy; - } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java index ce8f0bbea4a..6f2aaa735c7 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorUtils.java @@ -41,32 +41,9 @@ import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor * @author abreslav */ public class DescriptorUtils { - public static boolean definesItsOwnThis(@NotNull DeclarationDescriptor descriptor) { - return descriptor.accept(new DeclarationDescriptorVisitor() { - @Override - public Boolean visitDeclarationDescriptor(DeclarationDescriptor descriptor, Void data) { - return false; - } - - @Override - public Boolean visitFunctionDescriptor(FunctionDescriptor descriptor, Void data) { - return descriptor.getReceiverParameter().exists(); - } - - @Override - public Boolean visitClassDescriptor(ClassDescriptor descriptor, Void data) { - return true; - } - - @Override - public Boolean visitPropertyDescriptor(PropertyDescriptor descriptor, Void data) { - return descriptor.getReceiverParameter().exists(); - } - }, null); - } @NotNull - public static Descriptor substituteBounds(@NotNull Descriptor functionDescriptor) { + public static D substituteBounds(@NotNull D functionDescriptor) { final List typeParameters = functionDescriptor.getTypeParameters(); if (typeParameters.isEmpty()) return functionDescriptor; final Map typeConstructors = Maps.newHashMap(); @@ -74,7 +51,7 @@ public class DescriptorUtils { typeConstructors.put(typeParameter.getTypeConstructor(), typeParameter); } //noinspection unchecked - return (Descriptor) functionDescriptor.substitute(new TypeSubstitutor(TypeSubstitution.EMPTY) { + return (D) functionDescriptor.substitute(new TypeSubstitutor(TypeSubstitution.EMPTY) { @Override public boolean inRange(@NotNull TypeConstructor typeConstructor) { return typeConstructors.containsKey(typeConstructor); @@ -120,22 +97,6 @@ public class DescriptorUtils { }); } - public static List copyValueParameters(DeclarationDescriptor newOwner, List parameters) { - List result = Lists.newArrayList(); - for (ValueParameterDescriptor parameter : parameters) { - result.add(parameter.copy(newOwner)); - } - return result; - } - - public static List copyTypeParameters(DeclarationDescriptor newOwner, List parameters) { - List result = Lists.newArrayList(); - for (TypeParameterDescriptor parameter : parameters) { - result.add(parameter.copy(newOwner)); - } - return result; - } - public static Modality convertModality(Modality modality, boolean makeNonAbstract) { if (makeNonAbstract && modality == Modality.ABSTRACT) return Modality.OPEN; return modality;