]> source.dussan.org Git - aspectj.git/commitdiff
293620: c4
authoraclement <aclement>
Mon, 2 Nov 2009 16:50:35 +0000 (16:50 +0000)
committeraclement <aclement>
Mon, 2 Nov 2009 16:50:35 +0000 (16:50 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/patterns/NamePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java

index 526fc4c92aa010c6a64e86234ad1e1fefa59a6f8..3a84535d7f71878f735e2bc0f602e447351b549a 100644 (file)
@@ -133,6 +133,10 @@ public class NamePattern extends PatternNode {
        }
 
        public boolean matches(String other) {
+               if (starCount == 1 && pattern.length == 1) {
+                       // optimize for wildcard
+                       return true;
+               }
                return matches(other.toCharArray());
        }
 
index 52ed63a0fc87e84f47fa49d6751bdc5144db5be1..974991bc48a4930a414d6f87e4fdaebadde89631 100644 (file)
@@ -116,9 +116,12 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
                        return FuzzyBoolean.NO;
                }
                UnresolvedType typeToMatch = isThis ? shadow.getThisType() : shadow.getTargetType();
-               // if (typeToMatch == ResolvedType.MISSING) return FuzzyBoolean.NO;
-
-               return typePattern.matches(typeToMatch.resolve(shadow.getIWorld()), TypePattern.DYNAMIC);// AVPT was DYNAMIC
+               // optimization for case of this(Object) or target(Object)
+               // works for an ExactTypePattern (and we know there are no annotations to match here of course)
+               if (typePattern.getExactType().equals(ResolvedType.OBJECT)) {
+                       return FuzzyBoolean.YES;
+               }
+               return typePattern.matches(typeToMatch.resolve(shadow.getIWorld()), TypePattern.DYNAMIC);
        }
 
        @Override