]> source.dussan.org Git - aspectj.git/commitdiff
279120: rewritten not to rely on javaClass being non-null - use the already unpacked...
authoraclement <aclement>
Thu, 4 Jun 2009 15:43:11 +0000 (15:43 +0000)
committeraclement <aclement>
Thu, 4 Jun 2009 15:43:11 +0000 (15:43 +0000)
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java

index 6051277d4f1c3e434a0d6ff777ac7a9e6459b100..484e54d0e9099fe02eef50736cf98e4d37013b89 100644 (file)
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import org.aspectj.apache.bcel.classfile.AttributeUtils;
 import org.aspectj.apache.bcel.classfile.Field;
@@ -28,9 +29,7 @@ import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.apache.bcel.classfile.Method;
 import org.aspectj.apache.bcel.classfile.Signature;
 import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
-import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValueGen;
 import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen;
-import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen;
 import org.aspectj.apache.bcel.classfile.annotation.EnumElementValueGen;
 import org.aspectj.bridge.IMessageHandler;
 import org.aspectj.bridge.MessageUtil;
@@ -609,16 +608,14 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
                // @Target annotation hasn't been used
                List targetKinds = new ArrayList();
                if (isAnnotation()) {
-                       AnnotationGen[] annotationsOnThisType = javaClass.getAnnotations();
+                       AnnotationAJ[] annotationsOnThisType = getAnnotations();
                        for (int i = 0; i < annotationsOnThisType.length; i++) {
-                               AnnotationGen a = annotationsOnThisType[i];
+                               AnnotationAJ a = annotationsOnThisType[i];
                                if (a.getTypeName().equals(UnresolvedType.AT_TARGET.getName())) {
-                                       ArrayElementValueGen arrayValue = (ArrayElementValueGen) ((ElementNameValuePairGen) a.getValues().get(0))
-                                                       .getValue();
-                                       ElementValueGen[] evs = arrayValue.getElementValuesArray();
-                                       if (evs != null) {
-                                               for (int j = 0; j < evs.length; j++) {
-                                                       String targetKind = ((EnumElementValueGen) evs[j]).getEnumValueString();
+                                       Set targets = a.getTargets();
+                                       if (targets != null) {
+                                               for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
+                                                       String targetKind = (String) iterator.next();
                                                        if (targetKind.equals("ANNOTATION_TYPE")) {
                                                                targetKinds.add(AnnotationTargetKind.ANNOTATION_TYPE);
                                                        } else if (targetKind.equals("CONSTRUCTOR")) {