--- /dev/null
+// 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();
+ }
+}
+
+
--- /dev/null
+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");
+ }
+}
+
--- /dev/null
+public interface SomeInterface {}
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"); }
</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>
</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'"/>