in src/main/java/org/apache/sling/models/annotations/apt/ValidatingAnnotationProcessor.java [45:74]
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (TypeElement annotation : annotations) {
for (Element annotatedElement : roundEnv.getElementsAnnotatedWith(annotation)) {
if (!isSlingModel(annotatedElement)) {
// skip any class that is not a Sling Model
continue;
}
if (isStaticOrFinalField(annotatedElement)) {
processingEnv
.getMessager()
.printMessage(
Kind.ERROR,
"Annotation " + annotation + " may not be used on static or final fields: "
+ getSymbolName(annotatedElement),
annotatedElement);
} else if (isStaticMethod(annotatedElement)) {
processingEnv
.getMessager()
.printMessage(
Kind.ERROR,
"Annotation " + annotation + " may not be used on static methods: "
+ getSymbolName(annotatedElement),
annotatedElement);
}
}
}
return true;
}