aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/EclipseNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok/eclipse/EclipseNode.java')
-rw-r--r--src/core/lombok/eclipse/EclipseNode.java42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/core/lombok/eclipse/EclipseNode.java b/src/core/lombok/eclipse/EclipseNode.java
index 9db491f5..12e9ccdb 100644
--- a/src/core/lombok/eclipse/EclipseNode.java
+++ b/src/core/lombok/eclipse/EclipseNode.java
@@ -23,10 +23,6 @@ package lombok.eclipse;
import java.util.List;
-import lombok.core.AnnotationValues;
-import lombok.core.AST.Kind;
-import lombok.eclipse.handlers.EclipseHandlerUtil;
-
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
@@ -36,11 +32,16 @@ import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Initializer;
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import lombok.core.AST.Kind;
+import lombok.core.AnnotationValues;
+import lombok.eclipse.handlers.EclipseHandlerUtil;
+
/**
* Eclipse specific version of the LombokNode class.
*/
@@ -264,6 +265,39 @@ public class EclipseNode extends lombok.core.LombokNode<EclipseAST, EclipseNode,
return (ClassFileConstants.AccFinal & f) != 0;
}
+ @Override public boolean isPrimitive() {
+ if (node instanceof FieldDeclaration && !isEnumMember()) {
+ return Eclipse.isPrimitive(((FieldDeclaration) node).type);
+ }
+ if (node instanceof MethodDeclaration) {
+ return Eclipse.isPrimitive(((MethodDeclaration) node).returnType);
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public String fieldOrMethodBaseType() {
+ TypeReference typeReference = null;
+ if (node instanceof FieldDeclaration && !isEnumMember()) {
+ typeReference = ((FieldDeclaration) node).type;
+ }
+ if (node instanceof MethodDeclaration) {
+ typeReference = ((MethodDeclaration) node).returnType;
+ }
+ if (typeReference == null) return null;
+
+ String fqn = Eclipse.toQualifiedName(typeReference.getTypeName());
+ if (typeReference.dimensions() == 0) return fqn;
+ StringBuilder result = new StringBuilder(fqn.length() + 2 * typeReference.dimensions());
+ result.append(fqn);
+ for (int i = 0; i < typeReference.dimensions(); i++) {
+ result.append("[]");
+ }
+ return result.toString();
+ }
+
@Override public boolean isTransient() {
if (getKind() != Kind.FIELD) return false;
Integer i = getModifiers();