Unused methods removed
This commit is contained in:
@@ -54,7 +54,4 @@ public interface TypeParameterDescriptor extends ClassifierDescriptor {
|
||||
TypeParameterDescriptor substitute(TypeSubstitutor substitutor);
|
||||
|
||||
int getIndex();
|
||||
|
||||
@NotNull
|
||||
TypeParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner);
|
||||
}
|
||||
|
||||
+1
-12
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Boolean, Void>() {
|
||||
@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 extends CallableDescriptor> Descriptor substituteBounds(@NotNull Descriptor functionDescriptor) {
|
||||
public static <D extends CallableDescriptor> D substituteBounds(@NotNull D functionDescriptor) {
|
||||
final List<TypeParameterDescriptor> typeParameters = functionDescriptor.getTypeParameters();
|
||||
if (typeParameters.isEmpty()) return functionDescriptor;
|
||||
final Map<TypeConstructor, TypeParameterDescriptor> 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<ValueParameterDescriptor> copyValueParameters(DeclarationDescriptor newOwner, List<ValueParameterDescriptor> parameters) {
|
||||
List<ValueParameterDescriptor> result = Lists.newArrayList();
|
||||
for (ValueParameterDescriptor parameter : parameters) {
|
||||
result.add(parameter.copy(newOwner));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<TypeParameterDescriptor> copyTypeParameters(DeclarationDescriptor newOwner, List<TypeParameterDescriptor> parameters) {
|
||||
List<TypeParameterDescriptor> 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;
|
||||
|
||||
Reference in New Issue
Block a user