changeset 1834:75e630bb6743

Fixes: 8008540: Constructor reference to non-reifiable array should be rejected 8008539: Spurious error when constructor reference mention an interface type 8008538: Constructor reference accepts wildcard parameterized types
author mcimadamore
date Wed, 20 Feb 2013 12:47:59 +0000
parents 60ceb785855f
children 66476d1c5e64
files src/share/classes/com/sun/tools/javac/comp/Check.java test/tools/javac/lambda/MethodReference38.out
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue Feb 19 18:45:37 2013 +0000
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Feb 20 12:47:59 2013 +0000
@@ -667,11 +667,18 @@
         t = checkClassOrArrayType(pos, t);
         if (t.hasTag(CLASS)) {
             if ((t.tsym.flags() & (ABSTRACT | INTERFACE)) != 0) {
-                log.error(pos, "abstract.cant.be.instantiated");
+                log.error(pos, "abstract.cant.be.instantiated", t.tsym);
                 t = types.createErrorType(t);
             } else if ((t.tsym.flags() & ENUM) != 0) {
                 log.error(pos, "enum.cant.be.instantiated");
                 t = types.createErrorType(t);
+            } else {
+                t = checkClassType(pos, t, true);
+            }
+        } else if (t.hasTag(ARRAY)) {
+            if (!types.isReifiable(((ArrayType)t).elemtype)) {
+                log.error(pos, "generic.array.creation");
+                t = types.createErrorType(t);
             }
         }
         return t;
--- a/test/tools/javac/lambda/MethodReference38.out	Tue Feb 19 18:45:37 2013 +0000
+++ b/test/tools/javac/lambda/MethodReference38.out	Wed Feb 20 12:47:59 2013 +0000
@@ -1,5 +1,5 @@
-MethodReference38.java:24:18: compiler.err.abstract.cant.be.instantiated
-MethodReference38.java:25:18: compiler.err.abstract.cant.be.instantiated
-MethodReference38.java:26:18: compiler.err.abstract.cant.be.instantiated
+MethodReference38.java:24:18: compiler.err.abstract.cant.be.instantiated: MethodReference38.A
+MethodReference38.java:25:18: compiler.err.abstract.cant.be.instantiated: MethodReference38.I
+MethodReference38.java:26:18: compiler.err.abstract.cant.be.instantiated: MethodReference38.AC
 MethodReference38.java:27:18: compiler.err.enum.cant.be.instantiated
 4 errors