We have to add the plugin artifact in thebuildscript dependencies section of the Gradle file. We can also enable the all-open plugin using the plugins section, as follows:
plugins { id "org.jetbrains.kotlin.plugin.allopen" version "1.2.41" }
Following this, we can specify a list of annotations that will make our classes open and accessible:
allOpen { annotation("javax.ejb.Stateless") }
We can specify multiple annotations using the annotations section in the allOpen plugin:
@org.rao.kolin.javaee.Annotation annotation class MyAnnotation
@MyAnnotation class Person{ }
Now, the Person class will be open.
The MyAnnotation class is annotated with a meta-annotation—@org.rao.kolin.javaee.Annotation. It is now an all-open plugin annotation that can be used in other classes to make them open and accessible.