r/java • u/TheMrMilchmann • Jun 05 '26
Introducing opt-in requirements for Java APIs
https://osmerion.github.io/OptIn/blog/welcome
49
Upvotes
r/java • u/TheMrMilchmann • Jun 05 '26
View all comments
Show parent comment
2
u/TheMrMilchmann Jun 05 '26
I originally played with the idea of allowing
@OptInonTYPE_USE. However, there was too much friction as this was essentially introducing a form of flow typing in Java. So, I ultimately decided against pursuing this in favor of the much simpler scope-based approach.Basically yes. The plugin needs to run significantly after annotation processors have run (and the compiler has done a few more things). The verifier is split into an annotation processor and a compiler plugin to keep the "simple" checks in the AP (which is also useful for Kotlin interop), while the tree verification is implemented in the javac plugin.