[code-reflection] RFR: Issue errors when quotable constructs are found inside inner classes

Paul Sandoz psandoz at openjdk.org
Tue Jul 8 16:17:58 UTC 2025


On Tue, 8 Jul 2025 10:17:07 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> The main issue I see with this is that when you generate bytecode, now you have to

Although we don't have to exactly do what the bytecode generated by javac does?

Since we model `this` as an additional func operation parameter doing so for `Outer.this` and `Outer.Outer.this` etc would fit the same functional-like pattern, and is similar in many respects to what you suggest with `CapturedValues` but more literal. Then there are various translation strategies for generating bytecode - the most literal one being generating a method with all the parameters, and the user has to supply them, but some arguments could also be supplied at generation time and those become "constants". The down side is the `this` instances could be out of sync with each other.

Alternatively we could devise a reflective operation that operates on an inner class instance to access the nearest enclosing class instance, if present, and so on? (There is no abstraction in reflection or method handles, i wonder if this motivates something for that?)

-------------

PR Comment: https://git.openjdk.org/babylon/pull/486#issuecomment-3049548077


More information about the babylon-dev mailing list