Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 16, 2023

Bumps mockito-inline from 4.7.0 to 5.0.0.

Release notes

Sourced from mockito-inline's releases.

v5.0.0

Mockito 5: prepare for future JDK versions

For a while now, we have seen an increase in problems/incompatibilities with recent versions of the JDK due to our usage of JVM-internal API. Most notably, JDK 17 made some changes which are incompatible with the current subclass mockmaker. Therefore, to prepare for the future of JDK, we are making some core changes to ensure Mockito keeps on working.

Switch the default mockmaker to mockito-inline

Back in Mockito 2.7.6, we published a new mockmaker based on the "inline bytecode" principle. This mockmaker creates mocks manipulating bytecode equivalent within the original class such that its method implementations hook into the normal Mockito machinery. As a comparison, the subclass mockmaker generates "real" subclasses for mocks, to mimic the same behavior. While the approaches are similar, the inline mockmaker avoids certain restrictions that the JDK imposes. For example, it does not violate module boundaries (introduced in JDK 9, but more heavily used in JDK 17) and avoids the leaking of the creation of the subclass.

Massive thanks to community member @​reta who implemented this change.

When should I still be using the subclass mockmaker?

There are legitimate remaining use cases for the subclass mockmaker. For example, on the Graal VM's native image, the inline mockmaker will not work and the subclass mockmaker is the appropriate choice. Additionally, if you would like to avoid mocking final classes, using the subclass mockmaker is a possibibility. Note however that if you solely want to use the subclass mockmaker to avoid mocking final, you will run into the above mentioned issues on JDK 17+. We want to leave this choice up to our users, which is why we will keep on supporting the subclass mockmaker.

If you want to use the subclass mockmaker instead, you can use the new mockito-subclass artifact (published on Maven Central along with all our other artifacts).

Update the minimum supported Java version to 11

Mockito 4 supports Java 8 and above. Similar to other open source projects, we are moving away from JDK 8 and to newer versions. The primary reason for moving away from JDK 8 is the increasing maintenance costs with keeping our own infrastructure working. Lately we have been running into more and more JDK 8 breakages. Additionally, while we want to support the newest JDK API's, our current solution to support both JDK 8 and newer versions causes issues with the SecurityManager. Since we want Mockito to work on the newest version and more and more businesses adopting JDK 11, we have decided to make the switch as well.

Massive thanks to community member @​reta who implemented this change.

What should I do if I still run JDK 8?

For JDK 8 and below, you can keep on using Mockito 4. This is similar to if you are using JDK 6, for which you can keep on using Mockito 2. The changes in Mockito 5 (for now) are primarily focused on the latest JDK versions, which means the API differences between Mockito 4 and 5 are minimal. However, over time this will most likely widen, so we do recommend adopting JDK 11 in the future.

New type() method on ArgumentMatcher

One of our most used public API's for customizing Mockito is the ArgumentMatcher interface. The interface allows you to define a custom matcher, which you can pass into method arguments to provide more targeted matches. One major shortcoming of the ArgumentMatcher was the lack of varargs support.

... (truncated)

Commits
  • adf528d Bump versions.bytebuddy from 1.12.21 to 1.12.22 (#2864)
  • 2418419 Bump versions.junitJupiter from 5.9.1 to 5.9.2 (#2858)
  • 3d40cd5 Bump junit-platform-launcher from 1.9.1 to 1.9.2 (#2859)
  • 9bec8e3 Bump versions.errorprone from 2.17.0 to 2.18.0 (#2857)
  • a9595f5 Switch the default mockmaker to the inline mockmaker on JDK 17+ (#2834)
  • c5d7fbc Bump assertj-core from 3.23.1 to 3.24.1 (#2854)
  • dbd7f2f Bump versions.bytebuddy from 1.12.20 to 1.12.21 (#2852)
  • 4d62fa7 Bump junit from 1.1.4 to 1.1.5 (#2850)
  • b1b6d6a Bump espresso-core from 3.5.0 to 3.5.1 (#2849)
  • 7b5b8dd Remove use case for non-existent method VerificationWithTimeout#never (#2848)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [mockito-inline](https://github.com/mockito/mockito) from 4.7.0 to 5.0.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v4.7.0...v5.0.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-inline
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot requested a review from tarrinneal as a code owner January 16, 2023 10:06
@dependabot dependabot bot added dependencies Pull requests that update a dependency file java Pull requests that update Java code labels Jan 16, 2023
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 17, 2023
@auto-submit auto-submit bot merged commit 56ab33f into main Jan 17, 2023
@dependabot dependabot bot deleted the dependabot/gradle/packages/shared_preferences/shared_preferences_android/android/org.mockito-mockito-inline-5.0.0 branch January 17, 2023 19:33
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 18, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 18, 2023
* 6ef1bc1da Roll Flutter from 8c2fdb8 to cc7845e (2 revisions) (flutter/plugins#6983)

* 56ab33fd1 [shared_pref]: Bump mockito-inline (flutter/plugins#6976)

* e85e0f28f [camera] Allow logical cameras to use all physical cameras via zoom on android 11+ (flutter/plugins#6150)

* 11361d010 [camera] Use startVideoCapturing and expose concurrent stream/record (flutter/plugins#6815)
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
…#118682)

* 6ef1bc1da Roll Flutter from 8c2fdb8 to cc7845e (2 revisions) (flutter/plugins#6983)

* 56ab33fd1 [shared_pref]: Bump mockito-inline (flutter/plugins#6976)

* e85e0f28f [camera] Allow logical cameras to use all physical cameras via zoom on android 11+ (flutter/plugins#6150)

* 11361d010 [camera] Use startVideoCapturing and expose concurrent stream/record (flutter/plugins#6815)
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
Bumps [mockito-inline](https://github.com/mockito/mockito) from 4.7.0 to 5.0.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v4.7.0...v5.0.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-inline
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App dependencies Pull requests that update a dependency file java Pull requests that update Java code needs tests p: shared_preferences platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants