Skip to content

Commit

Permalink
remove unused arg
Browse files Browse the repository at this point in the history
  • Loading branch information
summer-ji-eng committed Oct 7, 2020
1 parent 4526eb4 commit 79e98a6
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private static List<MethodDefinition> createClassMethods(
javaMethods.add(
createToStringMethod(templateFinalVarExprs, patternTokenVarExprs, tokenHierarchies));
javaMethods.add(createEqualsMethod(resourceName, tokenHierarchies, types));
javaMethods.add(createHashCodeMethod(templateFinalVarExprs, tokenHierarchies));
javaMethods.add(createHashCodeMethod(tokenHierarchies));
return javaMethods;
}

Expand Down Expand Up @@ -1259,8 +1259,7 @@ private static MethodInvocationExpr createObjectsEqualsForTokenMethodEpxr(
.build();
}

private static MethodDefinition createHashCodeMethod(
List<VariableExpr> templateFinalVarExprs, List<List<String>> tokenHierarchies) {
private static MethodDefinition createHashCodeMethod(List<List<String>> tokenHierarchies) {
List<Statement> asgmtBody = new ArrayList<>();
// code: int h = 1;
Variable hVar = Variable.builder().setType(TypeNode.INT).setName("h").build();
Expand All @@ -1274,12 +1273,13 @@ private static MethodDefinition createHashCodeMethod(
.build();
asgmtBody.add(ExprStatement.withExpr(hAssignmentExpr));
// code: h *= 1000003;
// code: h ^= Objects.hashCode(...);
ValueExpr numValueExpr =
ValueExpr.withValue(
PrimitiveValue.builder().setType(TypeNode.INT).setValue("1000003").build());
AssignmentOperationExpr multiplyAsgmtOpExpr =
AssignmentOperationExpr.multiplyAssignmentWithExprs(hVarExpr, numValueExpr);
// code: h ^= Objects.hashCode(...);
// If it has variants, add the multiply and xor assignment operation exprs for fixedValue.
boolean hasVariants = tokenHierarchies.size() > 1;
if (hasVariants) {
VariableExpr fixedValueVarExpr = FIXED_CLASS_VARS.get("fixedValue");
Expand All @@ -1289,6 +1289,7 @@ private static MethodDefinition createHashCodeMethod(
AssignmentOperationExpr.xorAssignmentWithExprs(
hVarExpr, createObjectsHashCodeForVarMethod(fixedValueVarExpr))));
}
// Add the multiply and xor assignment operation exprs for tokens.
Set<String> tokenSet = getTokenSet(tokenHierarchies);
tokenSet.stream()
.forEach(
Expand Down

0 comments on commit 79e98a6

Please sign in to comment.