diff options
author | aclement <aclement> | 2004-12-09 15:19:39 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-12-09 15:19:39 +0000 |
commit | 60b62539f1f1887f9c66caa995254e9e4ea89f2b (patch) | |
tree | b2aade0e9a6dc89fb212b0e355cba7fff238b4f1 /bcel-builder/src | |
parent | d474aa398cd671644f48fe8ffe55095109700a1e (diff) | |
download | aspectj-60b62539f1f1887f9c66caa995254e9e4ea89f2b.tar.gz aspectj-60b62539f1f1887f9c66caa995254e9e4ea89f2b.zip |
Allows for MarkerAnnotations - doh! (i.e. ones with no values) and unpacks invis annotations on classgens correctly.
Diffstat (limited to 'bcel-builder/src')
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java | 3 | ||||
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/generic/ClassGen.java | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java index f5c280018..ca7a8ec8d 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java @@ -30,7 +30,7 @@ import org.aspectj.apache.bcel.classfile.Utility; */ public class Annotation { private int typeIndex; - private List /* ElementNameValuePair */ evs; + private List /* ElementNameValuePair */ evs = new ArrayList(); private ConstantPool cpool; private boolean isRuntimeVisible; @@ -74,7 +74,6 @@ public class Annotation { } public void addElementNameValuePair(ElementNameValuePair evp) { - if (evs == null) evs = new ArrayList(); evs.add(evp); } diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ClassGen.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ClassGen.java index 93e5ca8fb..a4fd19d13 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/ClassGen.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ClassGen.java @@ -68,6 +68,7 @@ import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.SourceFile; import org.aspectj.apache.bcel.classfile.Utility; import org.aspectj.apache.bcel.classfile.annotation.Annotation; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisibleAnnotations; import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleAnnotations; import org.aspectj.apache.bcel.generic.annotation.AnnotationGen; @@ -76,7 +77,7 @@ import org.aspectj.apache.bcel.generic.annotation.AnnotationGen; * existing java class (file). * * @see JavaClass - * @version $Id: ClassGen.java,v 1.3 2004/11/22 08:31:27 aclement Exp $ + * @version $Id: ClassGen.java,v 1.4 2004/12/09 15:19:39 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> */ public class ClassGen extends AccessFlags implements Cloneable { @@ -200,6 +201,13 @@ public class ClassGen extends AccessFlags implements Cloneable { Annotation a = (Annotation) iter.next(); annotationGenObjs.add(new AnnotationGen(a,getConstantPool())); } + } else if (attr instanceof RuntimeInvisibleAnnotations) { + RuntimeInvisibleAnnotations ria = (RuntimeInvisibleAnnotations)attr; + List annos = ria.getAnnotations(); + for (Iterator iter = annos.iterator(); iter.hasNext();) { + Annotation a = (Annotation) iter.next(); + annotationGenObjs.add(new AnnotationGen(a,getConstantPool())); + } } } return (AnnotationGen[])annotationGenObjs.toArray(new AnnotationGen[]{}); |