JDK-8225692 : jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 12.0.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2019-06-12
  • Updated: 2019-06-13
  • Resolved: 2019-06-13
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows [Version 10.0.17134.765]
Linux dev-alp-app-13 3.10.0-957.12.2.el7.x86_64 #1 SMP Fri Apr 19 21:09:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux


A DESCRIPTION OF THE PROBLEM :
Attempt to compile a program (provided) and compile fails with an Assert Exception. The program has a logic error, the post increment in a Lambda.  Expected a compile error of some other warning.

REGRESSION : Last worked in version 12.0.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Main.java

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
javac should produce Main.class
ACTUAL -
:\dev\Javac12Bug\src>javac Main.java
An exception has occurred in the compiler (12.0.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError
        at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
        at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:1053)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:962)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:595)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:630)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:616)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:667)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitLetExpr(Gen.java:2300)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$LetExpr.accept(JCTree.java:3026)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:853)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSelect(Gen.java:2241)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2189)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:853)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1803)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1709)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:853)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitConditional(Gen.java:1835)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCConditional.accept(JCTree.java:1452)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:853)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:872)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1808)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1709)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:853)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitReturn(Gen.java:1771)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1621)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:595)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:630)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:616)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:667)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1067)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:595)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:630)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:937)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:900)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:872)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:595)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2345)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:756)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1635)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1603)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
        at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
        at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

---------- BEGIN SOURCE ----------
import java.util.HashMap;
import java.util.Map;

public class Main {

    public static void main(String[] args) {
        Map<String, Integer> counters = new HashMap<>();
        counters.compute("java12", (k, v) -> v == null ? 1 : v++);
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
import java.util.HashMap;
import java.util.Map;

public class Main {

    public static void main(String[] args) {
        Map<String, Integer> counters = new HashMap<>();
        counters.compute("java12", (k, v) -> v == null ? 1 : ++v);
    }
}


FREQUENCY : always



Comments
This issue is already fixed by JDK-8222169 in 13 ea b22 onwards. Below results confirm the same 12 GA - Fail 13 ea b21 - Fail 13 ea b22 - Pass <== due to JDK-8222169
13-06-2019