[fixes #3427] Remove javac support for getter on enum members

This commit is contained in:
Rawi01 committed 2023-08-31 20:20:17 +02:00
1 parent 000ce6d19a
commit da004063e2
7 files changed
+22 -2

No files matched your search

@@ -168,7 +168,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
public void createGetterForField(AccessLevel level,
EclipseNode fieldNode, EclipseNode errorNode, ASTNode source, boolean whineIfExists, boolean lazy, List<Annotation> onMethod) {
if (fieldNode.getKind() != Kind.FIELD) {
if (fieldNode.getKind() != Kind.FIELD || fieldNode.isEnumMember()) {
errorNode.addError(GETTER_NODE_NOT_SUPPORTED_ERR);
return;
}
@@ -165,7 +165,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
public void createGetterForField(AccessLevel level,
JavacNode fieldNode, JavacNode source, boolean whineIfExists, boolean lazy, List<JCAnnotation> onMethod) {
if (fieldNode.getKind() != Kind.FIELD) {
if (fieldNode.getKind() != Kind.FIELD || fieldNode.isEnumMember()) {
source.addError(GETTER_NODE_NOT_SUPPORTED_ERR);
return;
}
@@ -0,0 +1,3 @@
enum GetterEnumConstant {
ONE;
}
@@ -0,0 +1,9 @@
import lombok.Getter;
enum GetterEnumConstant {
@Getter ONE(),
<clinit>() {
}
GetterEnumConstant() {
super();
}
}
@@ -0,0 +1,6 @@
import lombok.Getter;
enum GetterEnumConstant {
@Getter
ONE;
}
@@ -0,0 +1 @@
4 @Getter is only supported on a class, an enum, or a field.
@@ -0,0 +1 @@
4 @Getter is only supported on a class, an enum, or a field.