author | sogoel |
Fri, 29 Aug 2014 00:42:42 -0700 | |
changeset 26274 | 02a5b23ee21c |
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 4249111 |
4 |
* @summary 'new' of inner class should not be allowed unless outer is constructed |
|
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=NewBeforeOuterConstructed.out -XDrawDiagnostics NewBeforeOuterConstructed.java |
10 | 7 |
*/ |
8 |
||
9 |
import java.io.*; |
|
10 |
||
11 |
public class NewBeforeOuterConstructed extends PrintStream { |
|
12 |
private class NullOutputStream extends OutputStream { |
|
13 |
public NullOutputStream() { |
|
14 |
super(); |
|
15 |
} |
|
16 |
public void write(int b) { } |
|
17 |
public void write(byte b[]) { } |
|
18 |
public void write(byte b[], int off, int len) { } |
|
19 |
public void flush() { } |
|
20 |
public void close() { } |
|
21 |
} |
|
22 |
public NewBeforeOuterConstructed() { |
|
23 |
// The 'new' below is illegal, as the outer |
|
24 |
// constructor has not been called when the |
|
25 |
// implicit reference to 'this' is evaluated |
|
26 |
// during the new instance expression. |
|
27 |
super(new NullOutputStream()); |
|
28 |
} |
|
29 |
} |