From: aclement Date: Tue, 19 Aug 2008 23:14:32 +0000 (+0000) Subject: 240693: test and fix: generic type defined inside around advice (mad) X-Git-Tag: V162DEV_M1~119 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=46373c59c0d02695e006d72537508ee0b52681c2;p=aspectj.git 240693: test and fix: generic type defined inside around advice (mad) --- diff --git a/tests/bugs162/pr240693/GenericClassInAdvice.java b/tests/bugs162/pr240693/GenericClassInAdvice.java new file mode 100644 index 000000000..675baefd0 --- /dev/null +++ b/tests/bugs162/pr240693/GenericClassInAdvice.java @@ -0,0 +1,30 @@ +// priviligedness of aspect contributes to the error +//public aspect GenericClassInAdvice { // comment out this line and comment the +// following to be able to compile... +privileged aspect GenericClassInAdvice { + + Object around(final SomeInterface src, final SomeInterface dst) : call(!void *.*(..)) && this(src) && target(dst) { + + // the parameterized constructor contributes to the error +// final PayloadClass payloadClass = new PayloadClass/**/() { +// comment out this line and comment the following to be able to compile... + final PayloadClass payloadClass = new PayloadClass() { + + public void run() { + // this triggers a compiler error in combination with: + // * privilegedness of the aspect "privileged aspect ..." + // * parameterized constructor "new PayloadClass() {...}' + // * the existence of a payload field in PayloadClass + Object payload = proceed(src,dst); // comment this line and the following or rename 'payload' to 'pl' to be able to compile... + this.setPayload(payload); + } + + }; + + payloadClass.run(); + + return payloadClass.getPayload(); + } +} + + diff --git a/tests/bugs162/pr240693/PayloadClass.java b/tests/bugs162/pr240693/PayloadClass.java new file mode 100644 index 000000000..f25e2e3ae --- /dev/null +++ b/tests/bugs162/pr240693/PayloadClass.java @@ -0,0 +1,16 @@ +public class PayloadClass { + private Type payload; + + public void setPayload(Type payload) { + this.payload = payload; + } + + public Type getPayload() { + return this.payload; + } + + public void run() { + System.out.println("payload class run"); + } +} + diff --git a/tests/bugs162/pr240693/SomeInterface.java b/tests/bugs162/pr240693/SomeInterface.java new file mode 100644 index 000000000..c6750f6a3 --- /dev/null +++ b/tests/bugs162/pr240693/SomeInterface.java @@ -0,0 +1 @@ +public interface SomeInterface {} diff --git a/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java b/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java index a2abed7e6..96e8ede51 100644 --- a/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java @@ -24,6 +24,7 @@ public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testGenericItds_pr242797_1() { runTest("generic itds - 1"); } public void testGenericItds_pr242797_2() { runTest("generic itds - 2"); } public void testGenericItds_pr242797_3() { runTest("generic itds - 3"); } + public void testPrivilegedGenerics_pr240693() { runTest("privileged generics"); } // public void testParamAnnosPipelining_pr241847() { runTest("param annos pipelining");} // public void testParamAnnoInner_pr241861() { runTest("param annotation inner class"); } public void testAnnotationDecp_pr239441() { runTest("annotation decp"); } diff --git a/tests/src/org/aspectj/systemtest/ajc162/ajc162.xml b/tests/src/org/aspectj/systemtest/ajc162/ajc162.xml index 88abdb027..0b53b26ee 100644 --- a/tests/src/org/aspectj/systemtest/ajc162/ajc162.xml +++ b/tests/src/org/aspectj/systemtest/ajc162/ajc162.xml @@ -24,20 +24,6 @@ - - - - - - - - - - - - - - @@ -70,6 +56,11 @@ + + + + +