]> source.dussan.org Git - aspectj.git/commitdiff
test that a signature with a generic declaring type does not match on the erasure...
authoracolyer <acolyer>
Tue, 12 Jul 2005 14:23:35 +0000 (14:23 +0000)
committeracolyer <acolyer>
Tue, 12 Jul 2005 14:23:35 +0000 (14:23 +0000)
tests/java5/generics/pointcuts/GenericDeclaringTypeWithParameterErasure.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

diff --git a/tests/java5/generics/pointcuts/GenericDeclaringTypeWithParameterErasure.aj b/tests/java5/generics/pointcuts/GenericDeclaringTypeWithParameterErasure.aj
new file mode 100644 (file)
index 0000000..f92853b
--- /dev/null
@@ -0,0 +1,18 @@
+public aspect GenericDeclaringTypeWithParameterErasure {
+       
+       // tests that the erasure of parameter types does NOT match a member when
+       // the declaring type pattern is generic (must use the type variable instead in
+       // the non-raw [cooked?] world).
+       
+       void someCode() {
+               ConcreteImplementingClass cic = new ConcreteImplementingClass();
+               cic.asInt(5.0d);  
+               GenericImplementingClass<Long> gic = new GenericImplementingClass<Long>();
+               gic.asInt(55L);   
+       }
+       
+       declare warning : 
+               execution<N>(* GenericInterface<N>.asInt(Number)) :
+               "execution<N>(* GenericInterface<N>.asInt(Number))";
+       
+}
\ No newline at end of file
index 02a4936398c5b42ad41825c6eb0c06874a57db64..08eb412ec57b37d6c04ea738a508019cdbb43349 100644 (file)
@@ -188,6 +188,10 @@ public class GenericsTests extends XMLBasedAjcTestCase {
                runTest("execution pcd with raw signature matching");
        }
        
+       public void testExecutionWithGenericDeclaringTypeAndErasedParameterTypes() {
+               runTest("execution pcd with generic declaring type and erased parameter types");
+       }
+       
        // --- helpers
                
        // Check the signature attribute on a class is correct
index 71593277b8dc55b9451f3073b587be0bacb5f629..8e98d67b98ecf3f28ad8d0c5879ee3d28c2c58c6 100644 (file)
      </compile>
    </ajc-test>
    
-      <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw signature matching">
+   <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw signature matching">
      <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,RawSignatureMatching.aj" options="-1.5">
          <message kind="warning" line="4" text="execution(* GenericInterface.asInt(Number))"/>
          <message kind="warning" line="5" text="execution(* GenericInterface.asInt(Number))"/>
      </compile>
    </ajc-test>
+
+   <ajc-test dir="java5/generics/pointcuts" title="execution pcd with generic declaring type and erased parameter types">
+     <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,GenericDeclaringTypeWithParameterErasure.aj" options="-1.5">
+     </compile>
+   </ajc-test>
+
    <!-- end of generics and pointcuts tests -->
    
    <!-- ============================================================== -->