Conversation
…tic methods of java.* classes, as those are primarily internal utilities that will cause non-intuitive changes of methods. This are not invoked for non-static mocks either. Fixes #3778.
bric3
left a comment
There was a problem hiding this comment.
Totally agree
Do you have a story behind this change. Is it related to JEP 500?
| isStatic() | ||
| .and( | ||
| not( | ||
| isPrivate() | ||
| .or( | ||
| isDeclaredBy( | ||
| nameStartsWith( | ||
| "java.")) | ||
| .<MethodDescription> | ||
| and( | ||
| isPackagePrivate())))) |
There was a problem hiding this comment.
ouch the alignment. We need to look into spotless rules. This doesn't make sense.
There was a problem hiding this comment.
No, I agree. Will not build otherwise right now, though.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3785 +/- ##
============================================
+ Coverage 86.48% 86.49% +0.01%
Complexity 2989 2989
============================================
Files 341 341
Lines 9041 9050 +9
Branches 1113 1113
============================================
+ Hits 7819 7828 +9
Misses 941 941
Partials 281 281 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
It only fails with Java 25 because they changed the internal implementation to use private static utilities which are now mocked. Before, the code was inlined in the method, so it worked for instances. That's why I think that is a better default. |
|
Can we reuse the |
|
In this case, it is about methods of classes, not the class in general. Also, it those are not referencable by the API. I think this is the right approach here. |
|
Hi, will this be merged soon? This behaviour in Mockito is currently preventing us from upgrading to Java 25. |
…o-5-18` ### What changes were proposed in this pull request? This PR upgrades `mockito-core` to 5.23.0 and the corresponding `scalatestplus-mockito` to `mockito-5-18` to avoid any future Java 21 and 25 testing issue. ### Why are the changes needed? Currently, we are using 5.12.0 which was released on 2024-05-11. We had better keep the test dependency up to date with the latest bug fixes and improvements. - https://github.com/mockito/mockito/releases/tag/v5.23.0 - https://github.com/mockito/mockito/releases/tag/v5.22.0 - mockito/mockito#3778 - mockito/mockito#3785 - https://github.com/mockito/mockito/releases/tag/v5.21.0 - mockito/mockito#3758 - https://github.com/mockito/mockito/releases/tag/v5.20.0 - mockito/mockito#3708 - https://github.com/mockito/mockito/releases/tag/v5.19.0 - mockito/mockito#3659 - https://github.com/mockito/mockito/releases/tag/v5.18.0 - https://github.com/mockito/mockito/releases/tag/v5.17.0 - https://github.com/mockito/mockito/releases/tag/v5.16.0 - https://github.com/mockito/mockito/releases/tag/v5.15.0 - mockito/mockito#3476 - https://github.com/mockito/mockito/releases/tag/v5.14.0 - https://github.com/mockito/mockito/releases/tag/v5.13.0 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-6) Closes #54915 from dongjoon-hyun/SPARK-56098. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
### What changes were proposed in this pull request? This PR upgrades `mockito` to 5.23.0 to bring Java 25 related bug fix. ### Why are the changes needed? To keep the test dependency up to date with the latest bug fixes. - https://github.com/mockito/mockito/releases/tag/v5.23.0 - https://github.com/mockito/mockito/releases/tag/v5.22.0 - mockito/mockito#3778 - mockito/mockito#3785 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs with the existing tests. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-6) Closes #557 from dongjoon-hyun/SPARK-56096. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
### What changes were proposed in this pull request? This PR upgrades `mockito` to 5.23.0 to bring Java 25 related bug fix. ### Why are the changes needed? To keep the test dependency up to date with the latest bug fixes. - https://github.com/mockito/mockito/releases/tag/v5.23.0 - https://github.com/mockito/mockito/releases/tag/v5.22.0 - mockito/mockito#3778 - mockito/mockito#3785 ### How was this patch tested? Pass the CIs with the existing tests. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-6) Closes #2585 from dongjoon-hyun/ORC-2135. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
### What changes were proposed in this pull request? This PR upgrades `mockito` to 5.23.0 to bring Java 25 related bug fix. ### Why are the changes needed? To keep the test dependency up to date with the latest bug fixes. - https://github.com/mockito/mockito/releases/tag/v5.23.0 - https://github.com/mockito/mockito/releases/tag/v5.22.0 - mockito/mockito#3778 - mockito/mockito#3785 ### How was this patch tested? Pass the CIs with the existing tests. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-6) Closes #2585 from dongjoon-hyun/ORC-2135. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit 25d32b7) Signed-off-by: Dongjoon Hyun <[email protected]>
…o-5-18` ### What changes were proposed in this pull request? This PR upgrades `mockito-core` to 5.23.0 and the corresponding `scalatestplus-mockito` to `mockito-5-18` to avoid any future Java 21 and 25 testing issue. ### Why are the changes needed? Currently, we are using 5.12.0 which was released on 2024-05-11. We had better keep the test dependency up to date with the latest bug fixes and improvements. - https://github.com/mockito/mockito/releases/tag/v5.23.0 - https://github.com/mockito/mockito/releases/tag/v5.22.0 - mockito/mockito#3778 - mockito/mockito#3785 - https://github.com/mockito/mockito/releases/tag/v5.21.0 - mockito/mockito#3758 - https://github.com/mockito/mockito/releases/tag/v5.20.0 - mockito/mockito#3708 - https://github.com/mockito/mockito/releases/tag/v5.19.0 - mockito/mockito#3659 - https://github.com/mockito/mockito/releases/tag/v5.18.0 - https://github.com/mockito/mockito/releases/tag/v5.17.0 - https://github.com/mockito/mockito/releases/tag/v5.16.0 - https://github.com/mockito/mockito/releases/tag/v5.15.0 - mockito/mockito#3476 - https://github.com/mockito/mockito/releases/tag/v5.14.0 - https://github.com/mockito/mockito/releases/tag/v5.13.0 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-6) Closes apache#54915 from dongjoon-hyun/SPARK-56098. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
Avoids mocking private static methods, as well as package-private static methods of java.* classes, as those are primarily internal utilities that will cause non-intuitive changes of methods. This are not invoked for non-static mocks either. Fixes #3778.
Minor risk: people might have relied on stubbing those internal methods.