]> source.dussan.org Git - aspectj.git/commitdiff
fixes for annotation type pattern bugs uncovered in 150 tests
authoracolyer <acolyer>
Thu, 10 Mar 2005 09:39:56 +0000 (09:39 +0000)
committeracolyer <acolyer>
Thu, 10 Mar 2005 09:39:56 +0000 (09:39 +0000)
60 files changed:
ajde/testdata/DuplicateManifestTest/aspectjar.jar
ajde/testdata/DuplicateManifestTest/injar.jar
ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar
ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar
ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar
ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar
ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar
ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar
ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar
ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar
ajde/testdata/WeaveInfoMessagesTest/Simple.jar
org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar
org.aspectj.ajdt.core/testdata/OutjarTest/child.jar
org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar
tests/bugs/StringToString/helloworld.jar
tests/bugs/serialVersionUID/injar.jar
tests/java5/annotations/ajdkExamples/AnnotationsInSignaturePatterns.aj
tests/java5/annotations/ajdkExamples/AnnotationsInTypePatterns.aj
tests/java5/annotations/ajdkExamples/Cachable.java [deleted file]
tests/java5/annotations/ajdkExamples/Immutable.java [deleted file]
tests/java5/annotations/ajdkExamples/NonPersistent.java [deleted file]
tests/java5/annotations/ajdkExamples/Persisted.java [deleted file]
tests/java5/annotations/ajdkExamples/SensitiveData.java [deleted file]
tests/java5/annotations/ajdkExamples/Transaction.java [deleted file]
tests/java5/annotations/ajdkExamples/anns/Cachable.java [new file with mode: 0644]
tests/java5/annotations/ajdkExamples/anns/Immutable.java [new file with mode: 0644]
tests/java5/annotations/ajdkExamples/anns/NonPersistent.java [new file with mode: 0644]
tests/java5/annotations/ajdkExamples/anns/Persisted.java [new file with mode: 0644]
tests/java5/annotations/ajdkExamples/anns/SensitiveData.java [new file with mode: 0644]
tests/java5/annotations/ajdkExamples/anns/Transaction.java [new file with mode: 0644]
tests/java5/annotations/ajdkExamples/org/abc/Types.java
tests/java5/annotations/ajdkExamples/org/xyz/OrgXYZAnnotation.java
tests/java5/annotations/ajdkExamples/org/xyz/SignatureTypes.java
tests/java5/annotations/ajdkExamples/org/xyz/Types.java
tests/new/options11/aspectlib1.jar
tests/new/options11/aspectlib2.jar
tests/new/options11/injar.jar
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java
weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java
weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java
weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java
weaver/src/org/aspectj/weaver/patterns/TypePattern.java
weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
weaver/testdata/dummyAspect.jar
weaver/testdata/ltw-acaspects.jar
weaver/testdata/ltw-aspects.jar
weaver/testdata/ltw-classes.jar
weaver/testdata/ltw-deaspects.jar
weaver/testdata/ltw-dwaspects.jar
weaver/testdata/ltw-itdaspects.jar
weaver/testdata/ltw-peraspects.jar
weaver/testdata/ltw-woven.jar
weaver/testdata/megatrace.jar
weaver/testdata/megatrace0easy.jar
weaver/testdata/megatrace0hard.jar
weaver/testdata/megatraceNoweave.jar
weaver/testdata/tracing.jar
weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java

