1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Wed Jan 11 18:23:24 2012 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Thu Jan 12 15:28:34 2012 +0000 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -332,25 +332,29 @@ 1.11 //replace uninferred type-vars 1.12 targs = types.subst(targs, 1.13 that.tvars, 1.14 - instaniateAsUninferredVars(undetvars, that.tvars)); 1.15 + instantiateAsUninferredVars(undetvars, that.tvars)); 1.16 } 1.17 return chk.checkType(warn.pos(), that.inst(targs, types), to); 1.18 } 1.19 //where 1.20 - private List<Type> instaniateAsUninferredVars(List<Type> undetvars, List<Type> tvars) { 1.21 + private List<Type> instantiateAsUninferredVars(List<Type> undetvars, List<Type> tvars) { 1.22 + Assert.check(undetvars.length() == tvars.length()); 1.23 ListBuffer<Type> new_targs = ListBuffer.lb(); 1.24 - //step 1 - create syntethic captured vars 1.25 + //step 1 - create synthetic captured vars 1.26 for (Type t : undetvars) { 1.27 UndetVar uv = (UndetVar)t; 1.28 Type newArg = new CapturedType(t.tsym.name, t.tsym, uv.inst, syms.botType, null); 1.29 new_targs = new_targs.append(newArg); 1.30 } 1.31 //step 2 - replace synthetic vars in their bounds 1.32 + List<Type> formals = tvars; 1.33 for (Type t : new_targs.toList()) { 1.34 CapturedType ct = (CapturedType)t; 1.35 ct.bound = types.subst(ct.bound, tvars, new_targs.toList()); 1.36 - WildcardType wt = new WildcardType(ct.bound, BoundKind.EXTENDS, syms.boundClass); 1.37 + WildcardType wt = new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass); 1.38 + wt.bound = (TypeVar)formals.head; 1.39 ct.wildcard = wt; 1.40 + formals = formals.tail; 1.41 } 1.42 return new_targs.toList(); 1.43 }