|
Java example source code file (BadTwr.java)
The BadTwr.java Java example source code
/*
* @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() {
;
}
}
Other Java examples (source code examples)Here is a short list of links related to this Java BadTwr.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.