diff options
author | Roel Spilker <r.spilker@gmail.com> | 2014-06-05 23:45:43 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2014-06-05 23:45:43 +0200 |
commit | 1ce747178b8f24f29f94dd795f09f872aad9272f (patch) | |
tree | 76e66d528c56f22ac5782846df4758d75a8b55bd /src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java | |
parent | f30485c91fd3f9553fbcbc02d922e6221182c26e (diff) | |
download | lombok-1ce747178b8f24f29f94dd795f09f872aad9272f.tar.gz lombok-1ce747178b8f24f29f94dd795f09f872aad9272f.tar.bz2 lombok-1ce747178b8f24f29f94dd795f09f872aad9272f.zip |
Finished refactor of FieldAugment; there's no longer a separate variant for boolean and references, and the code no longer blows up with a bunch of NPEs if you try to use the reference variant (which is now the only variant) with a primitive type.
Should have zero effect on features or bugs, 100% refactor.
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java')
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java index b6e75476..b1f5a43a 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java @@ -23,6 +23,7 @@ package lombok.eclipse.agent; import static lombok.eclipse.Eclipse.*; import static lombok.eclipse.handlers.EclipseHandlerUtil.*; +import static lombok.eclipse.EclipseAugments.Annotation_applied; import java.lang.reflect.Method; import java.util.ArrayList; @@ -33,7 +34,6 @@ import java.util.List; import java.util.Set; import lombok.core.AST.Kind; -import lombok.core.BooleanFieldAugment; import lombok.eclipse.EclipseAST; import lombok.eclipse.EclipseNode; import lombok.eclipse.TransformEclipseAST; @@ -183,10 +183,8 @@ public class PatchDelegate { return null; } - private static BooleanFieldAugment<Annotation> applied = BooleanFieldAugment.augment(Annotation.class, "lombok$applied"); - public static void markHandled(Annotation annotation) { - applied.set(annotation); + Annotation_applied.set(annotation, true); } private static void fillMethodBindingsForFields(CompilationUnitDeclaration cud, ClassScope scope, List<BindingTuple> methodsToDelegate) { @@ -197,7 +195,7 @@ public class PatchDelegate { if (field.annotations == null) continue; for (Annotation ann : field.annotations) { if (!isDelegate(ann, decl)) continue; - if (applied.set(ann)) continue; + if (Annotation_applied.getAndSet(ann, true)) continue; if ((field.modifiers & ClassFileConstants.AccStatic) != 0) { EclipseAST eclipseAst = TransformEclipseAST.getAST(cud, true); @@ -257,7 +255,7 @@ public class PatchDelegate { if (methodDecl.annotations == null) continue; for (Annotation ann : methodDecl.annotations) { if (!isDelegate(ann, decl)) continue; - if (applied.set(ann)) continue; + if (Annotation_applied.getAndSet(ann, true)) continue; if (!(methodDecl instanceof MethodDeclaration)) { EclipseAST eclipseAst = TransformEclipseAST.getAST(cud, true); eclipseAst.get(ann).addError(LEGALITY_OF_DELEGATE); |