]> source.dussan.org Git - aspectj.git/commitdiff
Updates for annotation binding. Support for static methods !!
authoraclement <aclement>
Mon, 31 Jan 2005 13:59:04 +0000 (13:59 +0000)
committeraclement <aclement>
Mon, 31 Jan 2005 13:59:04 +0000 (13:59 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
weaver/src/org/aspectj/weaver/bcel/KindedAnnotationAccessVar.java

index 659f92fc9c72db26857b573f741642871c13b65f..aac3ae53339f0bbfef39699325054a37434231e0 100644 (file)
@@ -233,6 +233,7 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName {
        
        public boolean hasAnnotation(TypeX ofType) {
                Annotation[] as = declaration.annotations;
+               if (as == null) return false;
                for (int i = 0; i < as.length; i++) {
                        Annotation annotation = as[i];
                        String tname = CharOperation.charToString(annotation.resolvedType.constantPoolName());
index 142ac4d9affbd071a1ffc139e8618ae6d1a80826..bcc0fd05d67953b3fc00f707888c7dfadf363aff 100644 (file)
@@ -1309,7 +1309,7 @@ public class BcelShadow extends Shadow {
        
        // !!! Refactor these once all shadow kinds added - there is lots of commonality
        if (getKind() == Shadow.MethodCall) {
-               ResolvedMember rm[] = this.getTargetType().getDeclaredMethods(world);
+               ResolvedMember rm[] = getSignature().getDeclaringType().getDeclaredMethods(world);
                ResolvedMember found = null;
                String searchString = getSignature().getName()+getSignature().getParameterSignature();
                for (int i = 0; i < rm.length; i++) {
@@ -1321,11 +1321,12 @@ public class BcelShadow extends Shadow {
                ResolvedTypeX[] anns = found.getAnnotationTypes();
                for (int i = 0; i < anns.length; i++) {
                                ResolvedTypeX typeX = anns[i];
-                       kindedAnnotationVars.put(typeX,new KindedAnnotationAccessVar(typeX.resolve(world),(BcelVar)getTargetVar(),getSignature()));
+                       kindedAnnotationVars.put(typeX,
+                                       new KindedAnnotationAccessVar(typeX.resolve(world),getSignature().getDeclaringType(),getSignature()));
                        }
        }
        if (getKind() == Shadow.MethodExecution) {
-               ResolvedMember rm[] = this.getTargetType().getDeclaredMethods(world);
+               ResolvedMember rm[] = getSignature().getDeclaringType().getDeclaredMethods(world);
                ResolvedMember found = null;
                String searchString = getSignature().getName()+getSignature().getParameterSignature();
                for (int i = 0; i < rm.length; i++) {
@@ -1337,7 +1338,7 @@ public class BcelShadow extends Shadow {
                ResolvedTypeX[] anns = found.getAnnotationTypes();
                for (int i = 0; i < anns.length; i++) {
                                ResolvedTypeX typeX = anns[i];
-                       kindedAnnotationVars.put(typeX,new KindedAnnotationAccessVar(typeX.resolve(world),(BcelVar)getTargetVar(),getSignature()));
+                       kindedAnnotationVars.put(typeX,new KindedAnnotationAccessVar(typeX.resolve(world),getSignature().getDeclaringType(),getSignature()));
                        }
        }
 //     if (getKind() == Shadow.FieldSet) {
index d8902a32a39ff0b633bf7f4f1dfafa23537e8381..c86f7e3285f8f07d2bc8dfecd440c2a4bb30d419 100644 (file)
@@ -33,7 +33,7 @@ public class KindedAnnotationAccessVar extends BcelVar {
 
        private Member stackField;
        private int index;
-       BcelVar target;
+       TypeX target;
        Member sig;
 
 //     public KindedAnnotationAccessVar(ResolvedTypeX type, Member stackField, int index) {
@@ -42,7 +42,7 @@ public class KindedAnnotationAccessVar extends BcelVar {
 //             this.index = index;
 //     }
        
-       public KindedAnnotationAccessVar(ResolvedTypeX type,BcelVar theTargetIsStoredHere,Member sig) {
+       public KindedAnnotationAccessVar(ResolvedTypeX type,TypeX theTargetIsStoredHere,Member sig) {
                super(type,0);
                target = theTargetIsStoredHere;
                this.sig = sig;
@@ -94,7 +94,7 @@ public class KindedAnnotationAccessVar extends BcelVar {
                
                // Calls getClass
                // System.err.println("What is the class of target? "+target.getType());
-               il.append(fact.createConstant(BcelWorld.makeBcelType(target.getType())));
+               il.append(fact.createConstant(BcelWorld.makeBcelType(target)));
 //             il.append(target.createLoad(fact));
 //        il.append(fact.createInvoke("java/lang/Object","getClass",jlClass,new Type[]{},Constants.INVOKEVIRTUAL));