diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-08-20 23:44:31 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-08-21 00:02:12 +0200 |
commit | 35fe755b87f194621b5f328e4773f1f406f8ccc9 (patch) | |
tree | ed3ac873cbb0bb61bc26f56bbe57b556f9cc638d /src/core/lombok | |
parent | 52ffd6e1e7c7728f039d6a7121ddb7f48e07b08c (diff) | |
download | lombok-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')
4 files changed, 10 insertions, 13 deletions
diff --git a/src/core/lombok/core/configuration/StringConfigurationSource.java b/src/core/lombok/core/configuration/StringConfigurationSource.java index dd2f0319..abf6eea0 100644 --- a/src/core/lombok/core/configuration/StringConfigurationSource.java +++ b/src/core/lombok/core/configuration/StringConfigurationSource.java @@ -67,7 +67,6 @@ public class StringConfigurationSource implements ConfigurationSource { list.add(new ListModification(value, add)); } }); - return new StringConfigurationSource(values); } 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())); } } diff --git a/src/core/lombok/javac/apt/LombokProcessor.java b/src/core/lombok/javac/apt/LombokProcessor.java index 04b494bf..89608546 100644 --- a/src/core/lombok/javac/apt/LombokProcessor.java +++ b/src/core/lombok/javac/apt/LombokProcessor.java @@ -166,13 +166,13 @@ public class LombokProcessor extends AbstractProcessor { if (!(originalFiler instanceof InterceptingJavaFileManager)) { final Messager messager = processingEnv.getMessager(); DiagnosticsReceiver receiver = new MessagerDiagnosticsReceiver(messager); - + JavaFileManager newFilerManager = new InterceptingJavaFileManager(originalFiler, receiver); ht.put(key, newFilerManager); Field filerFileManagerField = JavacFiler.class.getDeclaredField("fileManager"); filerFileManagerField.setAccessible(true); filerFileManagerField.set(javacFiler, newFilerManager); - + replaceFileManagerJdk9(context, newFilerManager); } } catch (Exception e) { @@ -429,7 +429,7 @@ public class LombokProcessor extends AbstractProcessor { } /** - * This class returns the given filer as a JavacFiler. In case the case that the filer is no + * This class returns the given filer as a JavacFiler. In case the filer is no * JavacFiler (e.g. the Gradle IncrementalFiler), its "delegate" field is used to get the JavacFiler * (directly or through a delegate field again) */ |