changeset 2859:03c26c60499c

8024207: javac crash in Flow.AssignAnalyzer.visitIdent Reviewed-by: jjg
author vromero
date Sat, 14 Sep 2013 15:23:21 +0100
parents 3ae1814f7c59
children 4932bb04c4b8
files src/share/classes/com/sun/tools/javac/comp/Resolve.java test/tools/javac/T8024207/FlowCrashTest.java test/tools/javac/T8024207/FlowCrashTest.out
diffstat 3 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Sep 12 22:40:29 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Sat Sep 14 15:23:21 2013 +0100
@@ -2546,7 +2546,7 @@
                     @Override
                     Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
                         if (sym.kind >= AMBIGUOUS) {
-                            if (sym.kind == HIDDEN) {
+                            if (sym.kind != WRONG_MTH && sym.kind != WRONG_MTHS) {
                                 sym = super.access(env, pos, location, sym);
                             } else {
                                 final JCDiagnostic details = sym.kind == WRONG_MTH ?
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8024207/FlowCrashTest.java	Sat Sep 14 15:23:21 2013 +0100
@@ -0,0 +1,23 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8024207
+ * @summary javac crash in Flow$AssignAnalyzer.visitIdent
+ * @compile/fail/ref=FlowCrashTest.out -XDrawDiagnostics FlowCrashTest.java
+ */
+
+import java.util.*;
+import java.util.stream.*;
+
+public class FlowCrashTest {
+    static class ViewId { }
+
+    public void crash() {
+
+        Map<ViewId,String> viewToProfile = null;
+        new TreeMap<>(viewToProfile.entrySet().stream()
+                      .collect(Collectors.toMap((vid, prn) -> prn,
+                                                (vid, prn) -> Arrays.asList(vid),
+                                                (a, b) -> { a.addAll(b); return a; })));
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8024207/FlowCrashTest.out	Sat Sep 14 15:23:21 2013 +0100
@@ -0,0 +1,2 @@
+FlowCrashTest.java:18:42: compiler.err.cant.apply.symbols: kindname.method, toMap, @475,@542,@624,{(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>), (compiler.misc.infer.arg.length.mismatch: T,K,U)),(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>,java.util.function.BinaryOperator<U>), (compiler.misc.infer.no.conforming.assignment.exists: T,K,U, (compiler.misc.incompatible.arg.types.in.lambda))),(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U,M>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>,java.util.function.BinaryOperator<U>,java.util.function.Supplier<M>), (compiler.misc.infer.arg.length.mismatch: T,K,U,M))}
+1 error