reading annotations from bytecode

(without fields yet)
This commit is contained in:
Stepan Koltsov
2012-02-21 20:16:11 +04:00
parent 175b7230f1
commit aacf63ff6f
11 changed files with 127 additions and 11 deletions
@@ -133,7 +133,7 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
@Override
public List<AnnotationDescriptor> getAnnotations() {
throw new UnsupportedOperationException(); // TODO
return original.getAnnotations();
}
@NotNull
@@ -40,7 +40,7 @@ public class MutableClassDescriptorLite extends MutableDeclarationDescriptor imp
private ConstructorDescriptor primaryConstructor;
private final Set<ConstructorDescriptor> constructors = Sets.newLinkedHashSet();
private final List<AnnotationDescriptor> annotations = Lists.newArrayList();
private List<AnnotationDescriptor> annotations = Lists.newArrayList();
private Map<String, ClassDescriptor> innerClassesAndObjects = Maps.newHashMap();
@@ -342,4 +342,8 @@ public class MutableClassDescriptorLite extends MutableDeclarationDescriptor imp
public List<AnnotationDescriptor> getAnnotations() {
return annotations;
}
public void setAnnotations(List<AnnotationDescriptor> annotations) {
this.annotations = annotations;
}
}
@@ -17,9 +17,11 @@
package org.jetbrains.jet.lang.descriptors.annotations;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.types.JetType;
import javax.rmi.CORBA.ClassDesc;
import java.util.List;
/**
@@ -40,6 +42,9 @@ public class AnnotationDescriptor {
}
public void setAnnotationType(@NotNull JetType annotationType) {
if (!(annotationType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) {
throw new IllegalStateException();
}
this.annotationType = annotationType;
}