]> source.dussan.org Git - aspectj.git/commitdiff
Fix for annotation resolution - allow for package names!
authoraclement <aclement>
Mon, 31 Jan 2005 13:18:35 +0000 (13:18 +0000)
committeraclement <aclement>
Mon, 31 Jan 2005 13:18:35 +0000 (13:18 +0000)
weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java

index b4a67924bfffb2132134475187706ad49fc8a12d..64dac28ffffe0cbe03aaa8dd9db618ee7cb027d4 100644 (file)
@@ -116,7 +116,22 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern {
                                return this;
                        }
                } else {
-                       annotationType = annotationType.resolve(scope.getWorld());
+                       // Non binding case
+
+                       String cleanname = annotationType.getClassName();
+                       annotationType = scope.getWorld().resolve(annotationType,true);
+                       
+                       // We may not have found it if it is in a package, lets look it up...
+                       if (annotationType == ResolvedTypeX.MISSING) {
+                               TypeX type = null;
+                               while ((type = scope.lookupType(cleanname,this)) == ResolvedTypeX.MISSING) {
+                                       int lastDot = cleanname.lastIndexOf('.');
+                                       if (lastDot == -1) break;
+                                       cleanname = cleanname.substring(0,lastDot)+"$"+cleanname.substring(lastDot+1);
+                               }
+                               annotationType = scope.getWorld().resolve(type,true);
+                       }
+                       
                        verifyIsAnnotationType(annotationType,scope);
                        return this;
                }