diff options
Diffstat (limited to 'src/core/lombok/javac/handlers/NonNullHandler.java')
-rw-r--r-- | src/core/lombok/javac/handlers/NonNullHandler.java | 5 |
1 files changed, 5 insertions, 0 deletions
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. |