Skip to content

Commit

Permalink
Merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jduo committed Sep 18, 2024
1 parent e9e20e1 commit dc783a9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import java.util.List;
import java.util.Objects;

import static java.util.Objects.requireNonNull;

/**
* Declaration of a method.
*/
Expand All @@ -40,11 +38,15 @@ public class MethodDeclaration extends MemberDeclaration {

public MethodDeclaration(int modifier, String name, Type resultType,
List<ParameterExpression> parameters, BlockStatement body) {
assert name != null : "name should not be null";
assert resultType != null : "resultType should not be null";
assert parameters != null : "parameters should not be null";
assert body != null : "body should not be null";
this.modifier = modifier;
this.name = requireNonNull(name, "name");
this.resultType = requireNonNull(resultType, "resultType");
this.parameters = requireNonNull(parameters, "parameters");
this.body = requireNonNull(body, "body");
this.name = name;
this.resultType = resultType;
this.parameters = parameters;
this.body = body;
}

@Override public MemberDeclaration accept(Shuttle shuttle) {
Expand Down Expand Up @@ -103,11 +105,24 @@ public MethodDeclaration(int modifier, String name, Type resultType,
}

MethodDeclaration that = (MethodDeclaration) o;
return modifier == that.modifier
&& body.equals(that.body)
&& name.equals(that.name)
&& parameters.equals(that.parameters)
&& resultType.equals(that.resultType);

if (modifier != that.modifier) {
return false;
}
if (!body.equals(that.body)) {
return false;
}
if (!name.equals(that.name)) {
return false;
}
if (!parameters.equals(that.parameters)) {
return false;
}
if (!resultType.equals(that.resultType)) {
return false;
}

return true;
}

@Override public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ public void checkBlockBuilder(boolean optimizing, String expected) {

@Test void testEmptyMapLiteral() {
assertEquals("com.google.common.collect.ImmutableMap.of()",
Expressions.toString(Expressions.constant(new HashMap<>())));
Expressions.toString(Expressions.constant(new HashMap<>()), false));
}

@Test void testOneElementMapLiteral() {
Expand Down Expand Up @@ -1652,7 +1652,7 @@ public void checkBlockBuilder(boolean optimizing, String expected) {

@Test void testEmptySetLiteral() {
assertEquals("com.google.common.collect.ImmutableSet.of()",
Expressions.toString(Expressions.constant(new HashSet<>())));
Expressions.toString(Expressions.constant(new HashSet<>()), false));
}

@Test void testOneElementSetLiteral() {
Expand Down

0 comments on commit dc783a9

Please sign in to comment.