Skip to content

Commit

Permalink
[24] don't request access to enclosing class if it's never used
Browse files Browse the repository at this point in the history
+ additional test

Fixes eclipse-jdt#3194
  • Loading branch information
stephan-herrmann committed Dec 15, 2024
1 parent b6980e6 commit b6860a0
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2509,4 +2509,30 @@ public static void main(String... args0) {
"""},
"");
}

public void testGH3194_reopen() {
runConformTest(new String[] {
"X.java",
"""
sealed interface A permits X {}
public final class X implements A {
int a = 1;
class One {
int b = 2;
class Two {
int c = 3;
class Three {
int r = a + b + c;
}
}
}
public static void main(String argv[]) {
X x = new X();
One.Two.Three ci = x.new One().new Two().new Three(); // No enclosing instance of type X is accessible. Must qualify the allocation...
System.out.println(ci.r);
}
}
"""
});
}
}

0 comments on commit b6860a0

Please sign in to comment.