aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorRobbert Jan Grootjans <grootjans@gmail.com>2012-06-18 19:47:07 +0200
committerRobbert Jan Grootjans <grootjans@gmail.com>2012-06-18 19:47:47 +0200
commit1cdcfc204ef353180692a4162c13a9be34552913 (patch)
treea2516590ae85d5217f54cbaff9578d38cec80c1e /src/core
parent7496a8f17047a1e1dd4a968632b1e4d2cbb5fda1 (diff)
downloadlombok-1cdcfc204ef353180692a4162c13a9be34552913.tar.gz
lombok-1cdcfc204ef353180692a4162c13a9be34552913.tar.bz2
lombok-1cdcfc204ef353180692a4162c13a9be34552913.zip
Fixed NPE Caused by an empty set of getter/setter names being returned in the EclipseUtils.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/core/TransformationsUtil.java10
1 files changed, 8 insertions, 2 deletions
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<String> toAllGetterNames(AnnotationValues<Accessors> 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.<String>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<String> toAllSetterNames(AnnotationValues<Accessors> 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.<String>emptyList() : Collections.singletonList(setterName);
+ }
Accessors acc = accessors.getInstance();
fieldName = removePrefix(fieldName, acc.prefix());