aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/eclipse/handlers/NonNullHandler.java5
-rw-r--r--src/core/lombok/javac/handlers/NonNullHandler.java5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/core/lombok/eclipse/handlers/NonNullHandler.java b/src/core/lombok/eclipse/handlers/NonNullHandler.java
index 5c58069c..59fda801 100644
--- a/src/core/lombok/eclipse/handlers/NonNullHandler.java
+++ b/src/core/lombok/eclipse/handlers/NonNullHandler.java
@@ -82,6 +82,11 @@ public class NonNullHandler extends EclipseAnnotationHandler<NonNull> {
if (isGenerated(declaration)) return;
+ if (declaration.isAbstract()) {
+ annotationNode.addWarning("@NonNull is meaningless on a parameter of an abstract method.");
+ return;
+ }
+
// Possibly, if 'declaration instanceof ConstructorDeclaration', fetch declaration.constructorCall, search it for any references to our parameter,
// and if they exist, create a new method in the class: 'private static <T> T lombok$nullCheck(T expr, String msg) {if (expr == null) throw NPE; return expr;}' and
// wrap all references to it in the super/this to a call to this method.
diff --git a/src/core/lombok/javac/handlers/NonNullHandler.java b/src/core/lombok/javac/handlers/NonNullHandler.java
index 415d6032..392e8390 100644
--- a/src/core/lombok/javac/handlers/NonNullHandler.java
+++ b/src/core/lombok/javac/handlers/NonNullHandler.java
@@ -76,6 +76,11 @@ public class NonNullHandler extends JavacAnnotationHandler<NonNull> {
if (JavacHandlerUtil.isGenerated(declaration)) return;
+ if (declaration.body == null) {
+ annotationNode.addWarning("@NonNull is meaningless on a parameter of an abstract method.");
+ return;
+ }
+
// Possibly, if 'declaration instanceof ConstructorDeclaration', fetch declaration.constructorCall, search it for any references to our parameter,
// and if they exist, create a new method in the class: 'private static <T> T lombok$nullCheck(T expr, String msg) {if (expr == null) throw NPE; return expr;}' and
// wrap all references to it in the super/this to a call to this method.