c9d23c3940
8317221: Implementation for javax.lang.model for Unnamed Variables & Patterns Co-authored-by: Jan Lahoda <jlahoda@openjdk.org> Co-authored-by: Maurizio Cimadamore <mcimadamore@openjdk.org> Co-authored-by: Gavin Bierman <gbierman@openjdk.org> Co-authored-by: Brian Goetz <briangoetz@openjdk.org> Co-authored-by: Joe Darcy <darcy@openjdk.org> Co-authored-by: Aggelos Biboudis <abimpoudis@openjdk.org> Reviewed-by: jlahoda, mcimadamore
35 lines
845 B
Java
35 lines
845 B
Java
/*
|
|
* @test /nodynamiccopyright/
|
|
* @summary Check usages of underscore as identifier generate warnings
|
|
* @compile/fail/ref=UnderscoreAsIdent8.out --release 8 -XDrawDiagnostics -Xlint:-options -Werror UnderscoreAsIdent.java
|
|
* @compile/fail/ref=UnderscoreAsIdent9.out --release 9 -XDrawDiagnostics -Werror UnderscoreAsIdent.java
|
|
* @compile/fail/ref=UnderscoreAsIdent22.out -XDrawDiagnostics UnderscoreAsIdent.java
|
|
*/
|
|
package _._;
|
|
|
|
import _._;
|
|
|
|
class _ {
|
|
String _ = null;
|
|
void _(String _) { }
|
|
void testLocal() {
|
|
String _ = null;
|
|
}
|
|
void testFor() {
|
|
for (int _ = 0; _ < 10; _++);
|
|
}
|
|
void testTry() {
|
|
try { } catch (Throwable _) { }
|
|
}
|
|
void testLabel() {
|
|
_:
|
|
for (;;) {
|
|
break _;
|
|
}
|
|
_:
|
|
for (;;) {
|
|
continue _;
|
|
}
|
|
}
|
|
}
|