changeset 168:20eebcd42dae

6938454: Unable to determine generic type in program that compiles under Java 6 Reviewed-by: aph Contributed-by: nikgor <nikolay@azulsystems.com>
author ikrylov
date Mon, 15 Dec 2014 21:19:25 +0400
parents ce47786cb1e1
children 4173e592ffa3
files src/share/classes/com/sun/tools/javac/comp/Infer.java
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Wed Oct 08 19:12:53 2014 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Dec 15 21:19:25 2014 +0400
@@ -262,7 +262,7 @@
             UndetVar uv = (UndetVar) l.head;
             TypeVar tv = (TypeVar)uv.qtype;
             ListBuffer<Type> hibounds = new ListBuffer<Type>();
-            for (Type t : that.getConstraints(tv, ConstraintKind.EXTENDS).prependList(types.getBounds(tv))) {
+            for (Type t : that.getConstraints(tv, ConstraintKind.EXTENDS)) {
                 if (!t.containsSome(that.tvars) && t.tag != BOT) {
                     hibounds.append(t);
                 }
@@ -286,7 +286,6 @@
         // check bounds
         List<Type> targs = Type.map(undetvars, getInstFun);
         targs = types.subst(targs, that.tvars, targs);
-        checkWithinBounds(that.tvars, targs, warn);
         return chk.checkType(warn.pos(), that.inst(targs, types), to);
     }
 
@@ -402,7 +401,7 @@
                         UndetVar uv = (UndetVar)t;
                         if (uv.qtype == tv) {
                             switch (ck) {
-                                case EXTENDS: return uv.hibounds;
+                                case EXTENDS: return uv.hibounds.appendList(types.subst(types.getBounds(tv), all_tvars, inferredTypes));
                                 case SUPER: return uv.lobounds;
                                 case EQUAL: return uv.inst != null ? List.of(uv.inst) : List.<Type>nil();
                             }