diff options
-rw-r--r-- | src/core/lombok/javac/LombokOptions.java | 15 | ||||
-rw-r--r-- | src/delombok/lombok/delombok/Delombok.java | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/core/lombok/javac/LombokOptions.java b/src/core/lombok/javac/LombokOptions.java index 60d0ce5e..034cbafd 100644 --- a/src/core/lombok/javac/LombokOptions.java +++ b/src/core/lombok/javac/LombokOptions.java @@ -25,13 +25,14 @@ import java.util.HashSet; import java.util.Set; import lombok.delombok.FormatPreferences; +import lombok.delombok.LombokOptionsFactory; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Options; public abstract class LombokOptions extends Options { - private boolean deleteLombokAnnotations = true; + private boolean deleteLombokAnnotations = false; private final Set<JCCompilationUnit> changed = new HashSet<JCCompilationUnit>(); private FormatPreferences formatPreferences = new FormatPreferences(null); @@ -48,13 +49,13 @@ public abstract class LombokOptions extends Options { } public static void markChanged(Context context, JCCompilationUnit ast) { - Options options = context.get(Options.optionsKey); - if (options instanceof LombokOptions) ((LombokOptions) options).changed.add(ast); + LombokOptions options = LombokOptionsFactory.getDelombokOptions(context); + options.changed.add(ast); } public static boolean shouldDeleteLombokAnnotations(Context context) { - Options options = context.get(Options.optionsKey); - return (options instanceof LombokOptions) && ((LombokOptions) options).deleteLombokAnnotations; + LombokOptions options = LombokOptionsFactory.getDelombokOptions(context); + return options.deleteLombokAnnotations; } protected LombokOptions(Context context) { @@ -62,4 +63,8 @@ public abstract class LombokOptions extends Options { } public abstract void putJavacOption(String optionName, String value); + + public void deleteLombokAnnotations() { + this.deleteLombokAnnotations = true; + } } diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java index 9cb78a82..f64e36a1 100644 --- a/src/delombok/lombok/delombok/Delombok.java +++ b/src/delombok/lombok/delombok/Delombok.java @@ -467,6 +467,7 @@ public class Delombok { public boolean delombok() throws IOException { LombokOptions options = LombokOptionsFactory.getDelombokOptions(context); + options.deleteLombokAnnotations(); options.putJavacOption("ENCODING", charset.name()); if (classpath != null) options.putJavacOption("CLASSPATH", classpath); if (sourcepath != null) options.putJavacOption("SOURCEPATH", sourcepath); |