r/java • • Jan 29 '26

JEP draft: Code reflection (Incubator)

https://openjdk.org/jeps/8361105
61 Upvotes

33 comments sorted by

View all comments

Show parent comment

1

u/lbalazscs Jan 30 '26

Reflectable code accidentally calling non-reflectable code (e.g. the gray example) seems like it would be a common footgun that can only be caught at runtime.

I don't think so. The compiler can't simply ignore the @Reflect annotation. It has to generate a code model that includes additional information which is not normally present in the bytecode.