diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-09-24 01:18:32 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-09-24 01:18:32 +0200 |
commit | 86a635876dd75c4f3a61593491fa2ce53f8444b8 (patch) | |
tree | 86b3a14390f64fcc61375da89bd62764d73a867f /src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | |
parent | 7ee868659f4ff3cb286b676d649e8c57e9248d87 (diff) | |
parent | 72b55dccb18f38b8aefd0ac8e7c2e8bd2dd5c057 (diff) | |
download | lombok-86a635876dd75c4f3a61593491fa2ce53f8444b8.tar.gz lombok-86a635876dd75c4f3a61593491fa2ce53f8444b8.tar.bz2 lombok-86a635876dd75c4f3a61593491fa2ce53f8444b8.zip |
Merge branch 'master' into jdk8check
Conflicts:
src/core/lombok/core/Version.java
src/core/lombok/javac/handlers/HandleConstructor.java
test/transform/resource/messages-delombok/EqualsAndHashCodeWithSomeExistingMethods.java.messages
test/transform/resource/messages-ecj/EqualsAndHashCodeWithSomeExistingMethods.java.messages
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 d74b8981..5e322c90 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)) { |