diff options
author | Roel Spilker <r.spilker@gmail.com> | 2020-06-18 22:08:25 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2020-06-18 22:08:25 +0200 |
commit | 39d2c280fbaced63f5697481af6b37ab81891798 (patch) | |
tree | 148dd9e4b3798e78b59105b2a5535b396c723aec /src/core/lombok/javac/JavacNode.java | |
parent | c4db4e124c5081602802f88b7ebe564c8af3aac8 (diff) | |
download | lombok-39d2c280fbaced63f5697481af6b37ab81891798.tar.gz lombok-39d2c280fbaced63f5697481af6b37ab81891798.tar.bz2 lombok-39d2c280fbaced63f5697481af6b37ab81891798.zip |
Fixes #1543: in equals, by default first compare the primitives
Diffstat (limited to 'src/core/lombok/javac/JavacNode.java')
-rw-r--r-- | src/core/lombok/javac/JavacNode.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/core/lombok/javac/JavacNode.java b/src/core/lombok/javac/JavacNode.java index 19bbeae3..08d22d98 100644 --- a/src/core/lombok/javac/JavacNode.java +++ b/src/core/lombok/javac/JavacNode.java @@ -27,10 +27,6 @@ import java.util.List; import javax.lang.model.element.Element; import javax.tools.Diagnostic; -import lombok.core.AnnotationValues; -import lombok.core.AST.Kind; -import lombok.javac.handlers.JavacHandlerUtil; - import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.Symtab; import com.sun.tools.javac.model.JavacTypes; @@ -43,8 +39,12 @@ import com.sun.tools.javac.tree.JCTree.JCMethodDecl; import com.sun.tools.javac.tree.JCTree.JCModifiers; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.util.Context; -import com.sun.tools.javac.util.Name; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; +import com.sun.tools.javac.util.Name; + +import lombok.core.AST.Kind; +import lombok.core.AnnotationValues; +import lombok.javac.handlers.JavacHandlerUtil; /** * Javac specific version of the LombokNode class. @@ -345,6 +345,16 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre return mods != null && (Flags.ENUM & mods.flags) != 0; } + @Override public boolean isPrimitive() { + if (node instanceof JCVariableDecl && !isEnumMember()) { + return Javac.isPrimitive(((JCVariableDecl) node).vartype); + } + if (node instanceof JCMethodDecl) { + return Javac.isPrimitive(((JCMethodDecl) node).restype); + } + return false; + } + @Override public boolean isTransient() { if (getKind() != Kind.FIELD) return false; JCModifiers mods = getModifiers(); |