Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/tools/javac/7023703/T7023703neg.java
41149 views
1
/* @test /nodynamiccopyright/
2
* @bug 7023703
3
* @summary Valid code doesn't compile
4
* @compile/fail/ref=T7023703neg.out -XDrawDiagnostics T7023703neg.java
5
*/
6
7
class T7023703neg {
8
9
void testForLoop(boolean cond) {
10
final int bug;
11
final int bug2;
12
for (;cond;) {
13
final int item = 0;
14
bug2 = 1; //error
15
}
16
bug = 0; //ok
17
}
18
19
void testForEachLoop(java.util.Collection<Integer> c) {
20
final int bug;
21
final int bug2;
22
for (Integer i : c) {
23
final int item = 0;
24
bug2 = 1; //error
25
}
26
bug = 0; //ok
27
}
28
29
void testWhileLoop(boolean cond) {
30
final int bug;
31
final int bug2;
32
while (cond) {
33
final int item = 0;
34
bug2 = 1; //error
35
}
36
bug = 0; //ok
37
}
38
39
void testDoWhileLoop(boolean cond) {
40
final int bug;
41
final int bug2;
42
do {
43
final int item = 0;
44
bug2 = 1; //error
45
} while (cond);
46
bug = 0; //ok
47
}
48
}
49
50