diff -r 77dba8b57346 -r 36df13bde238 src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Jul 24 10:35:38 2008 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Jul 24 11:12:41 2008 +0100 @@ -422,7 +422,34 @@ * @param bs The bound. */ private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) { - if (!(a instanceof CapturedType)) { + if (a.tag == TYPEVAR && ((TypeVar)a).isCaptured()) { + CapturedType ct = (CapturedType)a; + boolean ok; + if (ct.bound.isErroneous()) {//capture doesn't exist + ok = false; + } + else { + 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; + break; + default: + throw new AssertionError("Invalid bound kind"); + } + } + if (!ok) + log.error(pos, "not.within.bounds", a); + } + else { a = types.upperBound(a); for (List l = types.getBounds(bs); l.nonEmpty(); l = l.tail) { if (!types.isSubtype(a, l.head)) { @@ -431,25 +458,6 @@ } } } - 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); - } } /** Check that type is different from 'void'.