jdk-24/test/langtools/tools/javac/TryWithResources/TwrLintUnderscore.java
Aggelos Biboudis 8aa50288a1 8302344: Compiler Implementation for Unnamed patterns and variables (Preview)
8307444: java.lang.AssertionError when using unnamed patterns
8307482: Compiler should accept var _ in nested patterns in switch case
8307007: Implementation for javax.lang.model for unnamed variables (Preview)
8308312: Compiler should fail when a local variable declaration does not include an Identifier and does not have an initializer
8308309: Compiler should accept mixed masked and unmasked variables in lambda parameters

Co-authored-by: Jan Lahoda <jlahoda@openjdk.org>
Co-authored-by: Aggelos Biboudis <abimpoudis@openjdk.org>
Reviewed-by: vromero, darcy
2023-05-22 08:52:36 +00:00

23 lines
661 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8304246
* @summary Compiler Implementation for Unnamed patterns and variables
* @enablePreview
* @compile/ref=TwrLintUnderscore.out --enable-preview -source ${jdk.version} -Xlint:try -XDrawDiagnostics TwrLintUnderscore.java
*/
class TwrLintUnderscore implements AutoCloseable {
private static void test1() {
try(TwrLintUnderscore _ = new TwrLintUnderscore()) {
// _ cannot be referenced so no lint warning for an unused resource should be emitted
}
}
/**
* The AutoCloseable method of a resource.
*/
@Override
public void close () {
return;
}
}