提交 ae7f261a 编写于 作者: J jlahoda

8139751: Javac crash with -XDallowStringFolding=false

Summary: When string folding is disabled, need to keep the original expression.
Reviewed-by: mcimadamore
上级 c47d08e2
...@@ -980,7 +980,7 @@ public class JavacParser implements Parser { ...@@ -980,7 +980,7 @@ public class JavacParser implements Parser {
*/ */
protected JCExpression foldStrings(JCExpression tree) { protected JCExpression foldStrings(JCExpression tree) {
if (!allowStringFolding) if (!allowStringFolding)
return null; return tree;
ListBuffer<JCExpression> opStack = new ListBuffer<>(); ListBuffer<JCExpression> opStack = new ListBuffer<>();
ListBuffer<JCLiteral> litBuf = new ListBuffer<>(); ListBuffer<JCLiteral> litBuf = new ListBuffer<>();
boolean needsFolding = false; boolean needsFolding = false;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 7068902 * @bug 7068902 8139751
* @summary verify that string folding can be enabled or disabled * @summary verify that string folding can be enabled or disabled
*/ */
...@@ -85,11 +85,14 @@ public class StringFoldingTest { ...@@ -85,11 +85,14 @@ public class StringFoldingTest {
if (disableStringFolding) { if (disableStringFolding) {
if (text.contains("FOLDED")) { 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 { } else {
if (!text.contains("FOLDED")) { if (!text.contains("FOLDED")) {
throw new AssertionError("Expected no string folding"); throw new AssertionError("Expected string folding");
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册