]> source.dussan.org Git - aspectj.git/commitdiff
testcode and fixes for 156962: Problems with @Deprecated in method signatures
authoraclement <aclement>
Tue, 12 Sep 2006 08:47:04 +0000 (08:47 +0000)
committeraclement <aclement>
Tue, 12 Sep 2006 08:47:04 +0000 (08:47 +0000)
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
weaver/src/org/aspectj/weaver/bcel/BcelField.java
weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
weaver/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java

index c5181da45ba8948dbe98a91f096b98d4e31051b4..01d75bedb205f95efe3ada247a11c67ba805faf3 100644 (file)
@@ -27,6 +27,8 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   // public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");}
   // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); }
   // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");}
+  public void testAnnotMethod_pr156962() { runTest("Test Annot Method");}
+  public void testAnnotMethodHasMember_pr156962() { runTest("Test Annot Method Has Member"); }
   public void testMixingGenerics_pr152848()  { runTest("mixing generics"); }
   public void testIncorrectStaticinitializationWeaving_pr149560_1() { runTest("incorrect staticinitialization weaving - codestyle");}
   public void testIncorrectStaticinitializationWeaving_pr149560_2() { runTest("incorrect staticinitialization weaving - annstyle");}
index 3df82bc33c90e4b1ee4e6db200da4a3c5d46d802..e672d8c069c999db7c23b09fc2fe497313c43046 100644 (file)
@@ -3,6 +3,18 @@
 <!-- AspectJ v1.5.3 Tests -->
 <suite>
 
+    <ajc-test dir="bugs153/pr156962" title="Test Annot Method">
+      <compile files="Sample.java, WarnDeprecatedMethod.aj" options="-1.5">
+        <message kind="warning" line="2" text="deprecated method"/>      
+      </compile>
+    </ajc-test>
+    
+    <ajc-test dir="bugs153/pr156962" title="Test Annot Method Has Member">
+      <compile files="Sample.java, LiftDeprecation.aj" options="-1.5 -XhasMember -showWeaveInfo -Xlint:ignore">
+        <message kind="weave" text="'Sample' (Sample.java:1) is annotated with @Deprecated type annotation from 'LiftDeprecation' (LiftDeprecation.aj:2)"/>
+      </compile>
+    </ajc-test>
+
     <ajc-test dir="bugs153/pr152848" title="mixing generics">
       <compile files="PairGeneric.java" options="-1.5" outjar="pair.jar"/>
       <compile files="BaseType.java" options="-1.5" outjar="basetype.jar" classpath="pair.jar"/>
index efb7d1f5158c7da64af68c447ea04d90b51ad5c1..b2a7e6b0d5369ce6f296bbae067e26ca492d2c66 100644 (file)
@@ -131,8 +131,7 @@ final class BcelField extends ResolvedMemberImpl {
                        annotations = new AnnotationX[annos.length];
                        for (int i = 0; i < annos.length; i++) {
                                        Annotation annotation = annos[i];
-                                       ResolvedType rtx = world.resolve(UnresolvedType.forName(annotation.getTypeName()));
-                                       annotationTypes.add(rtx);
+                                       annotationTypes.add(world.resolve(UnresolvedType.forSignature(annotation.getTypeSignature())));
                                        annotations[i] = new AnnotationX(annotation,world);
                                }
                }
index d5c604863bea7e359f8c53339624f07630c73a9b..2a2c94b1db2f9c87df0389fc236ba8ee815ec925 100644 (file)
@@ -281,8 +281,7 @@ final class BcelMethod extends ResolvedMemberImpl {
                annotations = new AnnotationX[annos.length];
                for (int i = 0; i < annos.length; i++) {
                                Annotation annotation = annos[i];
-                               ResolvedType rtx = world.resolve(UnresolvedType.forName(annotation.getTypeName()));
-                               annotationTypes.add(rtx);
+                               annotationTypes.add(world.resolve(UnresolvedType.forSignature(annotation.getTypeSignature())));
                                annotations[i] = new AnnotationX(annotation,world);
                        }
                }
index 49d9fb93780d856f6bba37929c064949f2bbe96e..9c966e6c7075049936783dbeee5b86821db424c8 100644 (file)
@@ -49,12 +49,15 @@ public class HasMemberTypePattern extends TypePattern {
                        return hasMethod(type);
                }
        }
+       
+       private final static String declareAtPrefix = "ajc$declare_at";
 
        private boolean hasField(ResolvedType type) {
                // TODO what about ITDs
                World world = type.getWorld();
                for (Iterator iter = type.getFields(); iter.hasNext();) {
                        Member field = (Member) iter.next();
+                       if (field.getName().startsWith(declareAtPrefix)) continue;
                        if (signaturePattern.matches(field, type.getWorld(), false)) {
                                if (field.getDeclaringType().resolve(world) != type) {
                                        if (Modifier.isPrivate(field.getModifiers())) continue;
@@ -70,6 +73,7 @@ public class HasMemberTypePattern extends TypePattern {
                World world = type.getWorld();
                for (Iterator iter = type.getMethods(); iter.hasNext();) {
                        Member method = (Member) iter.next();
+                       if (method.getName().startsWith(declareAtPrefix)) continue;
                        if (signaturePattern.matches(method, type.getWorld(), false)) {
                                if (method.getDeclaringType().resolve(world) != type) {
                                        if (Modifier.isPrivate(method.getModifiers())) continue;