Skip to content

Issue #10969: Fix false positives for pattern variables in RequireThisCheck#18813

Open
Shubhamyadav93 wants to merge 1 commit intocheckstyle:masterfrom
Shubhamyadav93:issue-10969-fix-pattern-variables
Open

Issue #10969: Fix false positives for pattern variables in RequireThisCheck#18813
Shubhamyadav93 wants to merge 1 commit intocheckstyle:masterfrom
Shubhamyadav93:issue-10969-fix-pattern-variables

Conversation

@Shubhamyadav93
Copy link

Hi

I've updated the RequireThisCheck logic to handle pattern variables correctly. Previously, the check was failing to recognize pattern variables as local declarations, causing false positive violations for the this. qualifier even when a pattern variable was shadowing a field.

I have added PATTERN_VARIABLE_DEF to the identified local variables list. I also added a regression test in RequireThisCheckTest.java to confirm the fix.

Issue: #10969

@romani
Copy link
Member

romani commented Feb 3, 2026

Please read and watch videos at Starting_Development.
Please make CI green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants