Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump versions.errorprone from 2.10.0 to 2.12.1 #2608

Merged
merged 5 commits into from Apr 6, 2022

Conversation

rickie
Copy link
Contributor

@rickie rickie commented Apr 5, 2022

Fixes #2554.

Today ErrorProne 2.12.0 has been released. It contains google/error-prone#2926, which fixes the incompatibility issue for Mockito.
We are blocked internally on the new Mockito release and therefore decided to help out and open this PR.

I'm open to other ideas on how to improve the code.


Bumps versions.errorprone from 2.10.0 to 2.12.1.

Updates error_prone_core from 2.10.0 to 2.12.1

Updates error_prone_test_helpers from 2.10.0 to 2.12.1


updated-dependencies:

  • dependency-name: com.google.errorprone:error_prone_core
    dependency-type: direct:production
    update-type: version-update:semver-minor
  • dependency-name: com.google.errorprone:error_prone_test_helpers
    dependency-type: direct:production
    update-type: version-update:semver-minor
    ...

dependabot bot and others added 4 commits January 26, 2022 18:04
Bumps `versions.errorprone` from 2.10.0 to 2.11.0.

Updates `error_prone_core` from 2.10.0 to 2.11.0
- [Release notes](https://github.com/google/error-prone/releases)
- [Commits](google/error-prone@v2.10.0...v2.11.0)

Updates `error_prone_test_helpers` from 2.10.0 to 2.11.0
- [Release notes](https://github.com/google/error-prone/releases)
- [Commits](google/error-prone@v2.10.0...v2.11.0)

---
updated-dependencies:
- dependency-name: com.google.errorprone:error_prone_core
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: com.google.errorprone:error_prone_test_helpers
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This also fixes mockito#2554, by using `.withNoParameters()` instead.
For some reason, Java 8 chooses the wrong subclass for this specific use
case. All other assertions are fine and this doesn't happen on JDK 11.
Therefore, let's extract it into a method to force the correct type.
@@ -24,7 +25,7 @@ public boolean matches(Number actual) {
return false;
}

if (wanted == actual) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old code was not incorrect due to the subsequent range check. An alternative to this change would be to suppress the DoubleBraceInitialization check on this method. However, simply using .equals is likely less surprising.

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, but can you please update the base branch to main so that I can cleanly merge this PR? Then we can close #2553 as well.

@rickie rickie changed the base branch from dependabot/gradle/versions.errorprone-2.11.0 to main April 6, 2022 06:43
@rickie rickie changed the title Bump versions.errorprone from 2.11.0 to 2.12.0 Bump versions.errorprone from 2.11.0 to 2.12.1 Apr 6, 2022
@rickie rickie changed the title Bump versions.errorprone from 2.11.0 to 2.12.1 Bump versions.errorprone from 2.10.0 to 2.12.1 Apr 6, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2022

Codecov Report

Merging #2608 (353129f) into main (f8ffebe) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main    #2608      +/-   ##
============================================
+ Coverage     86.71%   86.77%   +0.06%     
+ Complexity     2784     2762      -22     
============================================
  Files           320      315       -5     
  Lines          8341     8275      -66     
  Branches       1021     1027       +6     
============================================
- Hits           7233     7181      -52     
+ Misses          840      831       -9     
+ Partials        268      263       -5     
Impacted Files Coverage Δ
...org/mockito/internal/matchers/EqualsWithDelta.java 100.00% <100.00%> (ø)
...ockito/internal/matchers/text/MatchersPrinter.java 100.00% <0.00%> (ø)
.../bugpatterns/MockitoAnyIncorrectPrimitiveType.java
...o/errorprone/bugpatterns/MockitoInternalUsage.java
...ugpatterns/AbstractMockitoAnyForPrimitiveType.java
.../bugpatterns/MockitoAnyClassWithPrimitiveType.java
...o/errorprone/bugpatterns/MockitoNotExtensible.java
...java/org/mockito/internal/exceptions/Reporter.java 90.76% <0.00%> (+0.02%) ⬆️
...rnal/stubbing/defaultanswers/ReturnsDeepStubs.java 98.11% <0.00%> (+0.03%) ⬆️
...ito/internal/stubbing/InvocationContainerImpl.java 94.20% <0.00%> (+0.08%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8ffebe...353129f. Read the comment docs.

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes!

@TimvdLippe TimvdLippe merged commit 331ff01 into mockito:main Apr 6, 2022
@rickie rickie deleted the rossendrijver/errorprone-2.12.0 branch April 6, 2022 06:59
@Stephan202
Copy link
Contributor

@TimvdLippe would it be possible to get a Maven Central release with these changes? As-is we're blocked from upgrading Error Prone (unless we disable mockito-errorprone, of course).

@TimvdLippe
Copy link
Contributor

@Stephan202 We are working on #2613 and will publish a new minor release including that PR.

@TimvdLippe
Copy link
Contributor

4.5.0 is now available on Maven Central: https://repo1.maven.org/maven2/org/mockito/mockito-core/4.5.0/

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.

mockito-errorprone seems not compatible with ErrorProne 2.11.0
4 participants