diff options
author | Roel Spilker <r.spilker@gmail.com> | 2014-01-19 21:49:35 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2014-01-19 21:49:35 +0100 |
commit | 14cc54527663018cdf7343eefffc8c37fbce93bb (patch) | |
tree | b8b45da7feb1217c31306f7024af37ea287d2b2e /src/core/lombok/javac | |
parent | 2ab6cc809d6aec8d253962547cab7e32598b84a7 (diff) | |
download | lombok-14cc54527663018cdf7343eefffc8c37fbce93bb.tar.gz lombok-14cc54527663018cdf7343eefffc8c37fbce93bb.tar.bz2 lombok-14cc54527663018cdf7343eefffc8c37fbce93bb.zip |
Issue 625: use (even) better primes for hashcodes
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java index 92eee893..05c07c7a 100644 --- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java @@ -231,9 +231,9 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas Name resultName = typeNode.toName(RESULT_NAME); long finalFlag = JavacHandlerUtil.addFinalIfNeeded(0L, typeNode.getContext()); - /* final int PRIME = 277; */ { + /* final int PRIME = X; */ { if (!fields.isEmpty() || callSuper) { - statements.append(maker.VarDef(maker.Modifiers(finalFlag), primeName, maker.TypeIdent(CTC_INT), maker.Literal(HandlerUtil.PRIME_FOR_HASHCODE))); + statements.append(maker.VarDef(maker.Modifiers(finalFlag), primeName, maker.TypeIdent(CTC_INT), maker.Literal(HandlerUtil.primeForHashcode()))); } } @@ -255,9 +255,9 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas if (fType instanceof JCPrimitiveTypeTree) { switch (((JCPrimitiveTypeTree)fType).getPrimitiveTypeKind()) { case BOOLEAN: - /* this.fieldName ? 2591 : 2609 */ + /* this.fieldName ? X : Y */ statements.append(createResultCalculation(typeNode, maker.Conditional(fieldAccessor, - maker.Literal(HandlerUtil.PRIME_FOR_FALSE), maker.Literal(HandlerUtil.PRIME_FOR_TRUE)))); + maker.Literal(HandlerUtil.primeForTrue()), maker.Literal(HandlerUtil.primeForFalse())))); break; case LONG: { Name dollarFieldName = dollar.append(((JCVariableDecl)fieldNode.get()).name); |