index 3ae297a462c86b0b4720498ec32e8c8ff5c8b6cc..4d7da738a76589651d65afacc2d9a7ebe4d3c650 100644 (file)
Binary files a/ajde/testdata/DuplicateManifestTest/aspectjar.jar and b/ajde/testdata/DuplicateManifestTest/aspectjar.jar differ
index 71225587602294697f686b51df9a59c62c507304..7f1ec16af4a764c84caf4d12d2fcc207ffdac13a 100644 (file)
Binary files a/ajde/testdata/DuplicateManifestTest/injar.jar and b/ajde/testdata/DuplicateManifestTest/injar.jar differ
index f838dce1c5918629e4ab3dfceeb2e4d349f8da02..f80d8575d51c8124a465655f05185832a35afc7b 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar differ
index f838dce1c5918629e4ab3dfceeb2e4d349f8da02..30927388329574b7d5f95fa49367a8b79725bb65 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar differ
index a40ef7e966fe4f34915531f0096f1d24fec10ce7..abf2675f50bc9478731335beff65e79d723a87e6 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar differ
index b606ea4a95c7e0c306e207d223be576c303122cd..2caea1f7c662a26d7458ccd8c77dc3d69edd8229 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar differ
index 6afbc5e232de42105412a57b32f291ba91984684..2caea1f7c662a26d7458ccd8c77dc3d69edd8229 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar differ
index 330b9962a7dd30f31cafb0f8ff3e516a603bc8b7..348f63857a2ebd89fa559c285ede4726cf5c57b3 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar differ
index 40abc44877620e0fedf10b20bc93250810cd8966..a18806b8a1aaa9c59f3eb6049ba5fa5c27440c77 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar differ
index 40abc44877620e0fedf10b20bc93250810cd8966..a18806b8a1aaa9c59f3eb6049ba5fa5c27440c77 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar and b/ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar differ
index d589430a0e92aa2f8672ab8752557f7f94453731..e9353128d9b5067b779b5cf1e9240d6deb6ec460 100644 (file)
Binary files a/ajde/testdata/WeaveInfoMessagesTest/Simple.jar and b/ajde/testdata/WeaveInfoMessagesTest/Simple.jar differ
index 8a3a18c3d38f5034b946774a037e242cf18b7de4..267314581a0c4a9226788af93e9e0a4532cd953b 100644 (file)
Binary files a/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar and b/org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar differ
index 4506909e34a91698db2e4af9a05980d6b22cfea2..0bce4dfde533e2782e61b3764bd47fe113a2108b 100644 (file)
Binary files a/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar and b/org.aspectj.ajdt.core/testdata/OutjarTest/child.jar differ
index 4c3e5d4f344b97908c2a2fcfea8ebcd59cd1dffa..d18a9bb6fd3ea7c1d42722e68f16a3bc9cb79690 100644 (file)
Binary files a/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar and b/org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar differ
index 28c795faac3daf6d965996fdd8f000590e429cde..06fd1c15dcd6223813deb1fb1c3884faa1ada8d6 100644 (file)
Binary files a/tests/bugs/StringToString/helloworld.jar and b/tests/bugs/StringToString/helloworld.jar differ
index 91e89e7002cb50b4278ab251f5ae23475ea2e347..75a50e57e115cfd9062332b031dfb78f0e075f1d 100644 (file)
Binary files a/tests/bugs/serialVersionUID/injar.jar and b/tests/bugs/serialVersionUID/injar.jar differ
index 066eaef8427868c3ce245649a6b8912ef8ca9bf9..86bfbe4154229f725f1c9f6bfb4028d5dc1ecb97 100644 (file)
@@ -1,4 +1,4 @@
-import org.xyz.*;
+import org.xyz.*; import anns.*;
 //import org.abc.*;
 import java.util.List;
 
index 2348bce73ac83f1c3b99c14b559d91d7b1f69f83..37469f5e7b69d03973e0fea1c7d52e7ba9b0d73b 100644 (file)
@@ -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 (file)
index 9cff589..0000000
+++ /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 (file)
index 6a81edf..0000000
+++ /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 (file)
index 6510066..0000000
+++ /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 (file)
index 28eb9a4..0000000
+++ /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 (file)
index 71a64d4..0000000
+++ /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 (file)
index e41e0dd..0000000
+++ /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 (file)
index 0000000..9e83a32
--- /dev/null
@@ -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 (file)
index 0000000..ce51383
--- /dev/null
@@ -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 (file)
index 0000000..88fea37
--- /dev/null
@@ -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 (file)
index 0000000..6ddf030
--- /dev/null
@@ -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 (file)
index 0000000..3919a91
--- /dev/null
@@ -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 (file)
index 0000000..37124cb
--- /dev/null
@@ -0,0 +1,2 @@
+package anns;
+public @interface Transaction {}
\ No newline at end of file
index b0ed7f8e0478453a42e88431a06059bd506010f4..ba8b2014049f6a7e2c623e87ac267939d3bb13b5 100644 (file)
@@ -1,4 +1,4 @@
-
+package org.abc; import anns.*;
 class E {}
 
 @Immutable
index 963617cbbb426a10b7646b6e77a3bb33551d0b32..04f5e4a2de423ecfcbf09d881d605be8a06ece0e 100644 (file)
@@ -1 +1,2 @@
+package org.xyz;
 public @interface OrgXYZAnnotation {}
\ No newline at end of file
index d3715743915ccf316919b7a371110fd95260485b..ae94e447c5961ea6b7c52a24e2fc65198b6d65fc 100644 (file)
@@ -1,3 +1,4 @@
+package org.xyz; import anns.*;
 import java.util.List;
 import java.util.ArrayList;
 
index 4d0339328dfaa3df5e780d8554ab35386dea0171..769f02bfcfb553f9aaec1e6ec81f35ad7d089fe5 100644 (file)
@@ -1,4 +1,4 @@
-
+package org.xyz; import anns.*;
 @Immutable
 class C {}
 
index 9a66d122de1148b1cd384bb7b7d1da049a288d61..680a8f76de2aab63800dcc4dab371e092dd3548f 100644 (file)
Binary files a/tests/new/options11/aspectlib1.jar and b/tests/new/options11/aspectlib1.jar differ
index fd8451d86c3456263d861531e814b483a894aacf..cab875dee074ede299681d0b97edf6de777cd720 100644 (file)
Binary files a/tests/new/options11/aspectlib2.jar and b/tests/new/options11/aspectlib2.jar differ
index fe08278633846c4a9bc1136ae1165c917831ba7e..429473b8e117244be7cbfb8fc178755624dbc471 100644 (file)
Binary files a/tests/new/options11/injar.jar and b/tests/new/options11/injar.jar differ
index 1cda2c53f5a664dd4130a4796a946a5f22427384..4ef1703da6c6937516d7de9a47c7eeaf954b3da8 100644 (file)
     </ajc-test>
 
     <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotation type pattern matching">
-        <compile files="AnnotationsInTypePatterns.aj,org/xyz/OrgXYZAnnotation.java,org/xyz/Types.java,org/abc/Types.java,Immutable.java,NonPersistent.java" options="-1.5">
+        <compile files="AnnotationsInTypePatterns.aj,org/xyz/OrgXYZAnnotation.java,org/xyz/Types.java,org/abc/Types.java,anns/Immutable.java,anns/NonPersistent.java" options="-1.5">
             <message kind="warning" line="23" text="(@Immutable *)"/>
             <message kind="warning" line="32" text="(@Immutable *)"/>
             <message kind="warning" line="3" text="(@Immutable *)"/>
             <message kind="warning" line="5" text="(!@Immutable *)"/>
             <message kind="warning" line="6" text="(!@Immutable *)"/>
             <message kind="warning" line="2" text="(!@Immutable *)"/>
-            <message kind="warning" line="1" text="(!@Immutable *)"/>
-            <message kind="warning" line="4" text="(!@Immutable *)"/>
+            <message kind="warning" line="2" text="(!@Immutable *)"/>
+            <message kind="warning" line="5" text="(!@Immutable *)"/>
             <message kind="warning" line="3" text="@Immutable (org.xyz.* || org.abc.*)"/>
             <message kind="warning" line="5" text="@Immutable (org.xyz.* || org.abc.*)"/>
             <message kind="warning" line="8" text="@Immutable (org.xyz.* || org.abc.*)"/>
             <message kind="warning" line="8" text="@(Immutable || NonPersistent) org.xyz..*"/>
             <message kind="warning" line="8" text="@Immutable @NonPersistent org.xyz..*"/>
             <message kind="warning" line="6" text="@(@Inherited *) org.xyz..*"/>
+            <message kind="warning" line="8" text="@(@Inherited *) org.xyz..*"/>            
         </compile>
     </ajc-test>
 
     <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotations in sig patterns">
