]> source.dussan.org Git - aspectj.git/commitdiff
tests for 163005: upgraded test for 80571
authoraclement <aclement>
Thu, 30 Oct 2008 19:03:56 +0000 (19:03 +0000)
committeraclement <aclement>
Thu, 30 Oct 2008 19:03:56 +0000 (19:03 +0000)
tests/bugs150/pr80571.aj
tests/bugs163/pr163005/Code.java [new file with mode: 0644]
tests/bugs163/pr163005/Code2.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
tests/src/org/aspectj/systemtest/ajc163/ajc163.xml

index f7e3bc80641a326aa85e52c0f4164909292bbc5e..8991d4030be033d968f030952d6f9b76441c86d2 100644 (file)
@@ -1,4 +1,4 @@
-public class pr80571 {
+public class pr80571 implements I{
        
        public static void main(String[] args) {
                new pr80571();
@@ -19,4 +19,4 @@ aspect A {
                System.out.println("after");
                return ret;
        }
-}
\ No newline at end of file
+}
diff --git a/tests/bugs163/pr163005/Code.java b/tests/bugs163/pr163005/Code.java
new file mode 100644 (file)
index 0000000..5ef476c
--- /dev/null
@@ -0,0 +1,25 @@
+public aspect Code {
+
+        pointcut init(): initialization(Object+.new(..));
+
+        pointcut staticinit(): staticinitialization(Object+);
+
+        Class around(String className): cflowbelow(init() || staticinit()) &&
+call(Class Class.forName(String)) && args(className) {
+                System.out.println("Test");
+                return proceed(className);
+
+        }
+  public static void main(String[] argv) {
+    new SomeClass();
+  }
+}
+
+class SomeClass implements SomeInterface {
+
+}
+
+interface SomeInterface {
+        Class ADAPTER = SomeInterface.class;
+}
+
diff --git a/tests/bugs163/pr163005/Code2.java b/tests/bugs163/pr163005/Code2.java
new file mode 100644 (file)
index 0000000..35283a0
--- /dev/null
@@ -0,0 +1,14 @@
+interface Foo {
+        public static final Object dummy = new Object();
+}
+
+aspect Code2 {
+        Object around(): call(Object.new(..)) {
+                return proceed();
+        }
+
+        public static void main(String[] args) {
+                System.out.println(Foo.dummy);
+        }
+}
+
index ff8924788f9bd5712ddbf4264449c825599626c4..67ca6e191c770b92a7be451a04788c5ba5a077dc 100644 (file)
     </ajc-test>
 
     <ajc-test dir="bugs150" pr="80571" title="around advice on interface initializer">
-        <compile files="pr80571.aj"/>
+        <compile files="pr80571.aj">
+          <message kind="warning" text="The joinpoint 'constructor-call(void pr80571.&lt;init&gt;())' cannot be advised"/>
+        </compile>
         <run class="pr80571">
             <stdout>
                 <line text="before"/>
index e0dadda18a45cb310bcafa554195af1400a5ebd5..e2fcbcca2e10410df82ce4fa30ba96244558b80c 100644 (file)
@@ -23,6 +23,18 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 
 public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
+       public void testDontAddMethodBodiesToInterface_pr163005() {
+               runTest("do not add method bodies to an interface");
+       }
+
+       public void testDontAddMethodBodiesToInterface_pr163005_2() {
+               runTest("do not add method bodies to an interface - 2");
+       }
+
+       public void testDontAddMethodBodiesToInterface_pr163005_3() {
+               runTest("do not add method bodies to an interface - 3");
+       }
+
        public void testMissingLocalVariableTableEntriesOnAroundAdvice_pr173978() throws Exception {
                runTest("missing local variable table on around advice");
                JavaClass jc = Utils.getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(), "Test");
index 9119c6f5ded86ec8a42bb423fb5db0372166fef1..39dba19eb533a8706cbf817f2111845cfc271b1d 100644 (file)
@@ -2,6 +2,28 @@
 
 <suite>
 
+
+    <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface">
+      <compile files="Code.java" options="-1.4">
+        <message kind="warning" text="The joinpoint 'method-call(java.lang.Class java.lang.Class.forName(java.lang.String))' cannot be advised"/>
+      </compile>      
+      <run class="Code"/>
+    </ajc-test>
+    
+     <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface - 2">
+      <compile files="Code.java" options="-1.4 -XnoInline">
+        <message kind="warning" text="The joinpoint 'method-call(java.lang.Class java.lang.Class.forName(java.lang.String))' cannot be advised"/>
+      </compile>      
+      <run class="Code"/>
+    </ajc-test>
+    
+     <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface - 3">
+      <compile files="Code2.java" options="-1.4">
+        <message kind="warning" text="The joinpoint 'constructor-call(void java.lang.Object.&lt;init&gt;())' cannot be advised"/>
+      </compile>      
+      <run class="Code2"/>
+    </ajc-test>
+
     <ajc-test dir="bugs163/pr250091" title="itd cce">
       <compile files="Demo.java" options="-1.5"/>
       <run class="Demo">