aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r--src/core/lombok/javac/handlers/HandleExtensionMethod.java6
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/core/lombok/javac/handlers/HandleExtensionMethod.java b/src/core/lombok/javac/handlers/HandleExtensionMethod.java
index dd565f72..98b000c2 100644
--- a/src/core/lombok/javac/handlers/HandleExtensionMethod.java
+++ b/src/core/lombok/javac/handlers/HandleExtensionMethod.java
@@ -73,10 +73,10 @@ public class HandleExtensionMethod extends JavacAnnotationHandler<ExtensionMetho
deleteAnnotationIfNeccessary(annotationNode, ExtensionMethod.class);
JavacNode typeNode = annotationNode.up();
- boolean isClassOrEnum = isClassOrEnum(typeNode);
+ boolean isClassOrEnumOrInterface = isClassOrEnumOrInterface(typeNode);
- if (!isClassOrEnum) {
- annotationNode.addError("@ExtensionMethod can only be used on a class or an enum");
+ if (!isClassOrEnumOrInterface) {
+ annotationNode.addError("@ExtensionMethod can only be used on a class or an enum or an interface");
return;
}
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index b17e34d8..9d153a72 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -2069,6 +2069,10 @@ public class JavacHandlerUtil {
return isClassAndDoesNotHaveFlags(typeNode, Flags.INTERFACE | Flags.ANNOTATION | RECORD);
}
+ public static boolean isClassOrEnumOrInterface(JavacNode typeNode) {
+ return isClassAndDoesNotHaveFlags(typeNode, Flags.ANNOTATION | RECORD);
+ }
+
/**
* Returns {@code true} if the provided node is an actual class, an enum or a record and not some other type declaration (so, not an annotation definition or interface).
*/