diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-12-23 03:35:35 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-12-23 03:35:35 +0100 |
commit | b719e47e2d47be40141634bd9db1b47b0bf75192 (patch) | |
tree | 1c320026b93e7ff1fa7c4ef1ab9d9f6ebcecfacb /src | |
parent | f9264b78e47262cd285e9c219954a5c5120cb25e (diff) | |
download | lombok-b719e47e2d47be40141634bd9db1b47b0bf75192.tar.gz lombok-b719e47e2d47be40141634bd9db1b47b0bf75192.tar.bz2 lombok-b719e47e2d47be40141634bd9db1b47b0bf75192.zip |
prep for this class working better for ecj.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/eclipse/TransformEclipseAST.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/core/lombok/eclipse/TransformEclipseAST.java b/src/core/lombok/eclipse/TransformEclipseAST.java index 3b5482ca..dff11442 100644 --- a/src/core/lombok/eclipse/TransformEclipseAST.java +++ b/src/core/lombok/eclipse/TransformEclipseAST.java @@ -57,10 +57,10 @@ public class TransformEclipseAST { static { Field f = null; - HandlerLibrary l = null; + HandlerLibrary h = null; + try { - l = HandlerLibrary.load(); - f = CompilationUnitDeclaration.class.getDeclaredField("$lombokAST"); + h = HandlerLibrary.load(); } catch (Throwable t) { try { Eclipse.error(null, "Problem initializing lombok", t); @@ -70,8 +70,14 @@ public class TransformEclipseAST { } 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 = l; + handlers = h; } public static void transform_swapped(CompilationUnitDeclaration ast, Parser parser) { @@ -86,7 +92,7 @@ public class TransformEclipseAST { * Eclipse's parsers often operate in diet mode, which means many parts of the AST have been left blank. * Be ready to deal with just about anything being null, such as the Statement[] arrays of the Method AST nodes. * - * @param parser The Eclipse parser object that generated the AST. + * @param parser The Eclipse parser object that generated the AST. Not actually used; mostly there to satisfy parameter rules for lombok.patcher scripts. * @param ast The AST node belonging to the compilation unit (java speak for a single source file). */ public static void transform(Parser parser, CompilationUnitDeclaration ast) { |