RFR: 8356551: Javac rejects receiver parameter in constructor of local class in early construction context
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri May 9 21:44:50 UTC 2025
On Fri, 9 May 2025 21:37:46 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.
Looking at the code -- the "bad" call seems to be in `MemberEnter:checkReceiver` which calls `Attr::attribExpr` on the _name_ of the receiver parameter. Which then causes this sad outcome. Maybe a more "piecemeal" attribution would work better (e.g. attribute just the "type part" of the parameter name, leaving `this` aside).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25153#issuecomment-2867935752
More information about the compiler-dev
mailing list