]> source.dussan.org Git - aspectj.git/commitdiff
265729: get return type and param types correct for ITDs
authoraclement <aclement>
Tue, 24 Feb 2009 22:36:37 +0000 (22:36 +0000)
committeraclement <aclement>
Tue, 24 Feb 2009 22:36:37 +0000 (22:36 +0000)
tests/multiIncremental/pr265729_client/base/src/be/cronos/aop/App.java
tests/multiIncremental/pr265729_lib/base/src/be/cronos/aop/App.java
tests/multiIncremental/pr265729_lib/base/src/be/cronos/aop/aspects/InterTypeAspect.aj
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index 3e656699261f1f52aff00e6f33eadcbf78d14dc1..d2de5934409e5cf8a7ff4abf731636ffad4b2bcf 100644 (file)
@@ -7,7 +7,7 @@ public class App {
                // System.out.println( "Hello World!" ); //should throw compiler error,
                // OK
                App app = new App();
-               app.foo(42);
+               app.foo(42,null,null);
 
        }
 }
index a498276737e3f2f4917a7e2d522ebf1f49645426..b9829afaa7dbee5a2e4d52ff7e5cf978ac461023 100644 (file)
@@ -9,7 +9,7 @@ public class App
     {
         //System.out.println( "Hello World!" ); //should throw compiler error, OK
        App app = new App();
-       app.foo(42);
+       app.foo(42,null,null);
 
        
     }
index 39c3ae769ea19a46760a4362b27c09a597c18389..dfcb52ba759891383a37bdd1da6d1c5f2f1685e2 100644 (file)
@@ -1,7 +1,7 @@
 package be.cronos.aop.aspects;
-
+import java.io.*;
 import be.cronos.aop.InterTypeAspectSupport;
-
+import java.util.List;
 public aspect InterTypeAspect {
 
     public interface InterTypeAspectInterface {
@@ -9,7 +9,7 @@ public aspect InterTypeAspect {
     
     declare parents : (@InterTypeAspectSupport *) implements InterTypeAspectInterface;
     
-    public String InterTypeAspectInterface.foo(int i) {
+    public String InterTypeAspectInterface.foo(int i,List list,Serializable a) {
        return "bar";
     }
 
index 677b6ad6bf898378d99b9843d5efbad121ec4b0f..0a45de9d297a0ab70849ce9c10bdb3e4241c5a48 100644 (file)
@@ -66,7 +66,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                String cli = "pr265729_client";
                initialiseProject(cli);
 
-               addClasspathEntry(cli, new File("../lib/junit/junit.jar"));
+               // addClasspathEntry(cli, new File("../lib/junit/junit.jar"));
                configureAspectPath(cli, getProjectRelativePath(lib, "bin"));
                build(cli);
                checkWasFullBuild();
@@ -91,17 +91,35 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                // Node in tree: I.g(java.lang.String) [inter-type method]
                // Handle: =pr265729_client<be.cronos.aop{App.java}X)I.g)QString;
 
-               if (h1.endsWith("parents")) {
-                       assertEquals("=pr265729_client/binaries<be.cronos.aop.aspects*InterTypeAspect.aj}InterTypeAspect`declare parents", h1);
-                       assertEquals(
-                                       "=pr265729_client/binaries<be.cronos.aop.aspects*InterTypeAspect.aj}InterTypeAspect)InterTypeAspectInterface.foo)I",
-                                       h2);
-               } else {
-                       assertEquals("=pr265729_client/binaries<be.cronos.aop.aspects*InterTypeAspect.aj}InterTypeAspect`declare parents", h2);
-                       assertEquals(
-                                       "=pr265729_client/binaries<be.cronos.aop.aspects*InterTypeAspect.aj}InterTypeAspect)InterTypeAspectInterface.foo)I",
-                                       h1);
+               if (!h1.endsWith("parents")) {
+                       String h3 = h1;
+                       h1 = h2;
+                       h2 = h3;
                }
+               // ITD from the test program:
+               // public String InterTypeAspectInterface.foo(int i,List list,App a) {
+               assertEquals("=pr265729_client/binaries<be.cronos.aop.aspects*InterTypeAspect.aj}InterTypeAspect`declare parents", h1);
+               assertEquals(
+                               "=pr265729_client/binaries<be.cronos.aop.aspects*InterTypeAspect.aj}InterTypeAspect)InterTypeAspectInterface.foo)I)QList;)QSerializable;",
+                               h2);
+               IProgramElement binaryDecp = getModelFor(cli).getHierarchy().getElement(h1);
+               assertNotNull(binaryDecp);
+               IProgramElement binaryITDM = getModelFor(cli).getHierarchy().getElement(h2);
+               assertNotNull(binaryITDM);
+
+               // @see AsmRelationshipProvider.createIntertypeDeclaredChild()
+               List ptypes = binaryITDM.getParameterTypes();
+               assertEquals("int", new String((char[]) ptypes.get(0)));
+               assertEquals("java.util.List", new String((char[]) ptypes.get(1)));
+               assertEquals("java.io.Serializable", new String((char[]) ptypes.get(2)));
+
+               // param names not set
+               // List pnames = binaryITDM.getParameterNames();
+               // assertEquals("i", new String((char[]) pnames.get(0)));
+               // assertEquals("list", new String((char[]) pnames.get(1)));
+               // assertEquals("b", new String((char[]) pnames.get(2)));
+
+               assertEquals("java.lang.String", binaryITDM.getCorrespondingType(true));
        }
 
        public void testXmlConfiguredProject() {