[xwiki/xwiki-platform] b945a1: [Misc] Revert the java:S5785 changes on the equals...
Branch: refs/heads/stable-18.6.x Home: https://github.com/xwiki/xwiki-platform Commit: b945a1fa66130bd0869090dceeeaae46eb6ee9b9 https://github.com/xwiki/xwiki-platform/commit/b945a1fa66130bd0869090dceeeaa... Author: Vincent Massol <[email protected]> Date: 2026-07-29 (Wed, 29 Jul 2026) Changed paths: M xwiki-platform-core/xwiki-platform-bridge/src/test/java/org/xwiki/bridge/ActionExecutingEventTest.java M xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-api/src/test/java/org/xwiki/eventstream/AbstractRecordableEventDescriptorTest.java M xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-api/src/test/java/org/xwiki/eventstream/SimpleEventQueryTest.java M xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-observation/src/test/java/org/xwiki/observation/ActionExecutionEventTest.java M xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-api/src/test/java/org/xwiki/model/reference/EntityReferenceTest.java M xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-api/src/test/java/org/xwiki/model/reference/RegexEntityReferenceTest.java M xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/doc/XWikiDocumentMockitoTest.java M xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/doc/XWikiLinkTest.java M xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/objects/NumberPropertyTest.java M xwiki-platform-core/xwiki-platform-refactoring/xwiki-platform-refactoring-api/src/test/java/org/xwiki/refactoring/job/question/EntitySelectionTest.java M xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authorization/xwiki-platform-security-authorization-api/src/test/java/org/xwiki/security/authorization/RightMapTest.java M xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authorization/xwiki-platform-security-authorization-api/src/test/java/org/xwiki/security/authorization/RightSetTest.java M xwiki-platform-core/xwiki-platform-url/xwiki-platform-url-api/src/test/java/org/xwiki/url/ExtendedURLTest.java M xwiki-platform-core/xwiki-platform-webjars/xwiki-platform-webjars-api/src/test/java/org/xwiki/webjars/WebJarResourceReferenceTest.java Log Message: ----------- [Misc] Revert the java:S5785 changes on the equals()/hashCode() contract tests (#6020) (#6022) Converting assertTrue/assertFalse(a.equals(b)) into assertEquals/assertNotEquals in tests whose purpose is to verify the equals()/hashCode() contract changes what is being tested. JUnit compares through AssertionUtils.objectsAreEqual(a, b), i.e. a == null ? b == null : a.equals(b), so the call site no longer shows which object is the receiver and which one is the argument, and it invites a later java:S3415 "swap these arguments" change that would call the other object's equals() instead. The 88 assertions concerned are restored to their boolean form in 14 test files, and the reason now lives in the code as @SuppressWarnings("java:S5785") plus an explanatory comment on each contract-test method. Assertions that merely happen to compare two values with equals() in ordinary tests are left converted, as are the hashCode() comparisons outside contract tests. RegexEntityReferenceTest is the clearest case: RegexEntityReference#equals() only runs the regex when the regex reference is the receiver, so the converted assertions were one java:S3415 argument swap away from silently no longer matching anything. On this branch the class-level @SuppressWarnings("java:S3415") that master had added to hold that off was never applied, so the file goes straight from the converted form back to the boolean one. This reverts the equals()/hashCode() contract-test parts of 1eafd658a13, a94435cb30c, ce509be1144 and d5ac2bd37e0. (cherry picked from commit d114bf0615cdf7c1f058ac4547721f48302c43d9) Co-authored-by: Claude Opus 5 (1M context) <[email protected]> To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-platform/settings/notifications
participants (1)
-
XWiki Notifications