]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 148409
authoraclement <aclement>
Thu, 6 Jul 2006 12:12:07 +0000 (12:12 +0000)
committeraclement <aclement>
Thu, 6 Jul 2006 12:12:07 +0000 (12:12 +0000)
tests/bugs153/pr148409/Blurgh.java [new file with mode: 0644]
tests/bugs153/pr148409/X.java [new file with mode: 0644]
tests/bugs153/pr148409/aop.xml [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
weaver/src/org/aspectj/weaver/UnresolvedType.java

diff --git a/tests/bugs153/pr148409/Blurgh.java b/tests/bugs153/pr148409/Blurgh.java
new file mode 100644 (file)
index 0000000..b44c0a9
--- /dev/null
@@ -0,0 +1,27 @@
+
+
+interface SecurityEntity {}
+class Goo {}
+interface Base {}
+interface Hoo<X> { public void m(X x);}
+
+class Foo<B extends Base, C extends B> extends Goo implements Hoo<B> {
+
+  public void m(B b) {
+  }
+}
+
+
+interface Interface1 extends Base {}
+
+class Impl1 implements Interface1 {}
+
+
+
+
+public class Blurgh {
+  public static void main(String []argv) {
+    new Foo<Interface1,Impl1>();
+   }
+}
+
diff --git a/tests/bugs153/pr148409/X.java b/tests/bugs153/pr148409/X.java
new file mode 100644 (file)
index 0000000..7011b8b
--- /dev/null
@@ -0,0 +1,4 @@
+aspect X {
+  before(): staticinitialization(Fo*) { }
+  before(): call(Fo*.new(..)) { }
+}
diff --git a/tests/bugs153/pr148409/aop.xml b/tests/bugs153/pr148409/aop.xml
new file mode 100644 (file)
index 0000000..a0dd0df
--- /dev/null
@@ -0,0 +1,5 @@
+<aspectj>
+    <aspects>
+         <aspect name="X"/> 
+    </aspects>
+</aspectj>
index 8d0a2f602a214c211bbc9dba4f7e57eb0140e34c..6c3b5b0b438f53f2851e398b36fd28b931059b1a 100644 (file)
@@ -33,8 +33,9 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testVerifyErrNoTypeCflowField_pr145693_1()       { runTest("verifyErrNoTypeCflowField"); }
   public void testVerifyErrInpathNoTypeCflowField_pr145693_2() { runTest("verifyErrInpathNoTypeCflowField"); }
   public void testCpathNoTypeCflowField_pr145693_3()           { runTest("cpathNoTypeCflowField"); }
-  //public void testVisibilityProblem_pr149071()                 { runTest("visibility problem");}
-  //public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");}
+  // public void testVisibilityProblem_pr149071()                 { runTest("visibility problem");}
+  // public void testAdviceNotWovenAspectPath_pr147841()          { runTest("advice not woven on aspectpath");}
+  public void testGenericSignatures_pr148409()                 { runTest("generic signature problem"); }
   
   /////////////////////////////////////////
   public static Test suite() {
index 5954001c60795b7919ffc90a4b197df4312a3ce4..30c4a1a8aa2176adb26d428abee6dd59ccd07d67 100644 (file)
       <run class="Sample" classpath="run.jar,apath.jar"/>
     </ajc-test>    
     
+     <ajc-test dir="bugs153/pr148409" title="generic signature problem">
+      <compile files="Blurgh.java" options="-1.5"/>
+      <compile files="X.java" options="-1.5 -Xlint:ignore"/>
+      <run class="Blurgh" options="-1.5" ltw="aop.xml"/>
+    </ajc-test>    
+    
     <ajc-test dir="bugs153/pr149071" title="visibility problem">
       <compile files="AspectItd.java"/>
     </ajc-test>    
index 328acdaf77f2002757935a5c88bb3a44d93bc27a..49834e148e160809164432156ca460bbd84ee57c 100644 (file)
@@ -346,8 +346,17 @@ public class UnresolvedType implements TypeVariableDeclaringElement {
        ret.typeVariables = new TypeVariable[ftps.length];
        for (int i = 0; i < ftps.length; i++) {
                        Signature.FormalTypeParameter parameter = ftps[i];
-                       Signature.ClassTypeSignature cts = (Signature.ClassTypeSignature)parameter.classBound;
-                       ret.typeVariables[i]=new TypeVariable(ftps[i].identifier,UnresolvedType.forSignature(cts.outerType.identifier+";"));
+                       if (parameter.classBound instanceof Signature.ClassTypeSignature) {
+                               Signature.ClassTypeSignature cts = (Signature.ClassTypeSignature)parameter.classBound;
+                               ret.typeVariables[i]=new TypeVariable(ftps[i].identifier,UnresolvedType.forSignature(cts.outerType.identifier+";"));
+                       } else if (parameter.classBound instanceof Signature.TypeVariableSignature) {
+                               Signature.TypeVariableSignature tvs = (Signature.TypeVariableSignature)parameter.classBound;
+                               UnresolvedTypeVariableReferenceType utvrt = new UnresolvedTypeVariableReferenceType(new TypeVariable(tvs.typeVariableName));
+                               ret.typeVariables[i]=new TypeVariable(ftps[i].identifier,utvrt);
+                       } else {
+                         throw new BCException("UnresolvedType.forGenericTypeSignature(): Do not know how to process type variable bound of type '"+
+                                         parameter.classBound.getClass()+"'.  Full signature is '"+sig+"'");
+                       }
                }
        ret.signatureErasure = sig;
        ret.signature = ret.signatureErasure;