From: acolyer Date: Thu, 10 Mar 2005 09:39:56 +0000 (+0000) Subject: fixes for annotation type pattern bugs uncovered in 150 tests X-Git-Tag: V1_5_0M2~100 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=983eb455bf4617debc32779d5ae6d29e4b40e232;p=aspectj.git fixes for annotation type pattern bugs uncovered in 150 tests --- diff --git a/ajde/testdata/DuplicateManifestTest/aspectjar.jar b/ajde/testdata/DuplicateManifestTest/aspectjar.jar index 3ae297a46..4d7da738a 100644 Binary files a/ajde/testdata/DuplicateManifestTest/aspectjar.jar and b/ajde/testdata/DuplicateManifestTest/aspectjar.jar differ diff --git a/ajde/testdata/DuplicateManifestTest/injar.jar b/ajde/testdata/DuplicateManifestTest/injar.jar index 712255876..7f1ec16af 100644 Binary files a/ajde/testdata/DuplicateManifestTest/injar.jar and b/ajde/testdata/DuplicateManifestTest/injar.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar b/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar index f838dce1c..f80d8575d 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar b/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar index f838dce1c..309273883 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar index a40ef7e96..abf2675f5 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar index b606ea4a9..2caea1f7c 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar index 6afbc5e23..2caea1f7c 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar index 330b9962a..348f63857 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar b/ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar index 40abc4487..a18806b8a 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar b/ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar index 40abc4487..a18806b8a 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar differ diff --git a/ajde/testdata/WeaveInfoMessagesTest/Simple.jar b/ajde/testdata/WeaveInfoMessagesTest/Simple.jar index d589430a0..e9353128d 100644 Binary files a/ajde/testdata/WeaveInfoMessagesTest/Simple.jar and b/ajde/testdata/WeaveInfoMessagesTest/Simple.jar differ diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar b/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar index 8a3a18c3d..267314581 100644 Binary files a/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar and b/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar differ diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar b/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar index 4506909e3..0bce4dfde 100644 Binary files a/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar and b/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar differ diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar b/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar index 4c3e5d4f3..d18a9bb6f 100644 Binary files a/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar and b/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar differ diff --git a/tests/bugs/StringToString/helloworld.jar b/tests/bugs/StringToString/helloworld.jar index 28c795faa..06fd1c15d 100644 Binary files a/tests/bugs/StringToString/helloworld.jar and b/tests/bugs/StringToString/helloworld.jar differ diff --git a/tests/bugs/serialVersionUID/injar.jar b/tests/bugs/serialVersionUID/injar.jar index 91e89e700..75a50e57e 100644 Binary files a/tests/bugs/serialVersionUID/injar.jar and b/tests/bugs/serialVersionUID/injar.jar differ diff --git a/tests/java5/annotations/ajdkExamples/AnnotationsInSignaturePatterns.aj b/tests/java5/annotations/ajdkExamples/AnnotationsInSignaturePatterns.aj index 066eaef84..86bfbe415 100644 --- a/tests/java5/annotations/ajdkExamples/AnnotationsInSignaturePatterns.aj +++ b/tests/java5/annotations/ajdkExamples/AnnotationsInSignaturePatterns.aj @@ -1,4 +1,4 @@ -import org.xyz.*; +import org.xyz.*; import anns.*; //import org.abc.*; import java.util.List; diff --git a/tests/java5/annotations/ajdkExamples/AnnotationsInTypePatterns.aj b/tests/java5/annotations/ajdkExamples/AnnotationsInTypePatterns.aj index 2348bce73..37469f5e7 100644 --- a/tests/java5/annotations/ajdkExamples/AnnotationsInTypePatterns.aj +++ b/tests/java5/annotations/ajdkExamples/AnnotationsInTypePatterns.aj @@ -1,4 +1,4 @@ -import org.xyz.*; +import org.xyz.*; import anns.*; import org.abc.*; import java.lang.annotation.Inherited; diff --git a/tests/java5/annotations/ajdkExamples/Cachable.java b/tests/java5/annotations/ajdkExamples/Cachable.java deleted file mode 100644 index 9cff589ce..000000000 --- a/tests/java5/annotations/ajdkExamples/Cachable.java +++ /dev/null @@ -1 +0,0 @@ -public @interface Cachable {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/Immutable.java b/tests/java5/annotations/ajdkExamples/Immutable.java deleted file mode 100644 index 6a81edf5c..000000000 --- a/tests/java5/annotations/ajdkExamples/Immutable.java +++ /dev/null @@ -1 +0,0 @@ -public @interface Immutable {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/NonPersistent.java b/tests/java5/annotations/ajdkExamples/NonPersistent.java deleted file mode 100644 index 6510066c1..000000000 --- a/tests/java5/annotations/ajdkExamples/NonPersistent.java +++ /dev/null @@ -1,4 +0,0 @@ -import java.lang.annotation.Inherited; - -@Inherited -public @interface NonPersistent {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/Persisted.java b/tests/java5/annotations/ajdkExamples/Persisted.java deleted file mode 100644 index 28eb9a4ae..000000000 --- a/tests/java5/annotations/ajdkExamples/Persisted.java +++ /dev/null @@ -1 +0,0 @@ -public @interface Persisted {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/SensitiveData.java b/tests/java5/annotations/ajdkExamples/SensitiveData.java deleted file mode 100644 index 71a64d4de..000000000 --- a/tests/java5/annotations/ajdkExamples/SensitiveData.java +++ /dev/null @@ -1 +0,0 @@ -public @interface SensitiveData {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/Transaction.java b/tests/java5/annotations/ajdkExamples/Transaction.java deleted file mode 100644 index e41e0dd98..000000000 --- a/tests/java5/annotations/ajdkExamples/Transaction.java +++ /dev/null @@ -1 +0,0 @@ -public @interface Transaction {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/anns/Cachable.java b/tests/java5/annotations/ajdkExamples/anns/Cachable.java new file mode 100644 index 000000000..9e83a32de --- /dev/null +++ b/tests/java5/annotations/ajdkExamples/anns/Cachable.java @@ -0,0 +1,2 @@ +package anns; +public @interface Cachable {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/anns/Immutable.java b/tests/java5/annotations/ajdkExamples/anns/Immutable.java new file mode 100644 index 000000000..ce513836f --- /dev/null +++ b/tests/java5/annotations/ajdkExamples/anns/Immutable.java @@ -0,0 +1,2 @@ +package anns; +public @interface Immutable {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/anns/NonPersistent.java b/tests/java5/annotations/ajdkExamples/anns/NonPersistent.java new file mode 100644 index 000000000..88fea3793 --- /dev/null +++ b/tests/java5/annotations/ajdkExamples/anns/NonPersistent.java @@ -0,0 +1,5 @@ +package anns; +import java.lang.annotation.Inherited; + +@Inherited +public @interface NonPersistent {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/anns/Persisted.java b/tests/java5/annotations/ajdkExamples/anns/Persisted.java new file mode 100644 index 000000000..6ddf03086 --- /dev/null +++ b/tests/java5/annotations/ajdkExamples/anns/Persisted.java @@ -0,0 +1,2 @@ +package anns; +public @interface Persisted {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/anns/SensitiveData.java b/tests/java5/annotations/ajdkExamples/anns/SensitiveData.java new file mode 100644 index 000000000..3919a9177 --- /dev/null +++ b/tests/java5/annotations/ajdkExamples/anns/SensitiveData.java @@ -0,0 +1,2 @@ +package anns; +public @interface SensitiveData {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/anns/Transaction.java b/tests/java5/annotations/ajdkExamples/anns/Transaction.java new file mode 100644 index 000000000..37124cbef --- /dev/null +++ b/tests/java5/annotations/ajdkExamples/anns/Transaction.java @@ -0,0 +1,2 @@ +package anns; +public @interface Transaction {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/org/abc/Types.java b/tests/java5/annotations/ajdkExamples/org/abc/Types.java index b0ed7f8e0..ba8b20140 100644 --- a/tests/java5/annotations/ajdkExamples/org/abc/Types.java +++ b/tests/java5/annotations/ajdkExamples/org/abc/Types.java @@ -1,4 +1,4 @@ - +package org.abc; import anns.*; class E {} @Immutable diff --git a/tests/java5/annotations/ajdkExamples/org/xyz/OrgXYZAnnotation.java b/tests/java5/annotations/ajdkExamples/org/xyz/OrgXYZAnnotation.java index 963617cbb..04f5e4a2d 100644 --- a/tests/java5/annotations/ajdkExamples/org/xyz/OrgXYZAnnotation.java +++ b/tests/java5/annotations/ajdkExamples/org/xyz/OrgXYZAnnotation.java @@ -1 +1,2 @@ +package org.xyz; public @interface OrgXYZAnnotation {} \ No newline at end of file diff --git a/tests/java5/annotations/ajdkExamples/org/xyz/SignatureTypes.java b/tests/java5/annotations/ajdkExamples/org/xyz/SignatureTypes.java index d37157439..ae94e447c 100644 --- a/tests/java5/annotations/ajdkExamples/org/xyz/SignatureTypes.java +++ b/tests/java5/annotations/ajdkExamples/org/xyz/SignatureTypes.java @@ -1,3 +1,4 @@ +package org.xyz; import anns.*; import java.util.List; import java.util.ArrayList; diff --git a/tests/java5/annotations/ajdkExamples/org/xyz/Types.java b/tests/java5/annotations/ajdkExamples/org/xyz/Types.java index 4d0339328..769f02bfc 100644 --- a/tests/java5/annotations/ajdkExamples/org/xyz/Types.java +++ b/tests/java5/annotations/ajdkExamples/org/xyz/Types.java @@ -1,4 +1,4 @@ - +package org.xyz; import anns.*; @Immutable class C {} diff --git a/tests/new/options11/aspectlib1.jar b/tests/new/options11/aspectlib1.jar index 9a66d122d..680a8f76d 100644 Binary files a/tests/new/options11/aspectlib1.jar and b/tests/new/options11/aspectlib1.jar differ diff --git a/tests/new/options11/aspectlib2.jar b/tests/new/options11/aspectlib2.jar index fd8451d86..cab875dee 100644 Binary files a/tests/new/options11/aspectlib2.jar and b/tests/new/options11/aspectlib2.jar differ diff --git a/tests/new/options11/injar.jar b/tests/new/options11/injar.jar index fe0827863..429473b8e 100644 Binary files a/tests/new/options11/injar.jar and b/tests/new/options11/injar.jar differ diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 1cda2c53f..4ef1703da 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -1052,7 +1052,7 @@ - + @@ -1064,8 +1064,8 @@ - - + + @@ -1076,22 +1076,23 @@ + - + - - - - - + + + + + - + @@ -1099,10 +1100,10 @@ - + - - + + diff --git a/weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java index 20cdea8ab..022ba5570 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java @@ -51,6 +51,11 @@ public class AndTypePattern extends TypePattern { return left.matchesExactly(type) && right.matchesExactly(type); } + protected boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType) { + return left.matchesExactly(type,annotatedType) && right.matchesExactly(type,annotatedType); + } + + public boolean matchesStatically(Class type) { return left.matchesStatically(type) && right.matchesStatically(type); } @@ -74,6 +79,22 @@ public class AndTypePattern extends TypePattern { right.setIsVarArgs(isVarArgs); } + public void setAnnotationTypePattern(AnnotationTypePattern annPatt) { + if (annPatt == AnnotationTypePattern.ANY) return; + if (left.annotationPattern == AnnotationTypePattern.ANY) { + left.setAnnotationTypePattern(annPatt); + } else { + left.setAnnotationTypePattern( + new AndAnnotationTypePattern(left.annotationPattern,annPatt)); + } + if (right.annotationPattern == AnnotationTypePattern.ANY) { + right.setAnnotationTypePattern(annPatt); + } else { + right.setAnnotationTypePattern( + new AndAnnotationTypePattern(right.annotationPattern,annPatt)); + } + } + public void write(DataOutputStream s) throws IOException { s.writeByte(TypePattern.AND); left.write(s); diff --git a/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java index 5d948adca..b4e4ea7e3 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java @@ -92,10 +92,18 @@ public class ExactTypePattern extends TypePattern { protected boolean matchesExactly(ResolvedTypeX matchType) { boolean typeMatch = this.type.equals(matchType); + annotationPattern.resolve(matchType.getWorld()); boolean annMatch = this.annotationPattern.matches(matchType).alwaysTrue(); return (typeMatch && annMatch); } + protected boolean matchesExactly(ResolvedTypeX matchType, ResolvedTypeX annotatedType) { + boolean typeMatch = this.type.equals(matchType); + annotationPattern.resolve(matchType.getWorld()); + boolean annMatch = this.annotationPattern.matches(annotatedType).alwaysTrue(); + return (typeMatch && annMatch); + } + public TypeX getType() { return type; } public FuzzyBoolean matchesInstanceof(ResolvedTypeX matchType) { diff --git a/weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java index 772b4cdd4..4106af216 100644 --- a/weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java @@ -17,6 +17,7 @@ import java.io.DataOutputStream; import java.io.IOException; import org.aspectj.util.FuzzyBoolean; +import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedTypeX; import org.aspectj.weaver.VersionedDataInputStream; @@ -51,7 +52,11 @@ public class NotTypePattern extends TypePattern { } protected boolean matchesExactly(ResolvedTypeX type) { - return !pattern.matchesExactly(type); + return (!pattern.matchesExactly(type) && annotationPattern.matches(type).alwaysTrue()); + } + + protected boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType) { + return (!pattern.matchesExactly(type,annotatedType) && annotationPattern.matches(annotatedType).alwaysTrue()); } public boolean matchesStatically(Class type) { @@ -70,14 +75,27 @@ public class NotTypePattern extends TypePattern { return !pattern.matchesStatically(type); } + public void setAnnotationTypePattern(AnnotationTypePattern annPatt) { + super.setAnnotationTypePattern(annPatt); + } + + public void setIsVarArgs(boolean isVarArgs) { + pattern.setIsVarArgs(isVarArgs); + } + + public void write(DataOutputStream s) throws IOException { s.writeByte(TypePattern.NOT); pattern.write(s); + annotationPattern.write(s); writeLocation(s); } public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException { TypePattern ret = new NotTypePattern(TypePattern.read(s, context)); + if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) { + ret.annotationPattern = AnnotationTypePattern.read(s,context); + } ret.readLocation(context, s); return ret; } diff --git a/weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java index 642f09ace..e5e372d80 100644 --- a/weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java @@ -54,6 +54,11 @@ public class OrTypePattern extends TypePattern { //??? if these had side-effects, this sort-circuit could be a mistake return left.matchesExactly(type) || right.matchesExactly(type); } + + protected boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType) { + //??? if these had side-effects, this sort-circuit could be a mistake + return left.matchesExactly(type,annotatedType) || right.matchesExactly(type,annotatedType); + } public boolean matchesStatically(ResolvedTypeX type) { return left.matchesStatically(type) || right.matchesStatically(type); @@ -78,6 +83,22 @@ public class OrTypePattern extends TypePattern { right.setIsVarArgs(isVarArgs); } + public void setAnnotationTypePattern(AnnotationTypePattern annPatt) { + if (annPatt == AnnotationTypePattern.ANY) return; + if (left.annotationPattern == AnnotationTypePattern.ANY) { + left.setAnnotationTypePattern(annPatt); + } else { + left.setAnnotationTypePattern( + new AndAnnotationTypePattern(left.annotationPattern,annPatt)); + } + if (right.annotationPattern == AnnotationTypePattern.ANY) { + right.setAnnotationTypePattern(annPatt); + } else { + right.setAnnotationTypePattern( + new AndAnnotationTypePattern(right.annotationPattern,annPatt)); + } + } + public void write(DataOutputStream s) throws IOException { s.writeByte(TypePattern.OR); left.write(s); diff --git a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java index 3e3446ab3..cf0aa4809 100644 --- a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java @@ -169,6 +169,8 @@ public abstract class TypePattern extends PatternNode { } protected abstract boolean matchesExactly(ResolvedTypeX type); + + protected abstract boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType); protected boolean matchesSubtypes(ResolvedTypeX type) { //System.out.println("matching: " + this + " to " + type); @@ -180,7 +182,22 @@ public abstract class TypePattern extends PatternNode { // FuzzyBoolean ret = FuzzyBoolean.NO; // ??? -eh for (Iterator i = type.getDirectSupertypes(); i.hasNext(); ) { ResolvedTypeX superType = (ResolvedTypeX)i.next(); - if (matchesSubtypes(superType)) return true; + if (matchesSubtypes(superType,type)) return true; + } + return false; + } + + protected boolean matchesSubtypes(ResolvedTypeX superType, ResolvedTypeX annotatedType) { + //System.out.println("matching: " + this + " to " + type); + if (matchesExactly(superType,annotatedType)) { + //System.out.println(" true"); + return true; + } + + // FuzzyBoolean ret = FuzzyBoolean.NO; // ??? -eh + for (Iterator i = superType.getDirectSupertypes(); i.hasNext(); ) { + ResolvedTypeX superSuperType = (ResolvedTypeX)i.next(); + if (matchesSubtypes(superSuperType,annotatedType)) return true; } return false; } @@ -317,6 +334,10 @@ class EllipsisTypePattern extends TypePattern { protected boolean matchesExactly(ResolvedTypeX type) { return false; } + + protected boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType) { + return false; + } /** * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) @@ -385,6 +406,10 @@ class AnyTypePattern extends TypePattern { return true; } + protected boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType) { + return true; + } + /** * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) */ @@ -461,6 +486,11 @@ class AnyWithAnnotationTypePattern extends TypePattern { annotationPattern.resolve(type.getWorld()); return annotationPattern.matches(type).alwaysTrue(); } + + protected boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType) { + annotationPattern.resolve(type.getWorld()); + return annotationPattern.matches(annotatedType).alwaysTrue(); + } public FuzzyBoolean matchesInstanceof(ResolvedTypeX type) { return FuzzyBoolean.YES; @@ -531,6 +561,10 @@ class NoTypePattern extends TypePattern { protected boolean matchesExactly(ResolvedTypeX type) { return false; } + + protected boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType) { + return false; + } /** * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) diff --git a/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java index 8ca0dd1b5..9019954e2 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java @@ -75,6 +75,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern { public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) { + if (resolved) return this; this.typePattern = typePattern.resolveBindings(scope,bindings,false,false); resolved = true; if (typePattern instanceof ExactTypePattern) { diff --git a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java index 97a1ee019..0dff4aaad 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java @@ -117,6 +117,10 @@ public class WildTypePattern extends TypePattern { * @see org.aspectj.weaver.TypePattern#matchesExactly(IType) */ protected boolean matchesExactly(ResolvedTypeX type) { + return matchesExactly(type,type); + } + + protected boolean matchesExactly(ResolvedTypeX type, ResolvedTypeX annotatedType) { String targetTypeName = type.getName(); //System.err.println("match: " + targetTypeName + ", " + knownMatches); //Arrays.asList(importedPrefixes)); @@ -124,9 +128,10 @@ public class WildTypePattern extends TypePattern { annotationPattern.resolve(type.getWorld()); return matchesExactlyByName(targetTypeName) && - annotationPattern.matches(type).alwaysTrue(); + annotationPattern.matches(annotatedType).alwaysTrue(); } - + + /** * Used in conjunction with checks on 'isStar()' to tell you if this pattern represents '*' or '*[]' which are * different ! @@ -450,6 +455,7 @@ public class WildTypePattern extends TypePattern { } else { if (dim != 0) type = TypeX.makeArray(type, dim); TypePattern ret = new ExactTypePattern(type, includeSubtypes,isVarArgs); + ret.setAnnotationTypePattern(annotationPattern); ret.copyLocationFrom(this); return ret; } diff --git a/weaver/testdata/dummyAspect.jar b/weaver/testdata/dummyAspect.jar index 6937bff13..af35626c6 100644 Binary files a/weaver/testdata/dummyAspect.jar and b/weaver/testdata/dummyAspect.jar differ diff --git a/weaver/testdata/ltw-acaspects.jar b/weaver/testdata/ltw-acaspects.jar index 702daa9c6..7ee6e9888 100644 Binary files a/weaver/testdata/ltw-acaspects.jar and b/weaver/testdata/ltw-acaspects.jar differ diff --git a/weaver/testdata/ltw-aspects.jar b/weaver/testdata/ltw-aspects.jar index dc76dd816..f09ee3db1 100644 Binary files a/weaver/testdata/ltw-aspects.jar and b/weaver/testdata/ltw-aspects.jar differ diff --git a/weaver/testdata/ltw-classes.jar b/weaver/testdata/ltw-classes.jar index f5ba5080e..1dfcc034b 100644 Binary files a/weaver/testdata/ltw-classes.jar and b/weaver/testdata/ltw-classes.jar differ diff --git a/weaver/testdata/ltw-deaspects.jar b/weaver/testdata/ltw-deaspects.jar index e86ffbe18..186e49409 100644 Binary files a/weaver/testdata/ltw-deaspects.jar and b/weaver/testdata/ltw-deaspects.jar differ diff --git a/weaver/testdata/ltw-dwaspects.jar b/weaver/testdata/ltw-dwaspects.jar index 382f74857..791213a88 100644 Binary files a/weaver/testdata/ltw-dwaspects.jar and b/weaver/testdata/ltw-dwaspects.jar differ diff --git a/weaver/testdata/ltw-itdaspects.jar b/weaver/testdata/ltw-itdaspects.jar index a0a9b3798..eedfaf505 100644 Binary files a/weaver/testdata/ltw-itdaspects.jar and b/weaver/testdata/ltw-itdaspects.jar differ diff --git a/weaver/testdata/ltw-peraspects.jar b/weaver/testdata/ltw-peraspects.jar index aca77d231..53f31b7e6 100644 Binary files a/weaver/testdata/ltw-peraspects.jar and b/weaver/testdata/ltw-peraspects.jar differ diff --git a/weaver/testdata/ltw-woven.jar b/weaver/testdata/ltw-woven.jar index ec1fe6d06..c60f5c745 100644 Binary files a/weaver/testdata/ltw-woven.jar and b/weaver/testdata/ltw-woven.jar differ diff --git a/weaver/testdata/megatrace.jar b/weaver/testdata/megatrace.jar index 14ae666ee..23a58710d 100644 Binary files a/weaver/testdata/megatrace.jar and b/weaver/testdata/megatrace.jar differ diff --git a/weaver/testdata/megatrace0easy.jar b/weaver/testdata/megatrace0easy.jar index 7d076431f..4c025a67f 100644 Binary files a/weaver/testdata/megatrace0easy.jar and b/weaver/testdata/megatrace0easy.jar differ diff --git a/weaver/testdata/megatrace0hard.jar b/weaver/testdata/megatrace0hard.jar index 63842de96..15f34d5d3 100644 Binary files a/weaver/testdata/megatrace0hard.jar and b/weaver/testdata/megatrace0hard.jar differ diff --git a/weaver/testdata/megatraceNoweave.jar b/weaver/testdata/megatraceNoweave.jar index 772aafbd7..3d5b1fa08 100644 Binary files a/weaver/testdata/megatraceNoweave.jar and b/weaver/testdata/megatraceNoweave.jar differ diff --git a/weaver/testdata/tracing.jar b/weaver/testdata/tracing.jar index fc4aef974..8ce561163 100644 Binary files a/weaver/testdata/tracing.jar and b/weaver/testdata/tracing.jar differ diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java index 136ab98fa..47b6d46b6 100644 --- a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java @@ -170,18 +170,14 @@ public class AnnotationPatternTestCase extends TestCase { PatternParser p = new PatternParser("(@(Foo || Boo) (Foo || Boo))"); TypePattern t = p.parseTypePattern(); assertTrue("OrTypePattern",t instanceof OrTypePattern); - WildAnnotationTypePattern wtp = (WildAnnotationTypePattern) t.annotationPattern; - assertEquals("@((Foo || Boo))",wtp.toString()); - assertEquals("(@((Foo || Boo)) (Foo || Boo))",t.toString()); + assertEquals("((@((Foo || Boo)) Foo) || (@((Foo || Boo)) Boo))",t.toString()); } public void testNotSyntax() { PatternParser p = new PatternParser("!@Foo (Foo || Boo))"); TypePattern t = p.parseTypePattern(); assertTrue("OrTypePattern",t instanceof OrTypePattern); - NotAnnotationTypePattern natp = (NotAnnotationTypePattern) t.annotationPattern; - assertEquals("!@(Foo)",natp.toString()); - assertEquals("(!@(Foo) (Foo || Boo))",t.toString()); + assertEquals("((!@(Foo) Foo) || (!@(Foo) Boo))",t.toString()); } public void testParseMethodOrConstructorSigNoAP() {