diff --git a/src/core/lombok/core/TransformationsUtil.java b/src/core/lombok/core/TransformationsUtil.java index 7426ae18..69b6b734 100644 --- a/src/core/lombok/core/TransformationsUtil.java +++ b/src/core/lombok/core/TransformationsUtil.java @@ -168,7 +168,10 @@ public class TransformationsUtil { * @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. */ public static List toAllGetterNames(AnnotationValues accessors, CharSequence fieldName, boolean isBoolean) { - if (!isBoolean) return Collections.singletonList(toGetterName(accessors, fieldName, false)); + if (!isBoolean) { + String getterName = toGetterName(accessors, fieldName, false); + return (getterName == null) ? Collections.emptyList() : Collections.singletonList(getterName); + } Accessors acc = accessors.getInstance(); fieldName = removePrefix(fieldName, acc.prefix()); @@ -199,7 +202,10 @@ public class TransformationsUtil { * @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. */ public static List toAllSetterNames(AnnotationValues accessors, CharSequence fieldName, boolean isBoolean) { - if (!isBoolean) return Collections.singletonList(toSetterName(accessors, fieldName, false)); + if (!isBoolean) { + String setterName = toSetterName(accessors, fieldName, false); + return (setterName == null) ? Collections.emptyList() : Collections.singletonList(setterName); + } Accessors acc = accessors.getInstance(); fieldName = removePrefix(fieldName, acc.prefix());