Skip to content

[Misc] Use pattern matching for instanceof in model, user, livedata and lesscss modules (SonarCloud java:S6201)#5847

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

[Misc] Use pattern matching for instanceof in model, user, livedata and lesscss modules (SonarCloud java:S6201)#5847
vmassol wants to merge 1 commit into
masterfrom
claude/vigilant-dirac-fdnt5s

Conversation

@vmassol

@vmassol vmassol commented Jul 15, 2026

Copy link
Copy Markdown
Member

Replaces instanceof checks followed by an explicit cast with instanceof pattern variables (Java 16+ pattern matching), as flagged by SonarCloud rule java:S6201.

This is a mechanical, behaviour-preserving cleanup covering 45 issues across four modules:

  • xwiki-platform-model-api — 15 issues
  • xwiki-platform-user-default — 11 issues
  • xwiki-platform-livedata-livetable — 10 issues
  • xwiki-platform-lesscss-default — 9 issues

Each site binds a pattern variable and drops the now-redundant cast (including the negated-guard / early-exit and && short-circuit shapes, and reusing existing explicit-cast locals where present). No public API changes.

Verified with mvn clean install (Checkstyle + Spoon) on the four affected modules.


Generated by Claude Code

…nd lesscss modules (SonarCloud java:S6201)

Replace instanceof-check-and-cast patterns with instanceof pattern variables
across the model-api, user-default, livedata-livetable and lesscss-default
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 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