diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-08-14 07:05:31 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-08-14 07:05:43 +0200 |
commit | b93318da303b36957f3774015090121af778665f (patch) | |
tree | edf3678993970ff99f69d13a1f30ad3ae48e40c9 /src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | |
parent | 613d7e9e0cc14e9f789e81b52d72dbef24aff2e9 (diff) | |
download | lombok-b93318da303b36957f3774015090121af778665f.tar.gz lombok-b93318da303b36957f3774015090121af778665f.tar.bz2 lombok-b93318da303b36957f3774015090121af778665f.zip |
* Fixed 553: @XArgsConstructor (and @Builder on a class) did not look at @Accessors to handle field accessors.
* various operations on names in javac were really slow; they are faster now.
Diffstat (limited to 'src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java')
-rw-r--r-- | src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 9bd634f7..d666084e 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -1125,6 +1125,37 @@ public class EclipseHandlerUtil { return true; } + public static char[] removePrefixFromField(EclipseNode field) { + String[] prefixes = null; + for (EclipseNode node : field.down()) { + if (annotationTypeMatches(Accessors.class, node)) { + prefixes = createAnnotation(Accessors.class, node).getInstance().prefix(); + break; + } + } + + if (prefixes == null) { + EclipseNode current = field.up(); + outer: + while (current != null) { + for (EclipseNode node : current.down()) { + if (annotationTypeMatches(Accessors.class, node)) { + prefixes = createAnnotation(Accessors.class, node).getInstance().prefix(); + break outer; + } + } + current = current.up(); + } + } + + if (prefixes != null && prefixes.length > 0) { + CharSequence newName = TransformationsUtil.removePrefix(field.getName(), prefixes); + if (newName != null) return newName.toString().toCharArray(); + } + + return ((FieldDeclaration) field.get()).name; + } + public static AnnotationValues<Accessors> getAccessorsForField(EclipseNode field) { for (EclipseNode node : field.down()) { if (annotationTypeMatches(Accessors.class, node)) { |