aboutsummaryrefslogtreecommitdiff
path: root/src/delombok
diff options
context:
space:
mode:
Diffstat (limited to 'src/delombok')
-rw-r--r--src/delombok/lombok/delombok/Delombok.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java
index 7291ac29..473afb5c 100644
--- a/src/delombok/lombok/delombok/Delombok.java
+++ b/src/delombok/lombok/delombok/Delombok.java
@@ -30,6 +30,7 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.Writer;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
@@ -49,6 +50,7 @@ import javax.tools.JavaFileObject;
import lombok.Lombok;
import lombok.javac.CommentCatcher;
import lombok.javac.LombokOptions;
+import lombok.javac.apt.Processor;
import com.sun.tools.javac.comp.Todo;
import com.sun.tools.javac.main.JavaCompiler;
@@ -363,7 +365,7 @@ public class Delombok {
if (classpath != null) options.putJavacOption("CLASSPATH", classpath);
if (sourcepath != null) options.putJavacOption("SOURCEPATH", sourcepath);
if (bootclasspath != null) options.putJavacOption("BOOTCLASSPATH", bootclasspath);
- options.put("compilePolicy", "attr");
+ options.put("compilePolicy", "check");
CommentCatcher catcher = CommentCatcher.create(context);
JavaCompiler compiler = catcher.getCompiler();
@@ -374,10 +376,7 @@ public class Delombok {
compiler.initProcessAnnotations(Collections.singleton(new lombok.javac.apt.Processor()));
for (File fileToParse : filesToParse) {
-
- @SuppressWarnings("deprecation")
- JCCompilationUnit unit = compiler.parse(fileToParse.getAbsolutePath());
-
+ @SuppressWarnings("deprecation") JCCompilationUnit unit = compiler.parse(fileToParse.getAbsolutePath());
baseMap.put(unit, fileToBase.get(fileToParse));
roots.add(unit);
}
@@ -386,8 +385,13 @@ public class Delombok {
return false;
}
- JavaCompiler delegate = compiler.processAnnotations(compiler.enterTrees(toJavacList(roots)));
- callFlowMethodOnJavaCompiler(delegate, callAttributeMethodOnJavaCompiler(delegate, delegate.todo));
+ com.sun.tools.javac.util.List<JCCompilationUnit> trees = compiler.enterTrees(toJavacList(roots));
+
+ JavaCompiler delegate = compiler.processAnnotations(trees);
+
+ Object care = callAttributeMethodOnJavaCompiler(delegate, delegate.todo);
+
+ callFlowMethodOnJavaCompiler(delegate, care);
for (JCCompilationUnit unit : roots) {
DelombokResult result = new DelombokResult(catcher.getComments(unit), unit, force || options.isChanged(unit));
if (verbose) feedback.printf("File: %s [%s]\n", unit.sourcefile.getName(), result.isChanged() ? "delomboked" : "unchanged");