author | lana |
Thu, 21 Jan 2016 09:46:01 -0800 | |
changeset 35340 | 38f7386ed942 |
parent 26662 | 7cf828d7c8fc |
permissions | -rw-r--r-- |
10 | 1 |
/* |
26662
7cf828d7c8fc
8055080: Group 9d: golden files for tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
10 | 3 |
* @bug 4462714 |
4 |
* @summary using of synthetic names in local class causes ClassFormatError |
|
5 |
* @author gafter |
|
6 |
* |
|
26662
7cf828d7c8fc
8055080: Group 9d: golden files for tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
7 |
* @compile/fail/ref=SynthName2.out -XDrawDiagnostics SynthName2.java |
10 | 8 |
*/ |
9 |
||
10 |
import java.io.PrintStream; |
|
11 |
||
26662
7cf828d7c8fc
8055080: Group 9d: golden files for tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
12 |
class SynthName2 { |
10 | 13 |
public static void main(String args[]) { |
14 |
run(args, System.out); |
|
15 |
} |
|
16 |
public static void run(String args[],PrintStream out) { |
|
17 |
int res1, res2; |
|
18 |
Intf ob = meth(1, 2); |
|
19 |
||
20 |
res1 = ob.getFirst(); |
|
21 |
res2 = ob.getSecond(); |
|
22 |
||
23 |
if ( res1 == 1 && res2 == 2 ) |
|
24 |
return; |
|
25 |
out.println("Failed: res1=" + res1 + ", res2=" + res2); |
|
26 |
throw new Error("test failed!"); |
|
27 |
} |
|
28 |
interface Intf { |
|
29 |
int getFirst(); |
|
30 |
int getSecond(); |
|
31 |
} |
|
32 |
static Intf meth(final int prm1, final int zzz) { |
|
33 |
class InnClass implements Intf { |
|
34 |
int val$prm1 = prm1; |
|
35 |
int val$zzz = zzz; |
|
36 |
int locVar; |
|
37 |
public int getFirst() { |
|
38 |
locVar = val$prm1; |
|
39 |
return prm1; |
|
40 |
} |
|
41 |
public int getSecond() { |
|
42 |
return zzz; |
|
43 |
} |
|
44 |
} |
|
45 |
return new InnClass(); |
|
46 |
} |
|
47 |
} |