Visitar URL original
Replaces raw generic types with type parameters by mirkoalicastro · Pull Request #3806 · mockito/mockito · GitHub
Skip to content

Replaces raw generic types with type parameters - #3806

Merged
raphw merged 1 commit into
mockito:mainfrom
mirkoalicastro:fix/raw-generic-types
Apr 6, 2026
Merged

raphw merged 1 commit into
mockito:mainfrom
mirkoalicastro:fix/raw-generic-types

Conversation

@mirkoalicastro

Copy link
Copy Markdown
Contributor

Eliminates raw type usages of MockHandler, MockCreationSettings, and RealMethodBehavior replacing them with properly parameterized types.

The benefits of the changes are stronger compile-time type safety (although most of the places is not possible and <?> is used, for others like MockHandler<T> in createMock it makes explicit that the handler is tied to the mock's type). Also, it provides cleaner IDE experience (without raw type warnings).

Checklist

  • Read the contributing guide
  • PR should be motivated, i.e. what does it fix, why, and if relevant how
  • If possible / relevant include an example in the description, that could help all readers
    including project members to get a better picture of the change
  • Avoid other runtime dependencies
  • Meaningful commit history ; intention is important please rebase your commit history so that each
    commit is meaningful and help the people that will explore a change in 2 years
  • The pull request follows coding style (run ./gradlew spotlessApply for auto-formatting)
  • Mention Fixes #<issue number> in the description if relevant
  • At least one commit should end with Fixes #<issue number> if relevant

@mirkoalicastro
mirkoalicastro force-pushed the fix/raw-generic-types branch from f286d16 to c943b29 Compare April 5, 2026 11:21
@codecov-commenter

codecov-commenter commented Apr 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.82%. Comparing base (82998ff) to head (0dfed26).

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #3806       +/-   ##
=============================================
+ Coverage     13.00%   86.82%   +73.82%     
- Complexity      476     3020     +2544     
=============================================
  Files           341      341               
  Lines          9104     9104               
  Branches       1124     1124               
=============================================
+ Hits           1184     7905     +6721     
+ Misses         7703      910     -6793     
- Partials        217      289       +72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mirkoalicastro
mirkoalicastro force-pushed the fix/raw-generic-types branch from c943b29 to 0dfed26 Compare April 5, 2026 11:29
@raphw
raphw merged commit 42c68ec into mockito:main Apr 6, 2026
19 checks passed
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.

3 participants