Evaluation of String problem

Jan Lahoda jan.lahoda at oracle.com
Mon Nov 2 11:59:36 UTC 2015


Hello Roy,

This sounds like a problem in jdk9 javac (JDK-8139751) should be 
currently fixed in jdk9/dev:
http://hg.openjdk.java.net/jdk9/dev/langtools/rev/777c5a760a84

Please also note jshell is now integrated in jdk9/dev.

Thanks,
     Jan

On 2.11.2015 11:01, Roy van Rijn wrote:
> Dear kulla-devs,
>
> Trying the latest code from the kulla branch, and I've done the following:
> 1) Install JDK 9
> 2) Get latest sources: get_sources.sh
> 3) Modified script/compile.sh for OS/X (/bin instead of /usr/bin)
> 4) Modified script/compile.sh removed path
> ../src/jdk.jshell/share/classes/*/*/*/*/*/*.java (there doesnt seem to
> be a java file matching six stars)
> 5) Compile (no messages, works fine)
> 6) Modified script/run.sh for OS/X (/bin instead of /usr/bin)
> 7) Started jshell (although the version is: Version (version info not
> available))
>
> Next there seems to be a problem evaluating strings with the +
> operator, for example:
>
> -> String a = "a";
> |  Added variable a of type String with initial value "a"
> -> String b = "b";
> |  Added variable b of type String with initial value "b"
> -> String c = a + b;
> |  Added variable c of type String
> -> String d = "test " + " another test";
> |  Added variable d of type String
> -> System.out.println(a);
> a
> -> System.out.println(b);
> b
> -> System.out.println(c);
> null
> -> System.out.println(d);
> null
>
> Any idea what could be causing this? This breaks the most trivial of
> examples, for example:
> -> double tau = Math.PI * 2;
> |  Added variable tau of type double with initial value 6.283185307179586
>
> -> System.out.println("Tau is: " + tau);
> An exception has occurred in the compiler (1.9.0-ea). 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 com.sun.tools.javac.util.Assert.error(Assert.java:155)
> at com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
> at com.sun.tools.javac.util.ListBuffer.append(ListBuffer.java:127)
> at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1799)
> at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1814)
> at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1276)
> at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:902)
> at com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:873)
> at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:829)
> at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:809)
> at jdk.jshell.ReplParser.replUnit(ReplParser.java:225)
> at jdk.jshell.ReplParser.parseCompilationUnit(ReplParser.java:132)
> at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:601)
> at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:638)
> at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:930)
> at com.sun.tools.javac.api.JavacTaskImpl.parseInternal(JavacTaskImpl.java:233)
> at com.sun.tools.javac.api.JavacTaskImpl.access$400(JavacTaskImpl.java:69)
> at com.sun.tools.javac.api.JavacTaskImpl$2.call(JavacTaskImpl.java:225)
> at com.sun.tools.javac.api.JavacTaskImpl$2.call(JavacTaskImpl.java:222)
> at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:128)
> at com.sun.tools.javac.api.JavacTaskImpl.parse(JavacTaskImpl.java:222)
> at jdk.jshell.TaskFactory$ParseTask.parse(TaskFactory.java:221)
> at jdk.jshell.TaskFactory$ParseTask.<init>(TaskFactory.java:207)
> at jdk.jshell.CompletenessAnalyzer$Parser.disambiguateDeclarationVsExpression(CompletenessAnalyzer.java:671)
> at jdk.jshell.CompletenessAnalyzer$Parser.parseUnit(CompletenessAnalyzer.java:615)
> at jdk.jshell.CompletenessAnalyzer.scan(CompletenessAnalyzer.java:87)
> at jdk.jshell.SourceCodeAnalysisImpl.analyzeCompletion(SourceCodeAnalysisImpl.java:133)
> at jdk.internal.jshell.tool.ConsoleIOContext$1.analyzeCompletion(ConsoleIOContext.java:77)
> at jdk.internal.jshell.tool.EditingHistory.add(EditingHistory.java:127)
> at jdk.internal.jline.console.ConsoleReader.finishBuffer(ConsoleReader.java:655)
> at jdk.internal.jline.console.ConsoleReader.accept(ConsoleReader.java:2027)
> at jdk.internal.jline.console.ConsoleReader.readLine(ConsoleReader.java:2695)
> at jdk.internal.jline.console.ConsoleReader.readLine(ConsoleReader.java:2277)
> at jdk.internal.jshell.tool.ConsoleIOContext.readLine(ConsoleIOContext.java:153)
> at jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:447)
> at jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:266)
> at jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:245)
> at jdk.internal.jshell.tool.JShellTool.main(JShellTool.java:235)
>
> Is there something wrong with the way I've compiled/used the latest
> code? Or is the jshell actually broken at this point?
>
> Roy
>


More information about the kulla-dev mailing list