1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8334248
4 * @summary Invalid error for early construction local class constructor method reference
5 * @compile/fail/ref=EarlyIndirectOuterCapture.out -XDrawDiagnostics EarlyIndirectOuterCapture.java
6 */
7
8 public class EarlyIndirectOuterCapture {
9
10 EarlyIndirectOuterCapture() {
11 this(null);
12 }
13
14 EarlyIndirectOuterCapture(InnerSuperclass inner) { }
15
16 class InnerSuperclass { }
17
18 static class InnerOuter extends EarlyIndirectOuterCapture { // accessible
19 class InnerInnerOuter extends EarlyIndirectOuterCapture { // not accessible
20 InnerInnerOuter() {
21 super(/* which enclosing instance here ? */new InnerSuperclass() { });
22 }
23
24 InnerInnerOuter(boolean b) {
25 super(InnerOuter.this.new InnerSuperclass() { }); // ok, explicit
26 }
27 }
28 }
29 }
|
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8334248
4 * @summary Invalid error for early construction local class constructor method reference
5 * @build InitializationWarningTester
6 * @run main InitializationWarningTester EarlyIndirectOuterCapture
7 */
8
9 public class EarlyIndirectOuterCapture {
10
11 EarlyIndirectOuterCapture() {
12 this(null);
13 }
14
15 EarlyIndirectOuterCapture(InnerSuperclass inner) { }
16
17 class InnerSuperclass { }
18
19 static class InnerOuter extends EarlyIndirectOuterCapture { // accessible
20 class InnerInnerOuter extends EarlyIndirectOuterCapture { // not accessible
21 InnerInnerOuter() {
22 super(new InnerSuperclass() { }); // should this be accepted?, InnerSuperclass is not an inner class of InnerInnerOuter
23 }
24
25 InnerInnerOuter(boolean b) {
26 super(InnerOuter.this.new InnerSuperclass() { }); // ok, explicit
27 }
28 }
29 }
30 }
|