Draft incubator code reflection JEP

Paul Sandoz paul.sandoz at oracle.com
Thu Feb 5 21:25:43 UTC 2026



On Feb 5, 2026, at 12:37 PM, nadeesh t v <nadeeshtv at gmail.com> wrote:

Hi,

Thank you for the clarification.

Any performance implication whenever a @Reflect  annotated  method executes on the JVM?


No (or at least not yet :-) depending on how we encode the model and whether we only encode the model there might be an initialization hit on first invocation to generate the bytecode, that could be ameliorated at link time and/or with Leyden. Details to be worked out…)


If an instance method is  @Reflect  annotated, I hope  that it does not carry over to its overridden method in child class. Should that need to be explicitly documented in the JEP or is that implicit?`

> declaring a reflectable lambda expression does broaden the scope to the surrounding code of final, or effectively final, variables used
Could you please expand on how the scope broadens for the  final, or effectively final, variables in the lambda?

To be clear it *does not* broaden. e.g.,

final int i = a() + b();
@Reflect
Runnable r = () -> IO.println(i);

We don’t broaden the scope to reflect over the declaration of local variable i and its initializer expression.


Should not the same happen for instance fields that are used in @Reflect  annotated  method ?`

“this" is a final variable that is captured. The fields themselves are not captured.

Paul.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/babylon-dev/attachments/20260205/8114e683/attachment-0001.htm>


More information about the babylon-dev mailing list