]> source.dussan.org Git - aspectj.git/commitdiff
222648: testcode
authoraclement <aclement>
Wed, 20 Aug 2008 22:06:53 +0000 (22:06 +0000)
committeraclement <aclement>
Wed, 20 Aug 2008 22:06:53 +0000 (22:06 +0000)
tests/bugs162/pr222648/DataAspect.aj [new file with mode: 0644]
tests/bugs162/pr222648/DataInterface.java [new file with mode: 0644]
tests/bugs162/pr222648/Foo.java [new file with mode: 0644]
tests/bugs162/pr222648/FooBase.java [new file with mode: 0644]
tests/bugs162/pr222648/Marker.java [new file with mode: 0644]
tests/bugs162/pr222648/Resource.java [new file with mode: 0644]
tests/bugs162/pr222648/X.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/pr222648/DataAspect.aj b/tests/bugs162/pr222648/DataAspect.aj
new file mode 100644 (file)
index 0000000..e1e1080
--- /dev/null
@@ -0,0 +1,11 @@
+package test;\r
+\r
+public aspect DataAspect\r
+{\r
+       \r
+       public CONTENT Marker<CONTENT>.getContent()\r
+       {\r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/tests/bugs162/pr222648/DataInterface.java b/tests/bugs162/pr222648/DataInterface.java
new file mode 100644 (file)
index 0000000..76e9b18
--- /dev/null
@@ -0,0 +1,9 @@
+package test;\r
+\r
+public interface DataInterface<CONTENT> \r
+{\r
+       \r
+       public CONTENT getContent();\r
+       \r
+               \r
+}\r
diff --git a/tests/bugs162/pr222648/Foo.java b/tests/bugs162/pr222648/Foo.java
new file mode 100644 (file)
index 0000000..ebf2b0b
--- /dev/null
@@ -0,0 +1,12 @@
+package test;\r
+\r
+\r
+\r
+abstract public class Foo\r
+<      CONTENT extends Resource<CONTENT>, \r
+       DATA    extends DataInterface<CONTENT>\r
+>\r
+ extends\r
+       test.FooBase<DATA>\r
+{\r
+}\r
diff --git a/tests/bugs162/pr222648/FooBase.java b/tests/bugs162/pr222648/FooBase.java
new file mode 100644 (file)
index 0000000..e9e0e25
--- /dev/null
@@ -0,0 +1,9 @@
+package test;\r
+\r
+\r
+\r
+abstract public class FooBase<A>\r
+{\r
+}\r
+\r
+\r
diff --git a/tests/bugs162/pr222648/Marker.java b/tests/bugs162/pr222648/Marker.java
new file mode 100644 (file)
index 0000000..46718e0
--- /dev/null
@@ -0,0 +1,7 @@
+package test;\r
+\r
+\r
+\r
+public interface Marker<CONTENT> extends DataInterface<CONTENT>\r
+{\r
+}\r
diff --git a/tests/bugs162/pr222648/Resource.java b/tests/bugs162/pr222648/Resource.java
new file mode 100644 (file)
index 0000000..1a7f938
--- /dev/null
@@ -0,0 +1,5 @@
+package test;\r
+\r
+public interface Resource<RESOURCE> \r
+{\r
+}\r
diff --git a/tests/bugs162/pr222648/X.java b/tests/bugs162/pr222648/X.java
new file mode 100644 (file)
index 0000000..451dd70
--- /dev/null
@@ -0,0 +1,46 @@
+\r
+abstract class FooBase<A> { }\r
+\r
+// Existence of this line causes the exception\r
+abstract class Foo <CC extends Resource, DD extends DataInterface<CC>> extends FooBase<DD> { }\r
+\r
+interface DataInterface<CC> {\r
+  public CC getContent(); // ERR\r
+}\r
+\r
+interface Marker<CC> extends DataInterface<CC> { }\r
+\r
+interface Resource { }\r
+\r
+aspect DataAspect {\r
+  // Intertype declaration onto Marker that shares the variable\r
+  public C Marker<C>.getContent() { // ERR\r
+    return null;\r
+  }\r
+}\r
+\r
+/*\r
+X.java:7 [error] can't override CC DataInterface<CC>.getContent() with CC Marker.getContent() return types don't match\r
+public CC getContent();\r
+          ^^^^^^^^^\r
+\r
+X.java:16 [error] can't override CC DataInterface<CC>.getContent() with CC Marker.getContent() return types don't match\r
+public C Marker<C>.getContent() {\r
+                   ^^^^^^^^^\r
+\r
+1. Two errors because both source locations reported (stupid code)\r
+\r
+\r
+when failing:\r
+parent: CC DataInterface<CC>.getContent()\r
+child : CC Marker.getContent()\r
+Both return types are type variable reference types (different ones though)\r
+parent: TypeVar CC extends Resource\r
+child : CC\r
+\r
+So parent discovered the wrong type variable (the wrong CC).  \r
+parent is a ResolvedMemberImpl\r
+it is considered an 'existingmember' of the type DataInterface<CC>\r
+\r
+*/\r
+\r
index 3f970fb2fd427a0e14b2ed41a373c0ee57e3faa1..c4578effe82e060f90203f0b9b6d6b03bdd91249 100644 (file)
@@ -19,6 +19,8 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        
        // AspectJ1.6.2 
+       public void testGenericItdsOverrides_pr222648() { runTest("generic itds - overrides"); }
+       public void testGenericItdsOverrides_pr222648_2() { runTest("generic itds - overrides - 2"); }
     public void testItdCallingGenericMethod_pr145391() { runTest("itd calling generic method");}
     public void testItdCallingGenericMethod_pr145391_2() { runTest("itd calling generic method - 2");}
        public void testPublicPointcut_pr239539() { runTest("public pointcut"); }
index 7699dcc38162618be8836427653f6da70bb82590..17f3ec741535b115b60db9d97eb2df7ea2057c1f 100644 (file)
@@ -3,6 +3,14 @@
 <!-- AspectJ v1.6.2 Tests -->
 <suite>
 
+       <ajc-test dir="bugs162/pr222648" title="generic itds - overrides">
+         <compile files="DataAspect.aj DataInterface.java Foo.java FooBase.java Marker.java Resource.java" options="-1.5"/>
+       </ajc-test>
+
+       <ajc-test dir="bugs162/pr222648" title="generic itds - overrides - 2">
+         <compile files="X.java" options="-1.5"/>
+       </ajc-test>
+       
        <ajc-test dir="bugs162/pr145391" title="itd calling generic method">
      <compile files="GenericType.java" options="-1.5"/>
      <run class="GenericType"/>