diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2009-12-30 02:29:37 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2009-12-30 02:29:37 +0100 |
commit | bed2d10358689c2b250cadca120962499f50a2ab (patch) | |
tree | e9540c2501d7cd0c5db22a24dbb656de424f291d | |
parent | 7aa257307975485c155d1d7a6656da0b937b4d81 (diff) | |
download | lombok-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.java | 13 |
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} */ |