mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
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:
parent
11da417a28
commit
9cd68d0633
2 changed files with 7 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue