RFR: 8356551: Javac rejects receiver parameter in constructor of local class in early construction context
Archie Cobbs
acobbs at openjdk.org
Fri May 9 21:51:50 UTC 2025
On Fri, 9 May 2025 21:42:38 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> The changes look good -- but I wonder -- is there really no way to prevent javac from "going down the rabbit hole" and attempting to prove that `Foo.this` is a good/accessible enclosing this (via `resolveSelf`) ? E.g. it feels like javac shouldn't even be in that method for a receiver parameter.
It happens at the start of `MemberEnter.checkReceiver()` where it needs to attribute the parameter to verify it has the correct type, and that means attributing the expression `Foo.this`. This seems like a reasonable thing to do at that point... so maybe the problem is that the early access check is happening then (during attribution) instead of later somehow?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25153#issuecomment-2867942974
More information about the compiler-dev
mailing list