@NotNull for parameter of substitute()
This commit is contained in:
@@ -54,7 +54,7 @@ class RootContext extends CodegenContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public DeclarationDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public abstract class AbstractNamespaceDescriptorImpl extends DeclarationDescrip
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public NamespaceDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public NamespaceDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new UnsupportedOperationException("This operation does not make sense for a namespace");
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.lang.descriptors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
@@ -35,7 +36,7 @@ public abstract class AbstractReceiverParameterDescriptor extends DeclarationDes
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ReceiverParameterDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public ReceiverParameterDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
if (substitutor.isEmpty()) return this;
|
||||
JetType substitutedType = substitutor.substitute(getType(), Variance.INVARIANT);
|
||||
if (substitutedType == null) return null;
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface CallableDescriptor extends DeclarationDescriptorWithVisibility,
|
||||
CallableDescriptor getOriginal();
|
||||
|
||||
@Override
|
||||
CallableDescriptor substitute(TypeSubstitutor substitutor);
|
||||
CallableDescriptor substitute(@NotNull TypeSubstitutor substitutor);
|
||||
|
||||
@NotNull
|
||||
List<ValueParameterDescriptor> getValueParameters();
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface ClassDescriptor extends ClassifierDescriptor, MemberDescriptor,
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
ClassDescriptor substitute(TypeSubstitutor substitutor);
|
||||
ClassDescriptor substitute(@NotNull TypeSubstitutor substitutor);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class ClassDescriptorBase implements ClassDescriptor {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ClassDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public ClassDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
if (substitutor.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ClassDescriptorImpl extends DeclarationDescriptorNonRootImpl implem
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ClassDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public ClassDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface DeclarationDescriptor extends Annotated, Named {
|
||||
DeclarationDescriptor getContainingDeclaration();
|
||||
|
||||
@Nullable
|
||||
DeclarationDescriptor substitute(TypeSubstitutor substitutor);
|
||||
DeclarationDescriptor substitute(@NotNull TypeSubstitutor substitutor);
|
||||
|
||||
<R, D> R accept(DeclarationDescriptorVisitor<R, D> visitor, D data);
|
||||
void acceptVoid(DeclarationDescriptorVisitor<Void, Void> visitor);
|
||||
|
||||
@@ -31,7 +31,7 @@ public interface FunctionDescriptor extends CallableMemberDescriptor {
|
||||
FunctionDescriptor getOriginal();
|
||||
|
||||
@Override
|
||||
FunctionDescriptor substitute(TypeSubstitutor substitutor);
|
||||
FunctionDescriptor substitute(@NotNull TypeSubstitutor substitutor);
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
}
|
||||
|
||||
@Override
|
||||
public final FunctionDescriptor substitute(TypeSubstitutor originalSubstitutor) {
|
||||
public final FunctionDescriptor substitute(@NotNull TypeSubstitutor originalSubstitutor) {
|
||||
if (originalSubstitutor.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ClassDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public ClassDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
if (substitutor.isEmpty()) return this;
|
||||
return new LazySubstitutingClassDescriptor(this, TypeSubstitutor.create(substitutor.getSubstitution(), getSubstitutor().getSubstitution()));
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public class LocalVariableDescriptor extends VariableDescriptorImpl {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LocalVariableDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public LocalVariableDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ModuleDescriptor extends DeclarationDescriptorImpl implements Class
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModuleDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public ModuleDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public abstract class PropertyAccessorDescriptor extends DeclarationDescriptorNo
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public FunctionDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
|
||||
@@ -44,5 +44,5 @@ public interface PropertyDescriptor
|
||||
Set<? extends PropertyDescriptor> getOverriddenDescriptors();
|
||||
|
||||
@Override
|
||||
PropertyDescriptor substitute(TypeSubstitutor substitutor);
|
||||
PropertyDescriptor substitute(@NotNull TypeSubstitutor substitutor);
|
||||
}
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor substitute(TypeSubstitutor originalSubstitutor) {
|
||||
public PropertyDescriptor substitute(@NotNull TypeSubstitutor originalSubstitutor) {
|
||||
if (originalSubstitutor.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,5 +40,5 @@ public interface ReceiverParameterDescriptor extends DeclarationDescriptor {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
ReceiverParameterDescriptor substitute(TypeSubstitutor substitutor);
|
||||
ReceiverParameterDescriptor substitute(@NotNull TypeSubstitutor substitutor);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class ScriptDescriptor extends DeclarationDescriptorNonRootImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public DeclarationDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new IllegalStateException("nothing to substitute in script");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public interface TypeParameterDescriptor extends ClassifierDescriptor {
|
||||
@NotNull
|
||||
@Override
|
||||
@Deprecated // Use the static method TypeParameterDescriptor.substitute()
|
||||
TypeParameterDescriptor substitute(TypeSubstitutor substitutor);
|
||||
TypeParameterDescriptor substitute(@NotNull TypeSubstitutor substitutor);
|
||||
|
||||
int getIndex();
|
||||
}
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ public class TypeParameterDescriptorImpl extends DeclarationDescriptorNonRootImp
|
||||
@NotNull
|
||||
@Override
|
||||
@Deprecated
|
||||
public TypeParameterDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public TypeParameterDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ValueParameterDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public ValueParameterDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface VariableDescriptor extends CallableDescriptor {
|
||||
DeclarationDescriptor getContainingDeclaration();
|
||||
|
||||
@Override
|
||||
VariableDescriptor substitute(TypeSubstitutor substitutor);
|
||||
VariableDescriptor substitute(@NotNull TypeSubstitutor substitutor);
|
||||
|
||||
boolean isVar();
|
||||
}
|
||||
|
||||
+1
-1
@@ -241,7 +241,7 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
|
||||
@NotNull
|
||||
@Override
|
||||
@Deprecated
|
||||
public TypeParameterDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public TypeParameterDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new UnsupportedOperationException("Don't call substitute() on type parameters");
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public class ErrorUtils {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ClassDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public ClassDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
return ERROR_CLASS;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user