diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-11-01 16:43:25 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-11-01 16:43:25 +0100 |
commit | 4acda73319e95c4caf472ca47183af57a1bc9fd1 (patch) | |
tree | 89e33400026a091055262a8ce8a90a56e32b1d69 /src/core/lombok/eclipse | |
parent | 2fd46a50b6125fd9f0e8177ffad5db8ee934fe34 (diff) | |
download | lombok-4acda73319e95c4caf472ca47183af57a1bc9fd1.tar.gz lombok-4acda73319e95c4caf472ca47183af57a1bc9fd1.tar.bz2 lombok-4acda73319e95c4caf472ca47183af57a1bc9fd1.zip |
[trivial] error out on mismatch between FieldNameConstants asEnum flag and actual handwritten type.
Diffstat (limited to 'src/core/lombok/eclipse')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java | 8 |
1 files changed, 6 insertions, 2 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; |