From 334580ee548ddb09e34564183aba5008fdb29a22 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 22 Jul 2015 04:32:30 +0200 Subject: [trivial] restyle. --- .../javac/handlers/HandleEqualsAndHashCode.java | 78 +++++++++++----------- 1 file changed, 40 insertions(+), 38 deletions(-) (limited to 'src/core/lombok/javac') diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java index c36b0016..b8afce8e 100644 --- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java @@ -124,10 +124,11 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler excludes, List includes, - Boolean callSuper, boolean whineIfExists, FieldAccess fieldAccess, List onParam) { + Boolean callSuper, boolean whineIfExists, FieldAccess fieldAccess, List onParam) { + boolean notAClass = true; if (typeNode.get() instanceof JCClassDecl) { - long flags = ((JCClassDecl)typeNode.get()).mods.flags; + long flags = ((JCClassDecl) typeNode.get()).mods.flags; notAClass = (flags & (Flags.INTERFACE | Flags.ANNOTATION | Flags.ENUM)) != 0; } @@ -140,7 +141,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandlernil(), - maker.Select(maker.Ident(typeNode.toName("super")), typeNode.toName("hashCode")), - List.nil()); + maker.Select(maker.Ident(typeNode.toName("super")), typeNode.toName("hashCode")), + List.nil()); statements.append(createResultCalculation(typeNode, callToSuper)); } @@ -258,14 +259,14 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandlernil(), - genJavaLangTypeRef(typeNode, "Float", "floatToIntBits"), - List.of(fieldAccessor)))); + List.nil(), + genJavaLangTypeRef(typeNode, "Float", "floatToIntBits"), + List.of(fieldAccessor)))); break; case DOUBLE: { /* longToIntForHashCode(Double.doubleToLongBits(this.fieldName)) */ - Name dollarFieldName = dollar.append(((JCVariableDecl)fieldNode.get()).name); + Name dollarFieldName = dollar.append(((JCVariableDecl) fieldNode.get()).name); JCExpression init = maker.Apply( - List.nil(), - genJavaLangTypeRef(typeNode, "Double", "doubleToLongBits"), - List.of(fieldAccessor)); + List.nil(), + genJavaLangTypeRef(typeNode, "Double", "doubleToLongBits"), + List.of(fieldAccessor)); statements.append(maker.VarDef(maker.Modifiers(finalFlag), dollarFieldName, maker.TypeIdent(CTC_LONG), init)); statements.append(createResultCalculation(typeNode, longToIntForHashCode(maker, maker.Ident(dollarFieldName), maker.Ident(dollarFieldName)))); } @@ -299,8 +300,8 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandlernil(), maker.Select(maker.Ident(dollarFieldName), typeNode.toName("hashCode")), - List.nil()); + List.nil()); JCExpression thisEqualsNull = maker.Binary(CTC_EQUAL, maker.Ident(dollarFieldName), maker.Literal(CTC_BOT, null)); statements.append(createResultCalculation(typeNode, maker.Conditional(thisEqualsNull, maker.Literal(HandlerUtil.primeForNull()), hcCall))); } @@ -325,7 +326,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandlernil(), List.nil(), List.nil(), body, null), source, typeNode.getContext()); + List.nil(), List.nil(), List.nil(), body, null), source, typeNode.getContext()); } public JCExpressionStatement createResultCalculation(JavacNode typeNode, JCExpression expr) { @@ -339,7 +340,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler>> 32 ^ ref) */ + /* (int) (ref >>> 32 ^ ref) */ JCExpression shift = maker.Binary(CTC_UNSIGNED_SHIFT_RIGHT, ref1, maker.Literal(32)); JCExpression xorBits = maker.Binary(CTC_BITXOR, shift, ref2); return maker.TypeCast(maker.TypeIdent(CTC_INT), xorBits); @@ -385,7 +386,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandlernil(), - maker.Select(maker.Ident(typeNode.toName("super")), typeNode.toName("equals")), - List.of(maker.Ident(oName))); + maker.Select(maker.Ident(typeNode.toName("super")), typeNode.toName("equals")), + List.of(maker.Ident(oName))); JCUnary superNotEqual = maker.Unary(CTC_NOT, callToSuper); statements.append(maker.If(superNotEqual, returnBool(maker, false), null)); } @@ -462,19 +463,19 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler args = List.of(thisFieldAccessor, otherFieldAccessor); statements.append(maker.If(maker.Unary(CTC_NOT, - maker.Apply(List.nil(), eqMethod, args)), returnBool(maker, false), null)); + maker.Apply(List.nil(), eqMethod, args)), returnBool(maker, false), null)); } else /* objects */ { /* final java.lang.Object this$fieldName = this.fieldName; */ /* final java.lang.Object other$fieldName = other.fieldName; */ /* if (this$fieldName == null ? other$fieldName != null : !this$fieldName.equals(other$fieldName)) return false;; */ - Name fieldName = ((JCVariableDecl)fieldNode.get()).name; + Name fieldName = ((JCVariableDecl) fieldNode.get()).name; Name thisDollarFieldName = thisDollar.append(fieldName); Name otherDollarFieldName = otherDollar.append(fieldName); @@ -484,8 +485,8 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandlernil(), - maker.Select(maker.Ident(thisDollarFieldName), typeNode.toName("equals")), - List.of(maker.Ident(otherDollarFieldName))); + maker.Select(maker.Ident(thisDollarFieldName), typeNode.toName("equals")), + List.of(maker.Ident(otherDollarFieldName))); JCExpression fieldsAreNotEqual = maker.Conditional(thisEqualsNull, otherNotEqualsNull, maker.Unary(CTC_NOT, thisEqualsThat)); statements.append(maker.If(fieldsAreNotEqual, returnBool(maker, false), null)); } @@ -521,12 +522,13 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler args = List.of(thisDotField, otherDotField); JCBinary compareCallEquals0 = maker.Binary(CTC_NOT_EQUAL, maker.Apply( - List.nil(), maker.Select(clazz, node.toName("compare")), args), maker.Literal(0)); + List.nil(), maker.Select(clazz, node.toName("compare")), args), maker.Literal(0)); return maker.If(compareCallEquals0, returnBool(maker, false), null); } -- cgit