r/java • • Jun 05 '26

Introducing opt-in requirements for Java APIs

https://osmerion.github.io/OptIn/blog/welcome
49 Upvotes

27 comments sorted by

View all comments

Show parent comment

3

u/TheMrMilchmann Jun 05 '26

Does the plugin complain if I opt-in to stuff that doesn't need opt-in?

The javac integration reports a warning when an @OptIn is unused. The IDEA plugin does not have this inspection yet, but it may be added in the future.

To address your concerns, I think there is a slight misunderstanding here. If your persistence layer internally uses some experimental feature, you would usually have an OptIn(ExperimentalCaching.class) on the function or type in your persistence layer, which stops the requirement from propagating.

3

u/JustAGuyFromGermany Jun 05 '26

Thank you for the clarification.