< prev index next >
test/langtools/tools/javac/lvti/ParserTest.java
Print this page
@@ -1,19 +1,19 @@
/*
* @test /nodynamiccopyright/
- * @bug 8177466
+ * @bug 8177466 8189146
+ * @compile/ref=ParserTest9.out -XDrawDiagnostics --release 9 ParserTest.java
* @summary Add compiler support for local variable type-inference
- * @compile -source 9 ParserTest.java
* @compile/fail/ref=ParserTest.out -XDrawDiagnostics ParserTest.java
*/
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.function.Function;
import java.util.List;
-class ParserTest<var> {
+class ParserTest<var extends AutoCloseable> {
static class TestClass {
static class var { } //illegal
}
static class TestInterface {
@@ -31,11 +31,11 @@
@Target(ElementType.TYPE_USE)
@interface TA { }
@interface DA { }
- static class var extends RuntimeException { } //illegal
+ static abstract class var extends RuntimeException implements AutoCloseable { } //illegal
var x = null; //illegal
void test() {
var[] x1 = null; //illegal
@@ -66,6 +66,12 @@
void test3(Object o) {
boolean b1 = o instanceof var; //error
Object o2 = (var)o; //error
}
+
+ void test4() throws Exception {
+ try (final var resource1 = null; // ok
+ var resource2 = null) { // ok
+ }
+ }
}
< prev index next >