From: aclement Date: Mon, 2 Nov 2009 16:50:35 +0000 (+0000) Subject: 293620: c4 X-Git-Tag: V1_6_7~174 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=11d21a49c805fab5624f5aa5e86714db40f10d52;p=aspectj.git 293620: c4 --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NamePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NamePattern.java index 526fc4c92..3a84535d7 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NamePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NamePattern.java @@ -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()); } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java index 52ed63a0f..974991bc4 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java @@ -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