aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-08-19 23:14:32 +0000
committeraclement <aclement>2008-08-19 23:14:32 +0000
commit46373c59c0d02695e006d72537508ee0b52681c2 (patch)
tree4a8682fbbec4769c908091b1aff052a621878bb8
parent7b3134928cc1510172cbcb4693eb49e2f5d113a8 (diff)
downloadaspectj-46373c59c0d02695e006d72537508ee0b52681c2.tar.gz
aspectj-46373c59c0d02695e006d72537508ee0b52681c2.zip
240693: test and fix: generic type defined inside around advice (mad)
-rw-r--r--tests/bugs162/pr240693/GenericClassInAdvice.java30
-rw-r--r--tests/bugs162/pr240693/PayloadClass.java16
-rw-r--r--tests/bugs162/pr240693/SomeInterface.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc162/ajc162.xml19
5 files changed, 53 insertions, 14 deletions
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<Object> payloadClass = new PayloadClass/*<Object>*/() {
+// comment out this line and comment the following to be able to compile...
+ final PayloadClass<Object> payloadClass = new PayloadClass<Object>() {
+
+ public void run() {
+ // this triggers a compiler error in combination with:
+ // * privilegedness of the aspect "privileged aspect ..."
+ // * parameterized constructor "new PayloadClass<Object>() {...}'
+ // * 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<Type extends Object> {
+ 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 @@
</run>
</ajc-test>
- <ajc-test dir="bugs162/pr241047/case2" title="generic decp - 2">
- <compile files="SomeAspect.java SomeSubClass.java SomeInterface.java SomeBaseClass.java" options=" -Xlint:ignore -1.5">
- </compile>
- <run class="SomeBaseClass">
- <stdout>
- <line text="correct advice :-)"/>
- <line text="some base method"/>
- <line text="correct advice :-)"/>
- <line text="some sub method"/>
- </stdout>
- </run>
- </ajc-test>
-
-
<ajc-test dir="bugs162/pr242797/case1" title="generic itds - 1">
<compile files="ClassUtils.java CMEFinder.java Finder.java H2Deployment.java Localized.java LocalizedFinder.java OnetElement.java OnetFinder.java Partitioned.java PartitionedFinder.java" options="-1.5">
</compile>
@@ -70,6 +56,11 @@
</compile>
</ajc-test>
+ <ajc-test dir="bugs162/pr240693" title="privileged generics">
+ <compile files="PayloadClass.java SomeInterface.java GenericClassInAdvice.java" options="-1.5">
+ </compile>
+ </ajc-test>
+
<ajc-test dir="bugs162/pr238992" title="annotation value decp">
<compile files="Foo.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Extending interface set for type 'Goo'"/>