langtools/src/share/classes/com/sun/tools/javac/code/Types.java
changeset 1993 9b37ef07ba64
parent 1992 7be5dee022d5
child 2218 a8ec0baae870
child 2212 1d3dc0e0ba0c
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 29 12:18:19 2009 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 29 12:19:14 2009 +0000
@@ -2131,9 +2131,6 @@
                                   List<Type> to) {
         if (tvars.isEmpty())
             return tvars;
-        if (tvars.tail.isEmpty())
-            // fast common case
-            return List.<Type>of(substBound((TypeVar)tvars.head, from, to));
         ListBuffer<Type> newBoundsBuf = lb();
         boolean changed = false;
         // calculate new bounds
@@ -2173,8 +2170,14 @@
         Type bound1 = subst(t.bound, from, to);
         if (bound1 == t.bound)
             return t;
-        else
-            return new TypeVar(t.tsym, bound1, syms.botType);
+        else {
+            // create new type variable without bounds
+            TypeVar tv = new TypeVar(t.tsym, null, syms.botType);
+            // the new bound should use the new type variable in place
+            // of the old
+            tv.bound = subst(bound1, List.<Type>of(t), List.<Type>of(tv));
+            return tv;
+        }
     }
     // </editor-fold>