8024207: javac crash in Flow.AssignAnalyzer.visitIdent
authorvromero
Sat, 14 Sep 2013 15:23:21 +0100
changeset 19940 d6d6e623f0b4
parent 19939 ab90fbc7b74e
child 19941 8b91e8eb2d20
8024207: javac crash in Flow.AssignAnalyzer.visitIdent Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
langtools/test/tools/javac/T8024207/FlowCrashTest.java
langtools/test/tools/javac/T8024207/FlowCrashTest.out
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Sep 12 22:40:29 2013 +0100
+++ b/langtools/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/langtools/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/langtools/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