[Misc] Use pattern matching for instanceof in rendering (SonarCloud java:S6201)#5839
Open
vmassol wants to merge 1 commit into
Open
[Misc] Use pattern matching for instanceof in rendering (SonarCloud java:S6201)#5839vmassol wants to merge 1 commit into
vmassol wants to merge 1 commit into
Conversation
…ava:S6201) Replace instanceof-check-then-cast patterns with instanceof pattern variables (Java 16+) across the xwiki-platform-rendering modules, as flagged by SonarCloud rule java:S6201. Co-Authored-By: Vincent Massol <vincent@massol.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces
instanceofchecks followed by an explicit cast withinstanceofpattern variables (Java 16+), as flagged by SonarCloud rule java:S6201 across thexwiki-platform-renderingmodules.This is a mechanical, behaviour-preserving cleanup. 38 of the 41 open S6201 issues in
xwiki-platform-renderingare fixed here; 3 were left because the rewritten line would exceed the 120-character Checkstyle limit and could not be reflowed.Modules touched:
xwiki-platform-rendering-async(async-api, async-default)xwiki-platform-rendering-wikimacro(wikimacro-store, wikimacro-api)xwiki-platform-rendering-macros(macro-code-oldcore, macro-code, macro-gallery, macro-include, macro-script)xwiki-platform-rendering-signaturexwiki-platform-rendering-xwikiSonarCloud issues (rule java:S6201, project
org.xwiki.platform:xwiki-platform): https://sonarcloud.io/project/issues?id=org.xwiki.platform%3Axwiki-platform&issueStatuses=OPEN&rules=java%3AS6201Verified with
mvn clean install -Plegacy,snapshot -DskipTestson all touched modules (Checkstyle + Spoon pass).Generated by Claude Code