aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2009-12-02 04:11:40 +0100
committerRoel Spilker <r.spilker@gmail.com>2009-12-02 04:11:40 +0100
commite3d9e116af1c573b27ba35ac07f0111aaa1882ac (patch)
treeb47610a46446c3344ba9f8c4dfb8b85d3ac887be /src/core
parentf05facd4576648122f7bdb80122dc7a1b3f6ecf6 (diff)
downloadlombok-e3d9e116af1c573b27ba35ac07f0111aaa1882ac.tar.gz
lombok-e3d9e116af1c573b27ba35ac07f0111aaa1882ac.tar.bz2
lombok-e3d9e116af1c573b27ba35ac07f0111aaa1882ac.zip
Use chainDots to generate java.lang.Object to get rid of the extra prepended dot!
Change the order of the generated methods, first equals then hashCode
Diffstat (limited to 'src/core')
-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();