aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
index f388336d..4ee24391 100644
--- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
@@ -167,9 +167,9 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd
}
}
- switch (methodExists("hashCode", typeNode)) {
+ switch (methodExists("equals", typeNode)) {
case NOT_EXISTS:
- JCMethodDecl method = createHashCode(typeNode, nodesForEquality, callSuper);
+ JCMethodDecl method = createEquals(typeNode, nodesForEquality, callSuper);
injectMethod(typeNode, method);
break;
case EXISTS_BY_LOMBOK:
@@ -177,14 +177,14 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd
default:
case EXISTS_BY_USER:
if (whineIfExists) {
- errorNode.addWarning("Not generating hashCode(): A method with that name already exists");
+ errorNode.addWarning("Not generating equals(Object other): A method with that name already exists");
}
break;
}
- switch (methodExists("equals", typeNode)) {
+ switch (methodExists("hashCode", typeNode)) {
case NOT_EXISTS:
- JCMethodDecl method = createEquals(typeNode, nodesForEquality, callSuper);
+ JCMethodDecl method = createHashCode(typeNode, nodesForEquality, callSuper);
injectMethod(typeNode, method);
break;
case EXISTS_BY_LOMBOK:
@@ -192,7 +192,7 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd
default:
case EXISTS_BY_USER:
if (whineIfExists) {
- errorNode.addWarning("Not generating equals(Object other): A method with that name already exists");
+ errorNode.addWarning("Not generating hashCode(): A method with that name already exists");
}
break;
}
@@ -326,7 +326,7 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd
JCAnnotation overrideAnnotation = maker.Annotation(chainDots(maker, typeNode, "java", "lang", "Override"), List.<JCExpression>nil());
JCModifiers mods = maker.Modifiers(Flags.PUBLIC, List.of(overrideAnnotation));
- JCExpression objectType = maker.Type(typeNode.getSymbolTable().objectType);
+ JCExpression objectType = chainDots(maker, typeNode, "java", "lang", "Object");
JCExpression returnType = maker.TypeIdent(TypeTags.BOOLEAN);
List<JCStatement> statements = List.nil();