From 56616f3bec6d8eda8c2bcf0550490f0098fb7fed Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sat, 17 Oct 2009 15:32:29 +0200 Subject: Fix: getters and setters for $foo fields (including our own $lock!) are now no longer generated. --- src/lombok/eclipse/handlers/HandleData.java | 2 ++ src/lombok/javac/handlers/HandleData.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lombok/eclipse/handlers/HandleData.java b/src/lombok/eclipse/handlers/HandleData.java index 555b311f..22538a53 100644 --- a/src/lombok/eclipse/handlers/HandleData.java +++ b/src/lombok/eclipse/handlers/HandleData.java @@ -87,6 +87,8 @@ public class HandleData implements EclipseAnnotationHandler { for (EclipseNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; FieldDeclaration fieldDecl = (FieldDeclaration) child.get(); + //Skip fields that start with $ + if (fieldDecl.name.length > 0 && fieldDecl.name[0] == '$') continue; //Skip static fields. if ((fieldDecl.modifiers & ClassFileConstants.AccStatic) != 0) continue; boolean isFinal = (fieldDecl.modifiers & ClassFileConstants.AccFinal) != 0; diff --git a/src/lombok/javac/handlers/HandleData.java b/src/lombok/javac/handlers/HandleData.java index 8aa744c7..8d80808f 100644 --- a/src/lombok/javac/handlers/HandleData.java +++ b/src/lombok/javac/handlers/HandleData.java @@ -70,15 +70,15 @@ public class HandleData implements JavacAnnotationHandler { return false; } - List nodesForEquality = List.nil(); List nodesForConstructor = List.nil(); for (JavacNode child : typeNode.down()) { if (child.getKind() != Kind.FIELD) continue; JCVariableDecl fieldDecl = (JCVariableDecl) child.get(); + //Skip fields that start with $ + if (fieldDecl.name.toString().startsWith("$")) continue; long fieldFlags = fieldDecl.mods.flags; //Skip static fields. if ((fieldFlags & Flags.STATIC) != 0) continue; - if ((fieldFlags & Flags.TRANSIENT) == 0) nodesForEquality = nodesForEquality.append(child); boolean isFinal = (fieldFlags & Flags.FINAL) != 0; boolean isNonNull = !findAnnotations(child, TransformationsUtil.NON_NULL_PATTERN).isEmpty(); if ((isFinal || isNonNull) && fieldDecl.init == null) nodesForConstructor = nodesForConstructor.append(child); -- cgit