]> source.dussan.org Git - aspectj.git/commitdiff
tests for pr108454, 'Waving' crash on a 1.5 java generics?
authoracolyer <acolyer>
Wed, 31 Aug 2005 12:25:47 +0000 (12:25 +0000)
committeracolyer <acolyer>
Wed, 31 Aug 2005 12:25:47 +0000 (12:25 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
tests/bugs150/pr108054/ASequence.java [new file with mode: 0644]
tests/bugs150/pr108054/ICounter.java [new file with mode: 0644]
tests/bugs150/pr108054/ISequence.java [new file with mode: 0644]
tests/bugs150/pr108054/pr108054.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

index 576229bbcde5d45c2d7dc4fb1c577773bf892d8a..07dc47a95cbcffd3859c43d0e550601b18c54e67 100644 (file)
@@ -228,15 +228,24 @@ public class EclipseFactory {
                                        arguments[i] = fromBinding(ptb.arguments[i]);
                                }
                        }
-                       ResolvedType baseType = UnresolvedType.forName(getName(binding)).resolve(getWorld());
+                       
+                       String baseTypeSignature = null;
+                       
+                       ResolvedType baseType = getWorld().resolve(UnresolvedType.forName(getName(binding)),true);
+                       if (baseType != ResolvedType.MISSING) {
+                               // can legitimately be missing if a bound refers to a type we haven't added to the world yet...
+                               if (!baseType.isGenericType() && arguments!=null) baseType = baseType.getGenericType();
+                               baseTypeSignature = baseType.getErasureSignature();
+                       } else {
+                               baseTypeSignature = UnresolvedType.forName(getName(binding)).getSignature();
+                       }
                        
                        // Create an unresolved parameterized type.  We can't create a resolved one as the 
                        // act of resolution here may cause recursion problems since the parameters may
                        // be type variables that we haven't fixed up yet.
-                       if (!baseType.isGenericType() && arguments!=null) baseType = baseType.getGenericType();
                        if (arguments==null) arguments=new UnresolvedType[0];
                        String parameterizedSig = ResolvedType.PARAMETERIZED_TYPE_IDENTIFIER+CharOperation.charToString(binding.genericTypeSignature()).substring(1);
-                       return TypeFactory.createUnresolvedParameterizedType(parameterizedSig,baseType.getErasureSignature(),arguments);
+                       return TypeFactory.createUnresolvedParameterizedType(parameterizedSig,baseTypeSignature,arguments);
                }
                
                // Convert the source type binding for a generic type into a generic UnresolvedType
diff --git a/tests/bugs150/pr108054/ASequence.java b/tests/bugs150/pr108054/ASequence.java
new file mode 100644 (file)
index 0000000..eee773a
--- /dev/null
@@ -0,0 +1,12 @@
+public abstract class ASequence <V, T extends ICounter<V> > 
+          implements ISequence<V> {
+
+}
+          
+aspect EnsureTypesUnpackedInWeaver {
+       
+       before() : staticinitialization(*) && !within(EnsureTypesUnpackedInWeaver) {
+               System.out.println("hi");
+       }
+       
+}
\ No newline at end of file
diff --git a/tests/bugs150/pr108054/ICounter.java b/tests/bugs150/pr108054/ICounter.java
new file mode 100644 (file)
index 0000000..f22eba4
--- /dev/null
@@ -0,0 +1,3 @@
+public interface ICounter<T>  {
+
+}
\ No newline at end of file
diff --git a/tests/bugs150/pr108054/ISequence.java b/tests/bugs150/pr108054/ISequence.java
new file mode 100644 (file)
index 0000000..2b327cd
--- /dev/null
@@ -0,0 +1,3 @@
+public interface ISequence<V> {
+       
+}
\ No newline at end of file
diff --git a/tests/bugs150/pr108054/pr108054.aj b/tests/bugs150/pr108054/pr108054.aj
new file mode 100644 (file)
index 0000000..4d136be
--- /dev/null
@@ -0,0 +1,12 @@
+interface ISequence<V> {
+       
+}
+
+interface ICounter<T>  {
+
+}
+
+abstract class ASequence <V, T extends ICounter<V> > 
+          implements ISequence<V> {
+
+}
\ No newline at end of file
index 4413b9a267f6168850168a29bbee71b3ad52cae3..afe055400371f1ff46d20c22432754185e8c0444 100644 (file)
@@ -309,6 +309,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testFieldAccessInsideITDM() {
          runTest("itd field access inside itd method");
   }
+
+  public void testTypeVarWithTypeVarBound() {
+         runTest("type variable with type variable bound");
+  }
   
   // helper methods.....
   
index 0a4929d11bd8c69607725e9d1343e24b9753f853..201b95688cac98de1d1d0d7088abdd88889e0768 100644 (file)
         <compile files="pr108377.aj"/>
         <run class="pr108377"/>
     </ajc-test>
-    
+
+    <ajc-test dir="bugs150/pr108054" pr="108054" title="type variable with type variable bound">
+        <compile files="pr108054.aj" options="-1.5"/>
+        <compile files="ISequence.java,ICounter.java,ASequence.java" options="-1.5"/>
+    </ajc-test>
+        
     <!-- ============================================================================ -->
     <!-- ============================================================================ -->