985efdc475
6964740: Project Coin: More tests for ARM compiler changes 6965277: Project Coin: Correctness issues in ARM implementation 6967065: add -Xlint warning category for Automatic Resource Management (ARM) Reviewed-by: jjb, darcy, mcimadamore, jjg, briangoetz
37 lines
988 B
Java
37 lines
988 B
Java
/*
|
|
* @test /nodynamiccopyright/
|
|
* @bug 6911256 6964740
|
|
* @author Joseph D. Darcy
|
|
* @summary Verify bad TWRs don't compile
|
|
* @compile/fail -source 6 TwrFlow.java
|
|
* @compile/fail/ref=BadTwr.out -XDrawDiagnostics BadTwr.java
|
|
*/
|
|
|
|
public class BadTwr implements AutoCloseable {
|
|
public static void main(String... args) {
|
|
// illegal repeated name
|
|
try(BadTwr r1 = new BadTwr(); BadTwr r1 = new BadTwr()) {
|
|
System.out.println(r1.toString());
|
|
}
|
|
|
|
// illegal duplicate name of method argument
|
|
try(BadTwr args = new BadTwr()) {
|
|
System.out.println(args.toString());
|
|
final BadTwr thatsIt = new BadTwr();
|
|
thatsIt = null;
|
|
}
|
|
|
|
try(BadTwr name = new BadTwr()) {
|
|
// illegal duplicate name of enclosing try
|
|
try(BadTwr name = new BadTwr()) {
|
|
System.out.println(name.toString());
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public void close() {
|
|
;
|
|
}
|
|
}
|