aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-09-24 01:18:32 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-09-24 01:18:32 +0200
commit86a635876dd75c4f3a61593491fa2ce53f8444b8 (patch)
tree86b3a14390f64fcc61375da89bd62764d73a867f /src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
parent7ee868659f4ff3cb286b676d649e8c57e9248d87 (diff)
parent72b55dccb18f38b8aefd0ac8e7c2e8bd2dd5c057 (diff)
downloadlombok-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.java31
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)) {