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 * @compile 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(new InnerSuperclass() { }); // should this be accepted?, InnerSuperclass is not an inner class of InnerInnerOuter
22 }
23
24 InnerInnerOuter(boolean b) {
25 super(InnerOuter.this.new InnerSuperclass() { }); // ok, explicit
26 }
27 }
28 }
29 }
|