diff options
author | Roland Praml <praml@foconis.de> | 2018-07-09 20:29:21 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2018-08-20 20:46:31 +0200 |
commit | 100cff228d0f4d68219460aefe89b70877b726dc (patch) | |
tree | d0df4b9d8c7525e19be7d4aba056a37c247fa9a5 /src/core/lombok/eclipse/HandlerLibrary.java | |
parent | 2b0cd53d55d882fbc49d5f736c845353098eb34e (diff) | |
download | lombok-100cff228d0f4d68219460aefe89b70877b726dc.tar.gz lombok-100cff228d0f4d68219460aefe89b70877b726dc.tar.bz2 lombok-100cff228d0f4d68219460aefe89b70877b726dc.zip |
reduced calls of traverse invocations
Diffstat (limited to 'src/core/lombok/eclipse/HandlerLibrary.java')
-rw-r--r-- | src/core/lombok/eclipse/HandlerLibrary.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/core/lombok/eclipse/HandlerLibrary.java b/src/core/lombok/eclipse/HandlerLibrary.java index 07c6f97b..75a22f03 100644 --- a/src/core/lombok/eclipse/HandlerLibrary.java +++ b/src/core/lombok/eclipse/HandlerLibrary.java @@ -32,6 +32,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -212,21 +213,25 @@ public class HandlerLibrary { * @param ast The Compilation Unit that contains the Annotation AST Node. * @param annotationNode The Lombok AST Node representing the Annotation AST Node. * @param annotation 'node.get()' - convenience parameter. + * @param priority current prioritiy + * @return the priority we want to run - MAX_VALUE means never */ - public void handleAnnotation(CompilationUnitDeclaration ast, EclipseNode annotationNode, org.eclipse.jdt.internal.compiler.ast.Annotation annotation, long priority) { + public long handleAnnotation(CompilationUnitDeclaration ast, EclipseNode annotationNode, org.eclipse.jdt.internal.compiler.ast.Annotation annotation, long priority) { TypeResolver resolver = new TypeResolver(annotationNode.getImportList()); TypeReference rawType = annotation.type; - if (rawType == null) return; + if (rawType == null) return Long.MAX_VALUE; String fqn = resolver.typeRefToFullyQualifiedName(annotationNode, typeLibrary, toQualifiedName(annotation.type.getTypeName())); - if (fqn == null) return; + if (fqn == null) return Long.MAX_VALUE; AnnotationHandlerContainer<?> container = annotationHandlers.get(fqn); - if (container == null) return; - if (priority != container.getPriority()) return; + if (container == null) return Long.MAX_VALUE; + + if (priority < container.getPriority()) return container.getPriority(); // we want to run at this priority + if (priority > container.getPriority()) return Long.MAX_VALUE; // it's over- we do not want to run again if (!annotationNode.isCompleteParse() && container.deferUntilPostDiet()) { if (needsHandling(annotation)) container.preHandle(annotation, annotationNode); - return; + return Long.MAX_VALUE; } try { @@ -236,6 +241,7 @@ public class HandlerLibrary { } catch (Throwable t) { error(ast, String.format("Lombok annotation handler %s failed", container.handler.getClass()), t); } + return Long.MAX_VALUE; } /** |