OpenJDK / amber / amber
changeset 10452:c8f32009b413
7085024: internal error; cannot instantiate Foo
Summary: Types.isConvertible does not handle erroneous types correctly
Reviewed-by: jjg
author | mcimadamore |
---|---|
date | Wed, 31 Aug 2011 16:11:28 +0100 |
parents | de9223c94f9c |
children | 41fe3e16698a |
files | langtools/src/share/classes/com/sun/tools/javac/code/Types.java langtools/test/tools/javac/7085024/T7085024.java langtools/test/tools/javac/7085024/T7085024.out |
diffstat | 3 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 05 17:48:14 2017 +0200 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Aug 31 16:11:28 2011 +0100 @@ -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) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/7085024/T7085024.java Wed Aug 31 16:11:28 2011 +0100 @@ -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/langtools/test/tools/javac/7085024/T7085024.out Wed Aug 31 16:11:28 2011 +0100 @@ -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