From 4ba6bdc829341d1e1b545d37b613ba4ed3a7a5d8 Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Wed, 13 Nov 2019 21:16:07 +0200 Subject: [PATCH] Add more defense in ExtensionAnnotationProcessor (error message if something is wrong) --- .../java/org/pf4j/processor/ExtensionAnnotationProcessor.java | 2 ++ 1 file changed, 2 insertions(+) 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; } -- 2.39.5