aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2014-06-05 23:45:43 +0200
committerRoel Spilker <r.spilker@gmail.com>2014-06-05 23:45:43 +0200
commit1ce747178b8f24f29f94dd795f09f872aad9272f (patch)
tree76e66d528c56f22ac5782846df4758d75a8b55bd /src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
parentf30485c91fd3f9553fbcbc02d922e6221182c26e (diff)
downloadlombok-1ce747178b8f24f29f94dd795f09f872aad9272f.tar.gz
lombok-1ce747178b8f24f29f94dd795f09f872aad9272f.tar.bz2
lombok-1ce747178b8f24f29f94dd795f09f872aad9272f.zip
Finished refactor of FieldAugment; there's no longer a separate variant for boolean and references, and the code no longer blows up with a bunch of NPEs if you try to use the reference variant (which is now the only variant) with a primitive type.
Should have zero effect on features or bugs, 100% refactor.
Diffstat (limited to 'src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java')
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index b37dbd81..6a903e4c 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -21,8 +21,9 @@
*/
package lombok.eclipse.handlers;
-import static lombok.eclipse.Eclipse.*;
import static lombok.core.handlers.HandlerUtil.*;
+import static lombok.eclipse.Eclipse.*;
+import static lombok.eclipse.EclipseAugments.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -43,8 +44,6 @@ import lombok.Lombok;
import lombok.core.AST.Kind;
import lombok.core.AnnotationValues;
import lombok.core.AnnotationValues.AnnotationValue;
-import lombok.core.BooleanFieldAugment;
-import lombok.core.ReferenceFieldAugment;
import lombok.core.TypeResolver;
import lombok.core.configuration.NullCheckExceptionType;
import lombok.core.handlers.HandlerUtil;
@@ -109,7 +108,6 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
import org.osgi.framework.Bundle;
-
/**
* Container for static utility methods useful to handlers written for eclipse.
*/
@@ -211,10 +209,8 @@ public class EclipseHandlerUtil {
}
}
- private static ReferenceFieldAugment<ASTNode, ASTNode> generatedNodes = ReferenceFieldAugment.augment(ASTNode.class, ASTNode.class, "$generatedBy");
-
public static ASTNode getGeneratedBy(ASTNode node) {
- return generatedNodes.get(node);
+ return ASTNode_generatedBy.get(node);
}
public static boolean isGenerated(ASTNode node) {
@@ -222,7 +218,7 @@ public class EclipseHandlerUtil {
}
public static ASTNode setGeneratedBy(ASTNode node, ASTNode source) {
- generatedNodes.set(node, source);
+ ASTNode_generatedBy.set(node, source);
return node;
}
@@ -844,11 +840,9 @@ public class EclipseHandlerUtil {
}
}
- private static final BooleanFieldAugment<FieldDeclaration> generatedLazyGettersWithPrimitiveBoolean = BooleanFieldAugment.augment(FieldDeclaration.class, "lombok$booleanLazyGetter");
-
static void registerCreatedLazyGetter(FieldDeclaration field, char[] methodName, TypeReference returnType) {
if (isBoolean(returnType)) {
- generatedLazyGettersWithPrimitiveBoolean.set(field);
+ FieldDeclaration_booleanLazyGetter.set(field, true);
}
}
@@ -858,7 +852,7 @@ public class EclipseHandlerUtil {
private static GetterMethod findGetter(EclipseNode field) {
FieldDeclaration fieldDeclaration = (FieldDeclaration) field.get();
- boolean forceBool = generatedLazyGettersWithPrimitiveBoolean.get(fieldDeclaration);
+ boolean forceBool = FieldDeclaration_booleanLazyGetter.get(fieldDeclaration);
TypeReference fieldType = fieldDeclaration.type;
boolean isBoolean = forceBool || isBoolean(fieldType);