]> source.dussan.org Git - aspectj.git/commitdiff
176905: test and fix
authoraclement <aclement>
Fri, 22 Aug 2008 22:09:18 +0000 (22:09 +0000)
committeraclement <aclement>
Fri, 22 Aug 2008 22:09:18 +0000 (22:09 +0000)
tests/bugs162/pr176905/ChainedItd.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java
tests/src/org/aspectj/systemtest/ajc162/ajc162.xml

diff --git a/tests/bugs162/pr176905/ChainedItd.aj b/tests/bugs162/pr176905/ChainedItd.aj
new file mode 100644 (file)
index 0000000..441cf70
--- /dev/null
@@ -0,0 +1,24 @@
+import java.lang.reflect.Field;
+import java.lang.annotation.*;
+
+public aspect ChainedItd {
+    declare @field: long *.foo: @Deprecated;
+    
+    declare @field: @Deprecated * *.foo: @MyAnnotation;
+    //uncomment the line below to prove our test should work
+    //declare @field: long *.foo: @MyAnnotation;
+    
+    public static void main(String argz[]) throws Exception {
+               Field idField = Test.class.getDeclaredField("foo");
+               idField.setAccessible(true);
+               assert idField.getAnnotation(MyAnnotation.class) != null;
+    }    
+}       
+
+class Test {
+    private long foo;
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MyAnnotation {
+}
index 7ef61767c49ecc084cbf1f65cab58438181d8c94..fd750f5b1b22dc6e326af7c8525c69a3a90f14d8 100644 (file)
@@ -19,6 +19,8 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        
        // AspectJ1.6.2 
+//     public void testAdvisingInterfaces_pr163005() { runTest("advising joinpoints in interfaces"); }
+       public void testChainedItds_pr176905() { runTest("chained itds"); }
        public void testDecAtAnnoDecP_pr198341() { runTest("dec atanno and decp"); }
 //     public void testStarInAnnoStyle_pr209951() { runTest("asterisk in at aj pointcut"); }
        public void testMissingMarkers_pr197720() { runTest("missing markers on inherited annotated method"); }
index 6011429b982b9465bc1093a16e1f023bfe00ebaf..e7f4cd2707a48f97cbb521fa5251810343c217fa 100644 (file)
@@ -2,6 +2,21 @@
 
 <!-- AspectJ v1.6.2 Tests -->
 <suite>
+       
+       <ajc-test dir="bugs162/pr163005" title="advising joinpoints in interfaces">
+         <compile files="SomeClass.java SomeInterface.java ProblemAspect.java" options="-1.4">
+           <message kind="warning" text="Cannot advise join point 'method-call(java.lang.Class java.lang.Class.forName(java.lang.String))' in interface 'SomeInterface' with around advice from 'ProblemAspect.java' line '7' as it will lead to creation of code in an interface (compiler limitation, bug 163005)"/>
+         </compile>
+         <run class="SomeClass"/>
+       </ajc-test>
+
+    <ajc-test dir="bugs162/pr176905" title="chained itds">
+        <compile options="-1.5" files="ChainedItd.aj">
+        </compile>    
+        <run class="ChainedItd">
+            <stderr/> <!-- no errors-->
+        </run>
+    </ajc-test>
 
    <ajc-test dir="bugs162/pr198341" title="dec atanno and decp">
      <compile options="-1.5 -showWeaveInfo" files="AnnotationAspect.java">
@@ -10,7 +25,6 @@
      </compile>
    </ajc-test>
 
-
    <ajc-test dir="bugs162/pr209051" title="asterisk in at aj pointcut">
      <compile options="-1.5" files="Bug.java"/>
      <run class="Bug">