diff options
author | Roel Spilker <r.spilker@gmail.com> | 2009-12-02 04:11:40 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2009-12-02 04:11:40 +0100 |
commit | e3d9e116af1c573b27ba35ac07f0111aaa1882ac (patch) | |
tree | b47610a46446c3344ba9f8c4dfb8b85d3ac887be /src | |
parent | f05facd4576648122f7bdb80122dc7a1b3f6ecf6 (diff) | |
download | lombok-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')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java | 14 |
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(); |