]> source.dussan.org Git - aspectj.git/commitdiff
240693: test and fix: generic type defined inside around advice (mad)
authoraclement <aclement>
Tue, 19 Aug 2008 23:14:32 +0000 (23:14 +0000)
committeraclement <aclement>
Tue, 19 Aug 2008 23:14:32 +0000 (23:14 +0000)
tests/bugs162/pr240693/GenericClassInAdvice.java [new file with mode: 0644]
tests/bugs162/pr240693/PayloadClass.java [new file with mode: 0644]
tests/bugs162/pr240693/SomeInterface.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java
tests/src/org/aspectj/systemtest/ajc162/ajc162.xml

diff --git a/tests/bugs162/pr240693/GenericClassInAdvice.java b/tests/bugs162/pr240693/GenericClassInAdvice.java
new file mode 100644 (file)
index 0000000..675baef
--- /dev/null
@@ -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 (file)
index 0000000..f25e2e3
--- /dev/null
@@ -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 (file)
index 0000000..c6750f6
--- /dev/null
@@ -0,0 +1 @@
+public interface SomeInterface {}
index a2abed7e6e83fe1d888186c17c7880b8d3820042..96e8ede51b609e6450a62c48ec6e7ca309a075c9 100644 (file)
@@ -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"); }
index 88abdb027842178e07b6eb8f5b4864cf0dd3f511..0b53b26ee2f7ad410ce8a9ee7d00f5633d1ba29a 100644 (file)
         </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'"/>