r/java • • Jun 05 '26

Introducing opt-in requirements for Java APIs

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

27 comments sorted by

View all comments

Show parent comment

3

u/TheMrMilchmann Jun 05 '26

I'm not particularly happy with the CLI arg syntax myself, but I had to resort to URL encoding as a workaround for limitations. If you are using Gradle, there is a DSL for a global opt-in:

sourceSets.configureEach {
    optIn {
        optIn("com.example.MarkerFqName")
    }  
}

I plan to provide a similar convenience with a Maven plugin in the future.

1

u/Additional-Road3924 Jun 06 '26

There's no need for you to create your own "conveniences". Maven and gradle already provide a way to setup compiler arguments.