diff -r 866db3b5e7b2 -r 77dba8b57346 src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jul 23 19:55:30 2008 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Jul 24 10:35:38 2008 +0100 @@ -422,9 +422,7 @@ * @param bs The bound. */ private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) { - if (a.isUnbound()) { - return; - } else if (a.tag != WILDCARD) { + if (!(a instanceof CapturedType)) { a = types.upperBound(a); for (List l = types.getBounds(bs); l.nonEmpty(); l = l.tail) { if (!types.isSubtype(a, l.head)) { @@ -432,11 +430,24 @@ return; } } - } else if (a.isExtendsBound()) { - if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings)) - log.error(pos, "not.within.bounds", a); - } else if (a.isSuperBound()) { - if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound())) + } + else { + CapturedType ct = (CapturedType)a; + boolean ok = false; + switch (ct.wildcard.kind) { + case EXTENDS: + ok = types.isCastable(bs.getUpperBound(), + types.upperBound(a), + Warner.noWarnings); + break; + case SUPER: + ok = !types.notSoftSubtype(types.lowerBound(a), + bs.getUpperBound()); + break; + case UNBOUND: + ok = true; + } + if (!ok) log.error(pos, "not.within.bounds", a); } } @@ -776,7 +787,7 @@ public void visitTypeApply(JCTypeApply tree) { if (tree.type.tag == CLASS) { List formals = tree.type.tsym.type.getTypeArguments(); - List actuals = tree.type.getTypeArguments(); + List actuals = types.capture(tree.type).getTypeArguments(); List args = tree.arguments; List forms = formals; ListBuffer tvars_buf = new ListBuffer(); @@ -792,7 +803,7 @@ // bounds substed with actuals. tvars_buf.append(types.substBound(((TypeVar)forms.head), formals, - Type.removeBounds(actuals))); + actuals)); args = args.tail; forms = forms.tail; @@ -811,10 +822,11 @@ tvars = tvars_buf.toList(); while (args.nonEmpty() && tvars.nonEmpty()) { checkExtends(args.head.pos(), - args.head.type, + actuals.head, tvars.head); args = args.tail; tvars = tvars.tail; + actuals = actuals.tail; } // Check that this type is either fully parameterized, or