Skip to content

[Misc] Use pattern matching for instanceof in rendering (SonarCloud java:S6201)#5839

Open
vmassol wants to merge 1 commit into
masterfrom
claude/vigilant-dirac-xh2ylq
Open

[Misc] Use pattern matching for instanceof in rendering (SonarCloud java:S6201)#5839
vmassol wants to merge 1 commit into
masterfrom
claude/vigilant-dirac-xh2ylq

Conversation

@vmassol

@vmassol vmassol commented Jul 14, 2026

Copy link
Copy Markdown
Member

Replaces instanceof checks followed by an explicit cast with instanceof pattern variables (Java 16+), as flagged by SonarCloud rule java:S6201 across the xwiki-platform-rendering modules.

This is a mechanical, behaviour-preserving cleanup. 38 of the 41 open S6201 issues in xwiki-platform-rendering are 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-signature
  • xwiki-platform-rendering-xwiki

SonarCloud 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%3AS6201

Verified with mvn clean install -Plegacy,snapshot -DskipTests on all touched modules (Checkstyle + Spoon pass).


Generated by Claude Code

…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>
@vmassol vmassol added the llm-agent To be used for PRs created autonomously by LLM agents. label Jul 14, 2026 — with Claude
@vmassol vmassol self-assigned this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-agent To be used for PRs created autonomously by LLM agents.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant