aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-10-30 19:03:56 +0000
committeraclement <aclement>2008-10-30 19:03:56 +0000
commit3594800a4c212228183822ec2db3962635655d83 (patch)
tree609ab8ac82f99f7b81722172c19340d81c468862
parentfc7ac6820b4ab997cd40cf781f1b7fd3271c0d61 (diff)
downloadaspectj-3594800a4c212228183822ec2db3962635655d83.tar.gz
aspectj-3594800a4c212228183822ec2db3962635655d83.zip
tests for 163005: upgraded test for 80571
-rw-r--r--tests/bugs150/pr80571.aj4
-rw-r--r--tests/bugs163/pr163005/Code.java25
-rw-r--r--tests/bugs163/pr163005/Code2.java14
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java12
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/ajc163.xml22
6 files changed, 78 insertions, 3 deletions
diff --git a/tests/bugs150/pr80571.aj b/tests/bugs150/pr80571.aj
index f7e3bc806..8991d4030 100644
--- a/tests/bugs150/pr80571.aj
+++ b/tests/bugs150/pr80571.aj
@@ -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
index 000000000..5ef476c30
--- /dev/null
+++ b/tests/bugs163/pr163005/Code.java
@@ -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
index 000000000..35283a0a8
--- /dev/null
+++ b/tests/bugs163/pr163005/Code2.java
@@ -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);
+ }
+}
+
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index ff8924788..67ca6e191 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -1090,7 +1090,9 @@
</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"/>
diff --git a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
index e0dadda18..e2fcbcca2 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
@@ -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");
diff --git a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
index 9119c6f5d..39dba19eb 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
+++ b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
@@ -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">