author | katleman |
Thu, 21 Aug 2014 14:16:14 -0700 | |
changeset 25878 | 6d561031123e |
parent 25439 | 26d6d07eebc7 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
25439
26d6d07eebc7
8044080: .out files for unicode, implicitThis and importChecks tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
10 | 3 |
* @bug 4689058 |
4 |
* @summary unverifiable code for implicit outer in super constructor call |
|
5 |
* |
|
25439
26d6d07eebc7
8044080: .out files for unicode, implicitThis and importChecks tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
6 |
* @compile/fail/ref=NewBeforeOuterConstructed2.out -XDrawDiagnostics NewBeforeOuterConstructed2.java |
10 | 7 |
*/ |
8 |
||
9 |
public class NewBeforeOuterConstructed2 { |
|
10 |
NewBeforeOuterConstructed2(Object o) {} |
|
11 |
class Middle extends NewBeforeOuterConstructed2 { |
|
12 |
Middle(int i) { |
|
13 |
super(null); |
|
14 |
} |
|
15 |
Middle() { |
|
16 |
// The 'new' below is illegal, as the outer |
|
17 |
// constructor has not been called when the |
|
18 |
// implicit reference to 'this' is evaluated |
|
19 |
// during the new instance expression. |
|
20 |
super(/*Middle.this.*/new Middle(1)); |
|
21 |
} |
|
22 |
class Inner {} |
|
23 |
void f() { |
|
24 |
System.out.println("ok"); |
|
25 |
} |
|
26 |
} |
|
27 |
public static void main(String[] args) { |
|
28 |
NewBeforeOuterConstructed2 c = new NewBeforeOuterConstructed2(new Object()); |
|
29 |
Middle m = c.new Middle(); |
|
30 |
m.f(); |
|
31 |
} |
|
32 |
} |