summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2019-11-13 21:16:07 +0200
committerDecebal Suiu <decebal.suiu@gmail.com>2019-11-13 21:16:07 +0200
commit4ba6bdc829341d1e1b545d37b613ba4ed3a7a5d8 (patch)
treeda46ca34d52c1721a1306f3daa3c31b9d241b4d8
parent41f5ade5087bfa9b6cf8466ab2f4f7d337343501 (diff)
downloadpf4j-4ba6bdc829341d1e1b545d37b613ba4ed3a7a5d8.tar.gz
pf4j-4ba6bdc829341d1e1b545d37b613ba4ed3a7a5d8.zip
Add more defense in ExtensionAnnotationProcessor (error message if something is wrong)
-rw-r--r--pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java b/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
index e8629bc..1ac0955 100644
--- a/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
+++ b/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
@@ -95,11 +95,13 @@ public class ExtensionAnnotationProcessor extends AbstractProcessor {
for (Element element : roundEnv.getElementsAnnotatedWith(Extension.class)) {
// check if @Extension is put on class and not on method or constructor
if (!(element instanceof TypeElement)) {
+ error(element, "Put annotation only on classes (no methods, no fields)");
continue;
}
// check if class extends/implements an extension point
if (!isExtension(element.asType())) {
+ error(element, "%s is not an extension (it doesn't implement ExtensionPoint)", element);
continue;
}