aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/LombokOptions.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-11-21 23:53:00 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-11-21 23:53:00 +0100
commite24ac22aaa286cb91a0dcdbff1f95d09fb62f8ef (patch)
tree5bc8791be6f63268a959d4313ec383830aba3aa1 /src/core/lombok/javac/LombokOptions.java
parent3fd3ca32a68c728bebd04d41720f2d1f636a3695 (diff)
downloadlombok-e24ac22aaa286cb91a0dcdbff1f95d09fb62f8ef.tar.gz
lombok-e24ac22aaa286cb91a0dcdbff1f95d09fb62f8ef.tar.bz2
lombok-e24ac22aaa286cb91a0dcdbff1f95d09fb62f8ef.zip
Made an API for creating a (oracle javac) JavaCompiler which tracks comments on a per Compilation Unit basis. The old way involved making reflective calls and detecting whether you need the 1.6 or the 1.7 variant to do this. These shenanigans are now hidden behind a nice API (lombok.javac.CommentCatcher).
Diffstat (limited to 'src/core/lombok/javac/LombokOptions.java')
-rw-r--r--src/core/lombok/javac/LombokOptions.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/lombok/javac/LombokOptions.java b/src/core/lombok/javac/LombokOptions.java
index c0c92df8..1a73a8cc 100644
--- a/src/core/lombok/javac/LombokOptions.java
+++ b/src/core/lombok/javac/LombokOptions.java
@@ -29,10 +29,9 @@ import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Options;
public class LombokOptions extends Options {
+ private boolean deleteLombokAnnotations = true;
+ private final Set<JCCompilationUnit> changed = new HashSet<JCCompilationUnit>();
- public boolean deleteLombokAnnotations = true;
- public final Set<JCCompilationUnit> changed = new HashSet<JCCompilationUnit>();
-
public static LombokOptions replaceWithDelombokOptions(Context context) {
Options options = Options.instance(context);
context.put(optionsKey, (Options)null);
@@ -41,6 +40,20 @@ public class LombokOptions extends Options {
return result;
}
+ public boolean isChanged(JCCompilationUnit ast) {
+ return changed.contains(ast);
+ }
+
+ public static void markChanged(Context context, JCCompilationUnit ast) {
+ Options options = context.get(Options.optionsKey);
+ if (options instanceof LombokOptions) ((LombokOptions) options).changed.add(ast);
+ }
+
+ public static boolean shouldDeleteLombokAnnotations(Context context) {
+ Options options = context.get(Options.optionsKey);
+ return (options instanceof LombokOptions) && ((LombokOptions) options).deleteLombokAnnotations;
+ }
+
private LombokOptions(Context context) {
super(context);
}