mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 16:17:34 +00:00
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).
This commit is contained in:
1 parent
52ffd6e1e7
commit
35fe755b87
5 files changed
+11
-14
No files matched your search
@@ -67,7 +67,6 @@ public class StringConfigurationSource implements ConfigurationSource {
|
||||
list.add(new ListModification(value, add));
|
||||
}
|
||||
});
|
||||
|
||||
return new StringConfigurationSource(values);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
*/
|
||||
|
||||
@@ -122,7 +122,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
|
||||
|
||||
CompilationUnitDeclaration cud = compilationUnit_.get();
|
||||
|
||||
if (cud == null) result.append("---- NO CompilationUnit provided by ecj ----");
|
||||
if (cud == null) result.append("---- No CompilationUnit provided by ecj ----");
|
||||
else result.append(cud.toString());
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user