From: aclement Date: Sat, 31 Oct 2009 19:28:52 +0000 (+0000) Subject: knows if exact declaring type pattern X-Git-Tag: V1_6_7~186 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f6882c0d42293848506722b2fe9d2f4d046f9e9;p=aspectj.git knows if exact declaring type pattern --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java index 8b6c4469d..0fc18905f 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java @@ -30,6 +30,7 @@ import org.aspectj.weaver.AnnotationTargetKind; import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.JoinPointSignature; +import org.aspectj.weaver.JoinPointSignatureIterator; import org.aspectj.weaver.Member; import org.aspectj.weaver.MemberKind; import org.aspectj.weaver.NewFieldTypeMunger; @@ -50,6 +51,8 @@ public class SignaturePattern extends PatternNode { private AnnotationTypePattern annotationPattern; private transient int hashcode = -1; + private transient boolean isExactDeclaringTypePattern = false; + public SignaturePattern(MemberKind kind, ModifiersPattern modifiers, TypePattern returnType, TypePattern declaringType, NamePattern name, TypePatternList parameterTypes, ThrowsPattern throwsPattern, AnnotationTypePattern annotationPattern) { this.kind = kind; @@ -70,6 +73,7 @@ public class SignaturePattern extends PatternNode { if (declaringType != null) { declaringType = declaringType.resolveBindings(scope, bindings, false, false); checkForIncorrectTargetKind(declaringType, scope, false); + isExactDeclaringTypePattern = (declaringType instanceof ExactTypePattern); } if (parameterTypes != null) { parameterTypes = parameterTypes.resolveBindings(scope, bindings, false, false); @@ -302,9 +306,9 @@ public class SignaturePattern extends PatternNode { // do the hard work then... boolean subjectMatch = true; boolean wantsAnnotationMatch = wantToMatchAnnotationPattern(); - Iterator candidateMatches = joinPointSignature.getJoinPointSignatures(world); + JoinPointSignatureIterator candidateMatches = joinPointSignature.getJoinPointSignatures(world); while (candidateMatches.hasNext()) { - JoinPointSignature aSig = (JoinPointSignature) candidateMatches.next(); + JoinPointSignature aSig = candidateMatches.next(); // System.out.println(aSig); FuzzyBoolean matchResult = matchesExactly(aSig, world, allowBridgeMethods, subjectMatch); if (matchResult.alwaysTrue()) { @@ -425,7 +429,6 @@ public class SignaturePattern extends PatternNode { if (subjectMatch && !throwsPattern.matches(aMethod.getExceptions(), world)) { return FuzzyBoolean.NO; } - if (!declaringType.matchesStatically(aMethod.getDeclaringType().resolve(world))) { return FuzzyBoolean.MAYBE; } @@ -833,4 +836,9 @@ public class SignaturePattern extends PatternNode { public Object accept(PatternNodeVisitor visitor, Object data) { return visitor.visit(this, data); } + + public boolean isExactDeclaringTypePattern() { + return isExactDeclaringTypePattern; + } + }