diff options
author | Robbert Jan Grootjans <grootjans@gmail.com> | 2013-03-22 18:23:44 +0100 |
---|---|---|
committer | Robbert Jan Grootjans <grootjans@gmail.com> | 2013-03-22 18:23:44 +0100 |
commit | 0b100f22071236907142e4c0fb85ffa50102818d (patch) | |
tree | 65a34c1a246a85211bb2d361bd73d4dd16287e63 /src/core/lombok/javac/handlers/JavacHandlerUtil.java | |
parent | 4be46113e81292a88cd5fdb3a5ce18fbcffd570d (diff) | |
download | lombok-0b100f22071236907142e4c0fb85ffa50102818d.tar.gz lombok-0b100f22071236907142e4c0fb85ffa50102818d.tar.bz2 lombok-0b100f22071236907142e4c0fb85ffa50102818d.zip |
Refactored out references to TypeTags.
Instead they are retrieved
dynamically, with a pinch of caching during runtime. We already had some
fixes to make sure that compile time constanst were not inlined, but we
need to take into account that a lot of the Integer-based enums have
been replaced with actual enums.
Also, certain TreeMaker methods needed to be invoked dynamically with
reflection.
This needs to be reviewed, and if it turns out that these changes are too
dramatic, we should fork out a larger part of our code for specific JVM
versions.
Diffstat (limited to 'src/core/lombok/javac/handlers/JavacHandlerUtil.java')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index c2de5b05..178b82a2 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -42,6 +42,7 @@ import lombok.core.AnnotationValues.AnnotationValue; import lombok.core.TransformationsUtil; import lombok.core.TypeResolver; import lombok.experimental.Accessors; +import lombok.javac.Javac; import lombok.javac.JavacNode; import com.sun.tools.javac.code.BoundKind; @@ -882,14 +883,14 @@ public class JavacHandlerUtil { * Generates a new statement that checks if the given variable is null, and if so, throws a {@code NullPointerException} with the * variable name as message. */ - public static JCStatement generateNullCheck(TreeMaker treeMaker, JavacNode variable) { + public static JCStatement generateNullCheck(TreeMaker maker, JavacNode variable) { JCVariableDecl varDecl = (JCVariableDecl) variable.get(); if (isPrimitive(varDecl.vartype)) return null; Name fieldName = varDecl.name; JCExpression npe = chainDots(variable, "java", "lang", "NullPointerException"); - JCTree exception = treeMaker.NewClass(null, List.<JCExpression>nil(), npe, List.<JCExpression>of(treeMaker.Literal(fieldName.toString())), null); - JCStatement throwStatement = treeMaker.Throw(exception); - return treeMaker.If(treeMaker.Binary(CTC_EQUAL, treeMaker.Ident(fieldName), treeMaker.Literal(CTC_BOT, null)), throwStatement, null); + JCTree exception = maker.NewClass(null, List.<JCExpression>nil(), npe, List.<JCExpression>of(maker.Literal(fieldName.toString())), null); + JCStatement throwStatement = maker.Throw(exception); + return maker.If(Javac.makeBinary(maker, CTC_EQUAL, maker.Ident(fieldName), Javac.makeLiteral(maker, CTC_BOT, null)), throwStatement, null); } /** |