Skip to content

Address https://errorprone.info/bugpattern/UnnecessaryParentheses warnings in tests.#7771

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test_745579695
Apr 9, 2025
Merged

Address https://errorprone.info/bugpattern/UnnecessaryParentheses warnings in tests.#7771
copybara-service[bot] merged 1 commit intomasterfrom
test_745579695

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

Address https://errorprone.info/bugpattern/UnnecessaryParentheses warnings in tests.

A couple notes on the primitives changes:

  • I realized that we might as well use Double.hashCode(double) and Float.hashCode(float) there instead of boxing and calling the instance hashCode() method. (I'm going to change the prod code in another CL.)
  • We probably don't even need to make sure that the expected values in our assertions have the exact right runtime type, given that Truth considers, e.g., the Integer value 1 to be equal to the Long value 1L. I still kept the types matching when it was easy to do (e.g., 1.0, 1.0f), but I didn't bother when it requires a cast ((short) 1).

…nings in tests.

A couple notes on the `primitives` changes:
- I realized that we might as well use `Double.hashCode(double)` and `Float.hashCode(float)` there instead of boxing and calling the instance `hashCode()` method. (I'm going to change the _prod_ code in another CL.)
- We probably don't even need to make sure that the expected values in our assertions have the exact right runtime type, given that Truth considers, e.g., the `Integer` value `1` to be equal to the `Long` value `1L`. I still kept the types matching when it was easy to do (e.g., `1.0`, `1.0f`), but I didn't bother when it requires a cast (`(short) 1`).

PiperOrigin-RevId: 745662180
@copybara-service copybara-service Bot merged commit 795051e into master Apr 9, 2025
@copybara-service copybara-service Bot deleted the test_745579695 branch April 9, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant