[code-reflection] RFR: OpBuilder optimizations - part 1. [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Nov 14 19:06:42 UTC 2025
On Fri, 14 Nov 2025 18:46:21 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> Naively, i managed to get a JCSkip node, appended to JCClassDecl.defs for the class where there are reflectable methods/lambdas, flowing though to gen, which can then be removed in a pre-processing step before normalization.
There's also other things to take into account: `Lower`, which is a step that can also generate extra classes, has an entry point that can return `List<JCTree>` -- but the steps before it (including `ReflectMethods`) are typically one tree in, one tree out.
So, `ReflectMethods` can, in principle, just append a synthetic node to `defs` of the translated class. But at some point Lower will need to turn that into a proper class def, so that it can be returned to JavaCompiler, and codegen can happen.
So, I think that the easiest way is for `ReflectMethods` to create the inner class AST node, save the op there somehow. Then teach Lower to mostly ignore these nested classes (but still return them to `JavaCompiler`). Then code generation can take it from there...
-------------
PR Comment: https://git.openjdk.org/babylon/pull/679#issuecomment-3534166746
More information about the babylon-dev
mailing list