diff options
author | Roel Spilker <r.spilker@gmail.com> | 2012-01-24 02:52:13 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2012-01-24 02:52:13 +0100 |
commit | 2242de2bf9886fc80858486bbb3aa171a5496885 (patch) | |
tree | 36f6795f3e00b1ab122fb2c1ac6d201a1660c89f /src/utils/lombok/eclipse | |
parent | 3e7bb145d3984d7472baa177ead3baf574d42e6b (diff) | |
download | lombok-2242de2bf9886fc80858486bbb3aa171a5496885.tar.gz lombok-2242de2bf9886fc80858486bbb3aa171a5496885.tar.bz2 lombok-2242de2bf9886fc80858486bbb3aa171a5496885.zip |
Fix for issue 328: @Delegate on a field for which we also generate a getter will use the getter for delegation
Diffstat (limited to 'src/utils/lombok/eclipse')
-rw-r--r-- | src/utils/lombok/eclipse/Eclipse.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java index fce0773b..7d21faa2 100644 --- a/src/utils/lombok/eclipse/Eclipse.java +++ b/src/utils/lombok/eclipse/Eclipse.java @@ -43,6 +43,7 @@ import org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; public class Eclipse { + private static final Annotation[] EMPTY_ANNOTATIONS_ARRAY = new Annotation[0]; /** * Eclipse's Parser class is instrumented to not attempt to fill in the body of any method or initializer * or field initialization if this flag is set. Set it on the flag field of @@ -120,7 +121,7 @@ public class Eclipse { */ public static Annotation[] findAnnotations(FieldDeclaration field, Pattern namePattern) { List<Annotation> result = new ArrayList<Annotation>(); - if (field.annotations == null) return new Annotation[0]; + if (field.annotations == null) return EMPTY_ANNOTATIONS_ARRAY; for (Annotation annotation : field.annotations) { TypeReference typeRef = annotation.type; if (typeRef != null && typeRef.getTypeName()!= null) { @@ -131,7 +132,7 @@ public class Eclipse { } } } - return result.toArray(new Annotation[0]); + return result.toArray(EMPTY_ANNOTATIONS_ARRAY); } /** |