Mercurial > hg > openjdk > icedtea > jdk7 > langtools
changeset 1137:c6379d7e1ce4
Merge
author | lana |
---|---|
date | Tue, 25 Oct 2011 16:12:55 -0700 |
parents | 94c24a6405ac (current diff) 94bb9583fe28 (diff) |
children | 52884b860141 |
files | |
diffstat | 8 files changed, 53 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/Types.java Tue Oct 25 13:51:18 2011 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Tue Oct 25 16:12:55 2011 -0700 @@ -269,10 +269,12 @@ // <editor-fold defaultstate="collapsed" desc="isConvertible"> /** - * Is t a subtype of or convertiable via boxing/unboxing - * convertions to s? + * Is t a subtype of or convertible via boxing/unboxing + * conversion to s? */ public boolean isConvertible(Type t, Type s, Warner warn) { + if (t.tag == ERROR) + return true; boolean tPrimitive = t.isPrimitive(); boolean sPrimitive = s.isPrimitive(); if (tPrimitive == sPrimitive) {
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Oct 25 13:51:18 2011 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Oct 25 16:12:55 2011 -0700 @@ -249,6 +249,13 @@ } }; + private final Filter<Type> botFilter = new Filter<Type>() { + @Override + public boolean accepts(Type t) { + return t.tag != BOT; + } + }; + /** Instantiate undetermined type variable to the lub of all its lower bounds. * Throw a NoInstanceException if this not possible. */ @@ -470,7 +477,8 @@ UndetVar uv = (UndetVar)t; if (uv.qtype == tv) { switch (ck) { - case EXTENDS: return uv.hibounds.appendList(types.subst(types.getBounds(tv), all_tvars, inferredTypes)); + case EXTENDS: return Type.filter(uv.hibounds, botFilter) + .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(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7085024/T7085024.java Tue Oct 25 16:12:55 2011 -0700 @@ -0,0 +1,12 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7085024 + * @summary internal error; cannot instantiate Foo + * @compile/fail/ref=T7085024.out -XDrawDiagnostics T7085024.java + */ + +class T7085024 { + T7085024 (boolean ret) { } //internal error goes away if constructor accepts a reference type + + T7085024 f = new T7085024((NonExistentClass) null ); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7085024/T7085024.out Tue Oct 25 16:12:55 2011 -0700 @@ -0,0 +1,2 @@ +T7085024.java:11:32: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T7085024, null) +1 error
--- a/test/tools/javac/Diagnostics/6862608/T6862608a.out Tue Oct 25 13:51:18 2011 -0700 +++ b/test/tools/javac/Diagnostics/6862608/T6862608a.out Tue Oct 25 16:12:55 2011 -0700 @@ -1,3 +1,3 @@ -T6862608a.java:19:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String> +T6862608a.java:19:41: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<java.util.Comparator<?>>, java.lang.Iterable<? extends java.util.Comparator<? super java.lang.String>>) - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, java.lang.Object, kindname.method, <T>compound(java.lang.Iterable<? extends java.util.Comparator<? super T>>))} 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712a.out Tue Oct 25 13:51:18 2011 -0700 +++ b/test/tools/javac/generics/inference/6638712/T6638712a.out Tue Oct 25 16:12:55 2011 -0700 @@ -1,2 +1,2 @@ -T6638712a.java:16:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String> +T6638712a.java:16:41: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<java.util.Comparator<?>>, java.lang.Iterable<? extends java.util.Comparator<? super java.lang.String>>) 1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/generics/inference/7086586/T7086586.java Tue Oct 25 16:12:55 2011 -0700 @@ -0,0 +1,19 @@ +/** + * @test /nodynamiccopyright/ + * @bug 7086586 + * @summary Inference producing null type argument + * @compile/fail/ref=T7086586.out -XDrawDiagnostics T7086586.java + */ +import java.util.List; + +class T7086586 { + + <T> List<T> m(List<? super T> dummy) { return null; } + + void test(List<?> l) { + String s = m(l).get(0); + Number n = m(l).get(0); + Exception e = m(l).get(0); + m(l).nonExistentMethod(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/generics/inference/7086586/T7086586.out Tue Oct 25 16:12:55 2011 -0700 @@ -0,0 +1,5 @@ +T7086586.java:14:21: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super java.lang.Object>) +T7086586.java:15:21: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super java.lang.Object>) +T7086586.java:16:24: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super java.lang.Object>) +T7086586.java:17:10: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super java.lang.Object>) +4 errors