aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-08-20 23:44:31 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-08-21 00:02:12 +0200
commit35fe755b87f194621b5f328e4773f1f406f8ccc9 (patch)
treeed3ac873cbb0bb61bc26f56bbe57b556f9cc638d /src/core/lombok/eclipse
parent52ffd6e1e7c7728f039d6a7121ddb7f48e07b08c (diff)
downloadlombok-35fe755b87f194621b5f328e4773f1f406f8ccc9.tar.gz
lombok-35fe755b87f194621b5f328e4773f1f406f8ccc9.tar.bz2
lombok-35fe755b87f194621b5f328e4773f1f406f8ccc9.zip
bugfix for the new ‘find the next priority’ system committed earlier; it should also find next priority for the astvisitors (only the annotation visitors were being considered).
Diffstat (limited to 'src/core/lombok/eclipse')
-rw-r--r--src/core/lombok/eclipse/HandlerLibrary.java8
-rw-r--r--src/core/lombok/eclipse/TransformEclipseAST.java8
2 files changed, 7 insertions, 9 deletions
diff --git a/src/core/lombok/eclipse/HandlerLibrary.java b/src/core/lombok/eclipse/HandlerLibrary.java
index 75a22f03..0e72fb38 100644
--- a/src/core/lombok/eclipse/HandlerLibrary.java
+++ b/src/core/lombok/eclipse/HandlerLibrary.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2014 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -32,7 +32,6 @@ 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;
@@ -247,8 +246,10 @@ public class HandlerLibrary {
/**
* Will call all registered {@link EclipseASTVisitor} instances.
*/
- public void callASTVisitors(EclipseAST ast, long priority, boolean isCompleteParse) {
+ public long callASTVisitors(EclipseAST ast, long priority, boolean isCompleteParse) {
+ long nearestPriority = Long.MAX_VALUE;
for (VisitorContainer container : visitorHandlers) {
+ if (priority < container.getPriority()) nearestPriority = Math.min(container.getPriority(), nearestPriority);
if (!isCompleteParse && container.deferUntilPostDiet()) continue;
if (priority != container.getPriority()) continue;
try {
@@ -258,5 +259,6 @@ public class HandlerLibrary {
String.format("Lombok visitor handler %s failed", container.visitor.getClass()), t);
}
}
+ return nearestPriority;
}
}
diff --git a/src/core/lombok/eclipse/TransformEclipseAST.java b/src/core/lombok/eclipse/TransformEclipseAST.java
index 24e24495..323fc171 100644
--- a/src/core/lombok/eclipse/TransformEclipseAST.java
+++ b/src/core/lombok/eclipse/TransformEclipseAST.java
@@ -24,8 +24,6 @@ package lombok.eclipse;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
import java.lang.reflect.Field;
-import java.util.HashSet;
-import java.util.Set;
import lombok.ConfigurationKeys;
import lombok.core.LombokConfiguration;
@@ -190,14 +188,12 @@ public class TransformEclipseAST {
public void go() {
long nextPriority = Long.MIN_VALUE;
for (Long d : handlers.getPriorities()) {
- if (nextPriority > d) {
- continue;
- }
+ if (nextPriority > d) continue;
AnnotationVisitor visitor = new AnnotationVisitor(d);
ast.traverse(visitor);
// if no visitor interested for this AST, nextPriority would be MAX_VALUE and we bail out immediatetly
nextPriority = visitor.getNextPriority();
- handlers.callASTVisitors(ast, d, ast.isCompleteParse());
+ nextPriority = Math.min(nextPriority, handlers.callASTVisitors(ast, d, ast.isCompleteParse()));
}
}