2013-01-18 15:38:14 +00:00
|
|
|
/*
|
2020-12-30 17:20:54 +00:00
|
|
|
* @test /nodynamiccopyright/
|
2013-01-18 15:38:14 +00:00
|
|
|
* @summary Check usages of underscore as identifier generate warnings
|
2022-09-01 16:43:50 +00:00
|
|
|
* @compile/fail/ref=UnderscoreAsIdent8.out --release 8 -XDrawDiagnostics -Xlint:-options -Werror UnderscoreAsIdent.java
|
2014-12-08 17:02:07 +00:00
|
|
|
* @compile/fail/ref=UnderscoreAsIdent9.out -XDrawDiagnostics -Werror UnderscoreAsIdent.java
|
2023-05-22 08:52:36 +00:00
|
|
|
* @compile/fail/ref=UnderscoreAsIdent21.out -source ${jdk.version} --enable-preview -XDrawDiagnostics UnderscoreAsIdent.java
|
2013-01-18 15:38:14 +00:00
|
|
|
*/
|
|
|
|
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 _;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|