@NotNull annotations on descriptor classes

This commit is contained in:
Andrey Breslav
2013-11-19 16:37:17 +04:00
parent 6dde064791
commit 0c2e1fb806
16 changed files with 24 additions and 0 deletions
@@ -68,6 +68,7 @@ class RootContext extends CodegenContext {
throw new IllegalStateException(); throw new IllegalStateException();
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
throw new IllegalStateException(); throw new IllegalStateException();
@@ -268,6 +268,7 @@ public class TypeDeserializer {
return descriptor != null && ErrorUtils.isError(descriptor); return descriptor != null && ErrorUtils.isError(descriptor);
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return Collections.emptyList(); return Collections.emptyList();
@@ -199,11 +199,13 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
return annotationDeserializer.loadClassAnnotations(this, classProto); return annotationDeserializer.loadClassAnnotations(this, classProto);
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return annotations.invoke(); return annotations.invoke();
} }
@NotNull
@Override @Override
protected JetScope getScopeForMemberLookup() { protected JetScope getScopeForMemberLookup() {
return memberScope; return memberScope;
@@ -359,6 +361,7 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
return DeserializedClassDescriptor.this; return DeserializedClassDescriptor.this;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return Collections.emptyList(); // TODO return Collections.emptyList(); // TODO
@@ -166,6 +166,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
}); });
} }
@NotNull
@Override @Override
protected JetScope getScopeForMemberLookup() { protected JetScope getScopeForMemberLookup() {
return unsubstitutedMemberScope; return unsubstitutedMemberScope;
@@ -330,6 +331,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
return thisAsReceiverParameter.invoke(); return thisAsReceiverParameter.invoke();
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return annotations.invoke(); return annotations.invoke();
@@ -479,6 +481,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
return LazyClassDescriptor.this; return LazyClassDescriptor.this;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return Collections.emptyList(); // TODO return Collections.emptyList(); // TODO
@@ -85,6 +85,7 @@ public class DeferredType implements JetType {
return getActualType().isNullable(); return getActualType().isNullable();
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return getActualType().getAnnotations(); return getActualType().getAnnotations();
@@ -16,11 +16,13 @@
package org.jetbrains.jet.lang.descriptors.annotations; package org.jetbrains.jet.lang.descriptors.annotations;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.ReadOnly; import org.jetbrains.annotations.ReadOnly;
import java.util.List; import java.util.List;
public interface Annotated { public interface Annotated {
@ReadOnly @ReadOnly
@NotNull
List<AnnotationDescriptor> getAnnotations(); List<AnnotationDescriptor> getAnnotations();
} }
@@ -16,6 +16,8 @@
package org.jetbrains.jet.lang.descriptors.annotations; package org.jetbrains.jet.lang.descriptors.annotations;
import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
public abstract class AnnotatedImpl implements Annotated { public abstract class AnnotatedImpl implements Annotated {
@@ -25,6 +27,7 @@ public abstract class AnnotatedImpl implements Annotated {
this.annotations = annotations; this.annotations = annotations;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return annotations; return annotations;
@@ -33,6 +33,7 @@ public abstract class AbstractClassDescriptor implements ClassDescriptor {
return this; return this;
} }
@NotNull
protected abstract JetScope getScopeForMemberLookup(); protected abstract JetScope getScopeForMemberLookup();
@NotNull @NotNull
@@ -179,6 +179,7 @@ public abstract class AbstractLazyTypeParameterDescriptor implements TypeParamet
return AbstractLazyTypeParameterDescriptor.this; return AbstractLazyTypeParameterDescriptor.this;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return AbstractLazyTypeParameterDescriptor.this.getAnnotations(); return AbstractLazyTypeParameterDescriptor.this.getAnnotations();
@@ -248,6 +249,7 @@ public abstract class AbstractLazyTypeParameterDescriptor implements TypeParamet
return index; return index;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return Collections.emptyList(); // TODO return Collections.emptyList(); // TODO
@@ -117,6 +117,7 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
return r; return r;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return original.getAnnotations(); return original.getAnnotations();
@@ -210,6 +210,7 @@ public abstract class MutableClassDescriptorLite extends ClassDescriptorBase {
} }
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return annotations; return annotations;
@@ -49,6 +49,7 @@ public abstract class NumberValueTypeConstructor implements TypeConstructor {
return null; return null;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return Collections.emptyList(); return Collections.emptyList();
@@ -406,6 +406,7 @@ public class ErrorUtils {
return true; return true;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return Collections.emptyList(); return Collections.emptyList();
@@ -57,6 +57,7 @@ public final class JetTypeImpl extends AbstractJetType {
classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList())); classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList()));
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
return annotations; return annotations;
@@ -78,6 +78,7 @@ public class NamespaceType implements JetType {
return false; return false;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
throwException(); throwException();
@@ -84,6 +84,7 @@ public class TypeUtils {
return false; return false;
} }
@NotNull
@Override @Override
public List<AnnotationDescriptor> getAnnotations() { public List<AnnotationDescriptor> getAnnotations() {
throw new IllegalStateException(name); throw new IllegalStateException(name);