mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8224228: No way to locally suppress lint warnings in parser/tokenizer or preview features 8353758: Missing calls to Log.useSource() in JavacTrees Reviewed-by: mcimadamore, vromero, jlahoda
62 lines
1.6 KiB
Java
62 lines
1.6 KiB
Java
/*
|
|
* @test /nodynamiccopyright/
|
|
* @bug 8224228
|
|
* @summary Verify SuppressWarnings works for LintCategore.TEXT_BLOCKS
|
|
* @compile/fail/ref=TextBlockSuppress.out -XDrawDiagnostics -Xlint:text-blocks -Werror TextBlockSuppress.java
|
|
*/
|
|
|
|
public class TextBlockSuppress {
|
|
|
|
public static class Example1 {
|
|
public void method() {
|
|
String s = """
|
|
trailing space here:\u0020
|
|
"""; // SHOULD get a warning here
|
|
}
|
|
}
|
|
|
|
@SuppressWarnings("text-blocks")
|
|
public static class Example2 {
|
|
public void method() {
|
|
String s = """
|
|
trailing space here:\u0020
|
|
"""; // SHOULD NOT get a warning here
|
|
}
|
|
}
|
|
|
|
public static class Example3 {
|
|
@SuppressWarnings("text-blocks")
|
|
public void method() {
|
|
String s = """
|
|
trailing space here:\u0020
|
|
"""; // SHOULD NOT get a warning here
|
|
}
|
|
}
|
|
|
|
public static class Example4 {
|
|
{
|
|
String s = """
|
|
trailing space here:\u0020
|
|
"""; // SHOULD get a warning here
|
|
}
|
|
}
|
|
|
|
@SuppressWarnings("text-blocks")
|
|
public static class Example5 {
|
|
{
|
|
String s = """
|
|
trailing space here:\u0020
|
|
"""; // SHOULD NOT get a warning here
|
|
}
|
|
}
|
|
|
|
public static class Example6 {
|
|
public void method() {
|
|
@SuppressWarnings("text-blocks")
|
|
String s = """
|
|
trailing space here:\u0020
|
|
"""; // SHOULD NOT get a warning here
|
|
}
|
|
}
|
|
}
|