-        <compile files="AnnotationsInSignaturePatterns.aj,Cachable.java,SensitiveData.java,Persisted.java,Classified.java,Immutable.java,Secure.java,Catastrophic.java,Oneway.java,Transaction.java,org/xyz/SignatureTypes.java" options="-1.5">
+        <compile files="AnnotationsInSignaturePatterns.aj,anns/Cachable.java,anns/SensitiveData.java,anns/Persisted.java,Classified.java,anns/Immutable.java,Secure.java,Catastrophic.java,Oneway.java,anns/Transaction.java,org/xyz/SignatureTypes.java" options="-1.5">
             <message kind="warning" line="32" text="@SensitiveData * *"/>
-            <message kind="warning" line="6" text="@SensitiveData * *"/>
-            <message kind="warning" line="12" text="@SensitiveData * *"/>
-            <message kind="warning" line="6" text="@SensitiveData List org.xyz..*.*"/>
-            <message kind="warning" line="10" text="(@SensitiveData *) org.xyz..*.*"/>
-            <message kind="warning" line="12" text="(@SensitiveData *) org.xyz..*.*"/>
+            <message kind="warning" line="7" text="@SensitiveData * *"/>
+            <message kind="warning" line="13" text="@SensitiveData * *"/>
+            <message kind="warning" line="7" text="@SensitiveData List org.xyz..*.*"/>
+            <message kind="warning" line="11" text="(@SensitiveData *) org.xyz..*.*"/>
+            <message kind="warning" line="13" text="(@SensitiveData *) org.xyz..*.*"/>
             <message kind="warning" line="50" text="@Foo (@Goo *) (@Hoo *).*"/>
             <message kind="warning" line="38" text="@Persisted @Classified * *"/>
             
             <message kind="warning" line="44" text="@Oneway * *(..)"/>
-            <message kind="warning" line="17" text="@Transaction * (@Persisted org.xyz..*).*(..)"/>
+            <message kind="warning" line="18" text="@Transaction * (@Persisted org.xyz..*).*(..)"/>
             <message kind="warning" line="52" text="* *.*(@Immutable *,..)"/>
             <message kind="warning" line="53" text="* *.*(@Immutable *,..)"/>
             <message kind="warning" line="54" text="* *.*(@Immutable *,..)"/>
             <message kind="warning" line="62" text="within(@Secure *)"/>
             <message kind="warning" line="63" text="within(@Secure *)"/>
             <message kind="warning" line="66" text="staticinitialization(@Persisted *)"/>
-            <message kind="warning" line="16" text="staticinitialization(@Persisted *)"/>
+            <message kind="warning" line="17" text="staticinitialization(@Persisted *)"/>
             <message kind="warning" line="56" text="call(@Oneway * *(..))"/>
-            <message kind="warning" line="27" text="execution(public (@Immutable *) org.xyz..*.*(..))"/>
-            <message kind="warning" line="25" text="set(@Cachable * *)"/>
+            <message kind="warning" line="28" text="execution(public (@Immutable *) org.xyz..*.*(..))"/>
+            <message kind="warning" line="26" text="set(@Cachable * *)"/>
             <message kind="warning" line="80" text="handler(!@Catastrophic *)"/>
             
         </compile>
index 20cdea8ab0abf8441dca42a676b6e69aec118b14..022ba5570ef4ac719637578c6a689ba481a7e8d5 100644 (file)
@@ -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);
index 5d948adcaadd4977736ace9b7facb38855b162c0..b4e4ea7e3843d168875e81c5f43111fc552c41ab 100644 (file)
@@ -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) {
index 772b4cdd4905e6720696ebf0f2b815475f337c7c..4106af21637512df610282fb20438d8b4018ba53 100644 (file)
@@ -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;
        }
index 642f09ace8cdd6f814d1bfb13ed9d526dddb597f..e5e372d80f864cc651fb174c57d44e9caecae389 100644 (file)
@@ -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);
index 3e3446ab3b221d9095fa55cb425c37cbc715dee7..cf0aa4809d3c7e030ec74dd48569bb9aabcc62b2 100644 (file)
@@ -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)
index 8ca0dd1b5baf9a8c909d85832a7d7b79059f93b5..9019954e231e8c5f5551c06386fa86000322ac13 100644 (file)
@@ -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) {
index 97a1ee019e2c35da00388e1100850d3b58a5b2e8..0dff4aaad61570bdfddde11442c81331071c4964 100644 (file)
@@ -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;
                        }
index 6937bff136b9cac2df4bff009a24d3dd0897b47d..af35626c6a6515f6c0ec9e451213b930ac954d13 100644 (file)
Binary files a/weaver/testdata/dummyAspect.jar and b/weaver/testdata/dummyAspect.jar differ
index 702daa9c6e7f2a06734f9ef861722071049314f3..7ee6e98889ebadde0da78cd2dc015b2d03726d70 100644 (file)
Binary files a/weaver/testdata/ltw-acaspects.jar and b/weaver/testdata/ltw-acaspects.jar differ
index dc76dd816e44c68a0fffa7869f9890ec427ad916..f09ee3db18ba44477f94a256ddd026c00d67eb0c 100644 (file)
Binary files a/weaver/testdata/ltw-aspects.jar and b/weaver/testdata/ltw-aspects.jar differ
index f5ba5080e9e9aeea1288848adac057c84a8c6ba3..1dfcc034bfe5a60f2dfe4c3ba8ddcf47ee8690eb 100644 (file)
Binary files a/weaver/testdata/ltw-classes.jar and b/weaver/testdata/ltw-classes.jar differ
index e86ffbe18a4e698e748ac9eefc93ce8f8789c52d..186e49409e7ccb4a3f519f1df6d5341b68384913 100644 (file)
Binary files a/weaver/testdata/ltw-deaspects.jar and b/weaver/testdata/ltw-deaspects.jar differ
index 382f7485738b342212afeef76f758837f7a972c5..791213a885a25dbd611cd4ce8e82d6532500b9e7 100644 (file)
Binary files a/weaver/testdata/ltw-dwaspects.jar and b/weaver/testdata/ltw-dwaspects.jar differ
index a0a9b3798686f99a234123a9e9d3a9f99afccf50..eedfaf50599cfb240da62bba94a494389eab025e 100644 (file)
Binary files a/weaver/testdata/ltw-itdaspects.jar and b/weaver/testdata/ltw-itdaspects.jar differ
index aca77d2318061c3a1f2a24071725f830c5b74a72..53f31b7e6aa48b91c8d2624d5d58803bfb0e114a 100644 (file)
Binary files a/weaver/testdata/ltw-peraspects.jar and b/weaver/testdata/ltw-peraspects.jar differ
index ec1fe6d0627b563d813b1d7e81044d2870e33648..c60f5c745c2833c45d9c114d7327c964f3eccd20 100644 (file)
Binary files a/weaver/testdata/ltw-woven.jar and b/weaver/testdata/ltw-woven.jar differ
index 14ae666ee4c6ac16c072bfc64adf8c0fb3346549..23a58710dec2d2192c533be6267fc6070cdb07fb 100644 (file)
Binary files a/weaver/testdata/megatrace.jar and b/weaver/testdata/megatrace.jar differ
index 7d076431fa995340de4e15f778b42b8bc7f0aa8d..4c025a67f45995cc281d4f0cacd71ba0d39936b8 100644 (file)
Binary files a/weaver/testdata/megatrace0easy.jar and b/weaver/testdata/megatrace0easy.jar differ
index 63842de96748e1b5ae6791b3e56bf3e4acea8c73..15f34d5d3f6a0d75877d10bcacbb9b5242dd2a15 100644 (file)
Binary files a/weaver/testdata/megatrace0hard.jar and b/weaver/testdata/megatrace0hard.jar differ
index 772aafbd7c188c2cb2e19c17aca02f8a8cc2cbf0..3d5b1fa08fcf79aed19d53098df82a01fa443e0f 100644 (file)
Binary files a/weaver/testdata/megatraceNoweave.jar and b/weaver/testdata/megatraceNoweave.jar differ
index fc4aef97452dd1f92464cceafb1203a61ddeddfb..8ce561163cebba7d9bde4f4cc90170aab633b70e 100644 (file)
Binary files a/weaver/testdata/tracing.jar and b/weaver/testdata/tracing.jar differ
index 136ab98fa36342b20974e74c5e7800923a0e2f7c..47b6d46b6c0cbb55ec8f988fe436c1cc84ab28c7 100644 (file)
@@ -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() {