Skip to content

[Misc] Use pattern matching for instanceof in extension modules (SonarCloud java:S6201)#5846

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

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

Conversation

@vmassol

@vmassol vmassol commented Jul 15, 2026

Copy link
Copy Markdown
Member

Description

Fixes 28 SonarCloud java:S6201 issues ("Replace this instanceof check and cast with pattern matching for instanceof") across the xwiki-platform-extension modules.

Each instanceof check immediately followed by an explicit cast to the same type is replaced by an instanceof pattern-matching binding (Java 16+), reusing the bound variable in place of the cast. The changes are behaviour-preserving.

Modules touched (5 submodules, 15 files):

  • xwiki-platform-extension-api
  • xwiki-platform-extension-cluster
  • xwiki-platform-extension-distribution
  • xwiki-platform-extension-handlers/xwiki-platform-extension-handler-xar
  • xwiki-platform-extension-script

Verification

mvn clean install (with Checkstyle/Spoon) passes for all five modules.


Generated by Claude Code

…rCloud java:S6201)

Replace instanceof checks followed by an explicit cast with instanceof
pattern matching across the extension api, cluster, distribution,
handler-xar and script modules.

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 15, 2026 — with Claude
@vmassol vmassol self-assigned this Jul 15, 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