aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2009-12-30 02:29:37 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2009-12-30 02:29:37 +0100
commitbed2d10358689c2b250cadca120962499f50a2ab (patch)
treee9540c2501d7cd0c5db22a24dbb656de424f291d
parent7aa257307975485c155d1d7a6656da0b937b4d81 (diff)
downloadlombok-bed2d10358689c2b250cadca120962499f50a2ab.tar.gz
lombok-bed2d10358689c2b250cadca120962499f50a2ab.tar.bz2
lombok-bed2d10358689c2b250cadca120962499f50a2ab.zip
Sanity check on running patch scripts for eclipse - if its already been done we do not run them again.
-rw-r--r--src/core/lombok/eclipse/apt/Processor.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/apt/Processor.java b/src/core/lombok/eclipse/apt/Processor.java
index 82e39885..8dde079d 100644
--- a/src/core/lombok/eclipse/apt/Processor.java
+++ b/src/core/lombok/eclipse/apt/Processor.java
@@ -62,7 +62,18 @@ public class Processor extends AbstractProcessor {
this.processingEnv = (BaseProcessingEnvImpl)procEnv;
- new LiveInjector().injectSelf();
+ if (eclipseNeedsPatching()) {
+ new LiveInjector().injectSelf();
+ }
+ }
+
+ private boolean eclipseNeedsPatching() {
+ try {
+ return Class.forName("org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration").getDeclaredField("$lombokAST") == null;
+ } catch (Exception ignore) {
+ //I guess it isn't there, then.
+ return true;
+ }
}
/** {@inheritDoc} */