1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Jul 24 10:35:38 2008 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Jul 24 11:12:41 2008 +0100 1.3 @@ -422,7 +422,34 @@ 1.4 * @param bs The bound. 1.5 */ 1.6 private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) { 1.7 - if (!(a instanceof CapturedType)) { 1.8 + if (a.tag == TYPEVAR && ((TypeVar)a).isCaptured()) { 1.9 + CapturedType ct = (CapturedType)a; 1.10 + boolean ok; 1.11 + if (ct.bound.isErroneous()) {//capture doesn't exist 1.12 + ok = false; 1.13 + } 1.14 + else { 1.15 + switch (ct.wildcard.kind) { 1.16 + case EXTENDS: 1.17 + ok = types.isCastable(bs.getUpperBound(), 1.18 + types.upperBound(a), 1.19 + Warner.noWarnings); 1.20 + break; 1.21 + case SUPER: 1.22 + ok = !types.notSoftSubtype(types.lowerBound(a), 1.23 + bs.getUpperBound()); 1.24 + break; 1.25 + case UNBOUND: 1.26 + ok = true; 1.27 + break; 1.28 + default: 1.29 + throw new AssertionError("Invalid bound kind"); 1.30 + } 1.31 + } 1.32 + if (!ok) 1.33 + log.error(pos, "not.within.bounds", a); 1.34 + } 1.35 + else { 1.36 a = types.upperBound(a); 1.37 for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) { 1.38 if (!types.isSubtype(a, l.head)) { 1.39 @@ -431,25 +458,6 @@ 1.40 } 1.41 } 1.42 } 1.43 - else { 1.44 - CapturedType ct = (CapturedType)a; 1.45 - boolean ok = false; 1.46 - switch (ct.wildcard.kind) { 1.47 - case EXTENDS: 1.48 - ok = types.isCastable(bs.getUpperBound(), 1.49 - types.upperBound(a), 1.50 - Warner.noWarnings); 1.51 - break; 1.52 - case SUPER: 1.53 - ok = !types.notSoftSubtype(types.lowerBound(a), 1.54 - bs.getUpperBound()); 1.55 - break; 1.56 - case UNBOUND: 1.57 - ok = true; 1.58 - } 1.59 - if (!ok) 1.60 - log.error(pos, "not.within.bounds", a); 1.61 - } 1.62 } 1.63 1.64 /** Check that type is different from 'void'.