I'm trying to deal with annotation processors. I followed tutorials. Here is my code:
@ExampleAnnotation
private void someMethod(){
System.out.println("hi");
}
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.METHOD)
public @interface ExampleAnnotation {
}
@SupportedAnnotationTypes("org.example.ExampleAnnotation")
public class Processor extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> anots, RoundEnvironment roundEnvironment) {
anots.forEach(System.out::println);
return true;
}
}
I created META-INF/SERVICES/javax.annotation.processing.Processor
and registered my processor: org.example.Processor
. It seems like everything is OK, but block of code in the processor just dont start. I have no idea what is wrong. P.S.: I use Gradle and Java 11.