diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java | 8 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleFieldNameConstants.java | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java b/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java index 91b7771b..9e81a068 100644 --- a/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java +++ b/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java @@ -132,8 +132,12 @@ public class HandleFieldNameConstants extends EclipseAnnotationHandler<FieldName genClinit = asEnum; } else { TypeDeclaration builderTypeDeclaration = (TypeDeclaration) fieldsType.get(); - if ((builderTypeDeclaration.modifiers & (ClassFileConstants.AccEnum | ClassFileConstants.AccStatic)) == 0) { - errorNode.addError("Existing " + innerTypeName + " must be declared as an 'enum' or a 'static class'."); + if (asEnum && (builderTypeDeclaration.modifiers & ClassFileConstants.AccEnum) == 0) { + errorNode.addError("Existing " + innerTypeName + " must be declared as an 'enum'."); + return; + } + if (!asEnum && (builderTypeDeclaration.modifiers & ClassFileConstants.AccStatic) == 0) { + errorNode.addError("Existing " + innerTypeName + " must be declared as a 'static class'."); return; } genConstr = constructorExists(fieldsType) == MemberExistsResult.NOT_EXISTS; diff --git a/src/core/lombok/javac/handlers/HandleFieldNameConstants.java b/src/core/lombok/javac/handlers/HandleFieldNameConstants.java index 163a82b3..4015df12 100644 --- a/src/core/lombok/javac/handlers/HandleFieldNameConstants.java +++ b/src/core/lombok/javac/handlers/HandleFieldNameConstants.java @@ -139,8 +139,12 @@ public class HandleFieldNameConstants extends JavacAnnotationHandler<FieldNameCo } else { JCClassDecl builderTypeDeclaration = (JCClassDecl) fieldsType.get(); long f = builderTypeDeclaration.getModifiers().flags; - if ((f & (Flags.STATIC | Flags.ENUM)) == 0) { - errorNode.addError("Existing " + innerTypeName + " must be declared as an 'enum' or a 'static class'."); + if (asEnum && (f & Flags.ENUM) == 0) { + errorNode.addError("Existing " + innerTypeName + " must be declared as an 'enum'."); + return; + } + if (!asEnum && (f & Flags.STATIC) == 0) { + errorNode.addError("Existing " + innerTypeName + " must be declared as a 'static class'."); return; } genConstr = constructorExists(fieldsType) == MemberExistsResult.NOT_EXISTS; |