diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-05-30 22:04:46 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-05-30 22:08:12 +0200 |
commit | aa8a627349bb68f376b98847b6f73c2c89e989fd (patch) | |
tree | 70df1fa6ba0f8e3c34a45d868d7f763e5b7ccbf9 /src/core/lombok/eclipse/TransformEclipseAST.java | |
parent | daf84dd00ed5059710acf9f40b4663ba7fed06e0 (diff) | |
download | lombok-aa8a627349bb68f376b98847b6f73c2c89e989fd.tar.gz lombok-aa8a627349bb68f376b98847b6f73c2c89e989fd.tar.bz2 lombok-aa8a627349bb68f376b98847b6f73c2c89e989fd.zip |
tracking if an annotation has been handled or not is now no longer done
via the LombokAST object. Instead its tracked more directly in an attempt
to avoid having to write all handlers as idempotent, and just in case
issue #164 is a race condition (the handled-or-not is a synchronized CAS check).
This does break API for other plugins, but the fix is trivial: Just make your
'handle' method return void. That 'we won't call you again' business in the decks
never quite worked right anyway.
Also, you might want to call Javac.(recursive)setHandledBy when you generate nodes, now.
Diffstat (limited to 'src/core/lombok/eclipse/TransformEclipseAST.java')
-rw-r--r-- | src/core/lombok/eclipse/TransformEclipseAST.java | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/core/lombok/eclipse/TransformEclipseAST.java b/src/core/lombok/eclipse/TransformEclipseAST.java index aada3ca4..314c8a7d 100644 --- a/src/core/lombok/eclipse/TransformEclipseAST.java +++ b/src/core/lombok/eclipse/TransformEclipseAST.java @@ -1,5 +1,5 @@ /* - * Copyright © 2009 Reinier Zwitserloot and Roel Spilker. + * Copyright © 2009-2011 Reinier Zwitserloot and Roel Spilker. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -168,38 +168,28 @@ public class TransformEclipseAST { private static class AnnotationVisitor extends EclipseASTAdapter { @Override public void visitAnnotationOnField(FieldDeclaration field, EclipseNode annotationNode, Annotation annotation) { - if (annotationNode.isHandled()) return; CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - boolean handled = handlers.handle(top, annotationNode, annotation); - if (handled) annotationNode.setHandled(); + handlers.handleAnnotation(top, annotationNode, annotation); } @Override public void visitAnnotationOnMethodArgument(Argument arg, AbstractMethodDeclaration method, EclipseNode annotationNode, Annotation annotation) { - if (annotationNode.isHandled()) return; CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - boolean handled = handlers.handle(top, annotationNode, annotation); - if (handled) annotationNode.setHandled(); + handlers.handleAnnotation(top, annotationNode, annotation); } @Override public void visitAnnotationOnLocal(LocalDeclaration local, EclipseNode annotationNode, Annotation annotation) { - if (annotationNode.isHandled()) return; CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - boolean handled = handlers.handle(top, annotationNode, annotation); - if (handled) annotationNode.setHandled(); + handlers.handleAnnotation(top, annotationNode, annotation); } @Override public void visitAnnotationOnMethod(AbstractMethodDeclaration method, EclipseNode annotationNode, Annotation annotation) { - if (annotationNode.isHandled()) return; CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - boolean handled = handlers.handle(top, annotationNode, annotation); - if (handled) annotationNode.setHandled(); + handlers.handleAnnotation(top, annotationNode, annotation); } @Override public void visitAnnotationOnType(TypeDeclaration type, EclipseNode annotationNode, Annotation annotation) { - if (annotationNode.isHandled()) return; CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - boolean handled = handlers.handle(top, annotationNode, annotation); - if (handled) annotationNode.setHandled(); + handlers.handleAnnotation(top, annotationNode, annotation); } } } |