mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8232681: ArrayIndexOutOfBoundsException with text blocks in javac when using -Xlint
Reviewed-by: sundar
This commit is contained in:
parent
c023983c7f
commit
945c8d555b
2 changed files with 21 additions and 2 deletions
|
@ -24,6 +24,7 @@
|
|||
/*
|
||||
* @test
|
||||
* @bug 8223967
|
||||
* @bug 8232681
|
||||
* @summary Unit tests for Text Block language changes
|
||||
* @library /tools/lib
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
|
@ -49,6 +50,7 @@ public class TextBlockAPI {
|
|||
test5();
|
||||
test6();
|
||||
test7();
|
||||
test8();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -195,6 +197,23 @@ public class TextBlockAPI {
|
|||
"}");
|
||||
}
|
||||
|
||||
static void test8() {
|
||||
String code = "class C {\n" +
|
||||
"\n" +
|
||||
" void x() {\n" +
|
||||
" String s = \"\"\"\n" +
|
||||
"\n" +
|
||||
"\"\"\";\n" +
|
||||
" }\n" +
|
||||
"}\n";
|
||||
|
||||
new JavacTask(TOOLBOX)
|
||||
.sources(code)
|
||||
.classpath(".")
|
||||
.options("--enable-preview", "-source", JDK_VERSION, "-encoding", "utf8", "-Xlint")
|
||||
.run();
|
||||
}
|
||||
|
||||
/*
|
||||
* Test source for successful compile.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue