If the JVM is started with -Dlombok.disable, lombok is disabled entirely for both eclipse/ecj and javac operations.

This commit is contained in:
Reinier Zwitserloot committed 2012-08-28 09:17:01 +02:00
1 parent 672ddda8f5
commit 70256754c2
3 files changed
+33 -17

No files matched your search

+3
View File
@@ -1,6 +1,9 @@
Lombok Changelog
----------------
### v0.11.5 (Edgy Guinea Pig)
* FEATURE: Lombok can be disabled entirely for any given compile run by using JVM switch `-Dlombok.disable`. This might be useful for code style checkers and such.
### v0.11.4 (August 13th, 2012)
* FEATURE: {Experimental} `@Value`, `@Wither` and `@FieldDefaults` are now available. These are a lot like `@Data` but geared towards immutable classes. [Documentation on @Value](http://projectlombok.org/features/experimental/Value.html), [Documentation on @Wither](http://projectlombok.org/features/experimental/Wither.html) and [Documentation on @FieldDefaults](http://projectlombok.org/features/experimental/FieldDefaults.html).
* BUGFIX: Eclipse would throw an OOME if using `@ExtensionMethod`. [Issue #390](http://code.google.com/p/projectlombok/issues/detail?id=390)
@@ -62,25 +62,31 @@ public class TransformEclipseAST {
Field f = null;
HandlerLibrary h = null;
try {
h = HandlerLibrary.load();
} catch (Throwable t) {
try {
error(null, "Problem initializing lombok", t);
} catch (Throwable t2) {
System.err.println("Problem initializing lombok");
t.printStackTrace();
}
if (System.getProperty("lombok.disable") != null) {
disableLombok = true;
astCacheField = null;
handlers = null;
} else {
try {
h = HandlerLibrary.load();
} catch (Throwable t) {
try {
error(null, "Problem initializing lombok", t);
} catch (Throwable t2) {
System.err.println("Problem initializing lombok");
t.printStackTrace();
}
disableLombok = true;
}
try {
f = CompilationUnitDeclaration.class.getDeclaredField("$lombokAST");
} catch (Throwable t) {
//I guess we're in an ecj environment; we'll just not cache stuff then.
}
astCacheField = f;
handlers = h;
}
try {
f = CompilationUnitDeclaration.class.getDeclaredField("$lombokAST");
} catch (Throwable t) {
//I guess we're in an ecj environment; we'll just not cache stuff then.
}
astCacheField = f;
handlers = h;
}
public static void transform_swapped(CompilationUnitDeclaration ast, Parser parser) {
+7
View File
@@ -75,10 +75,16 @@ public class Processor extends AbstractProcessor {
private JavacProcessingEnvironment processingEnv;
private JavacTransformer transformer;
private Trees trees;
private boolean lombokDisabled = false;
/** {@inheritDoc} */
@Override public void init(ProcessingEnvironment procEnv) {
super.init(procEnv);
if (System.getProperty("lombok.disable") != null) {
lombokDisabled = true;
return;
}
this.processingEnv = (JavacProcessingEnvironment) procEnv;
placePostCompileAndDontMakeForceRoundDummiesHook();
transformer = new JavacTransformer(procEnv.getMessager());
@@ -223,6 +229,7 @@ public class Processor extends AbstractProcessor {
/** {@inheritDoc} */
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (lombokDisabled) return false;
if (roundEnv.processingOver()) return false;
// We have: A sorted set of all priority levels: 'priorityLevels'