8139751: Javac crash with -XDallowStringFolding=false

When string folding is disabled, need to keep the original expression.

Reviewed-by: mcimadamore
This commit is contained in:
Jan Lahoda 2015-10-19 12:41:45 +02:00
parent 11da417a28
commit 9cd68d0633
2 changed files with 7 additions and 4 deletions

View file

@ -973,7 +973,7 @@ public class JavacParser implements Parser {
*/
protected JCExpression foldStrings(JCExpression tree) {
if (!allowStringFolding)
return null;
return tree;
ListBuffer<JCExpression> opStack = new ListBuffer<>();
ListBuffer<JCLiteral> litBuf = new ListBuffer<>();
boolean needsFolding = false;

View file

@ -23,7 +23,7 @@
/*
* @test
* @bug 7068902
* @bug 7068902 8139751
* @summary verify that string folding can be enabled or disabled
* @modules jdk.compiler
*/
@ -86,11 +86,14 @@ public class StringFoldingTest {
if (disableStringFolding) {
if (text.contains("FOLDED")) {
throw new AssertionError("Expected string folding");
throw new AssertionError("Expected no string folding");
}
if (!text.contains("\"F\"")) {
throw new AssertionError("Expected content not found");
}
} else {
if (!text.contains("FOLDED")) {
throw new AssertionError("Expected no string folding");
throw new AssertionError("Expected string folding");
}
}
}