-XD-relax doesn't work

Liam Miller-Cushon cushon at google.com
Wed Jan 20 00:49:13 UTC 2016


I think that -XD-relax has been broken since JDK8. My understanding is that
it was added in the jsr14 era, so maybe it should just be removed?

The fix is:

diff -r 6149fc30cd71
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
---
a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
Thu Jan 14 12:03:24 2016 -0800
+++
b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
Tue Jan 19 16:34:56 2016 -0800
@@ -1281,6 +1281,7 @@
                 return;

             if (relax) {
+                compileStates.put(env, CompileState.FLOW);
                 results.add(env);
                 return;
             }

Repro:

$ cat Test.java
class Test {}
$ javac -XD-relax Test.java
An exception has occurred in the compiler (1.9.0-internal). 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: The current compile state [ATTR] of class Test is
previous to FLOW
        at com.sun.tools.javac.util.Assert.error(Assert.java:162)
        at
com.sun.tools.javac.comp.TransTypes.translateClass(TransTypes.java:937)
        at
com.sun.tools.javac.comp.TransTypes.visitClassDef(TransTypes.java:512)
        at
com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:744)
        at
com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
        at
com.sun.tools.javac.comp.TransTypes.translate(TransTypes.java:491)
        at
com.sun.tools.javac.comp.TransTypes.translateTopLevelClass(TransTypes.java:977)
        at
com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1455)
        at
com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1326)
        at
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:871)
        at com.sun.tools.javac.main.Main.compile(Main.java:257)
        at com.sun.tools.javac.main.Main.compile(Main.java:142)
        at com.sun.tools.javac.Main.compile(Main.java:55)
        at com.sun.tools.javac.Main.main(Main.java:41)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20160119/89df868a/attachment.html>


More information about the compiler-dev mailing list