Skip to content

fix : exclusion des variables dont le parent est une méthode abstract#187

Open
riana-ysuf wants to merge 3 commits into
green-code-initiative:mainfrom
riana-ysuf:GCI82-JAVA
Open

fix : exclusion des variables dont le parent est une méthode abstract#187
riana-ysuf wants to merge 3 commits into
green-code-initiative:mainfrom
riana-ysuf:GCI82-JAVA

Conversation

@riana-ysuf
Copy link
Copy Markdown

exclusion des variables dont le parent est une méthode abstract + cas de test

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a false-positive in rule GCI82 (MakeNonReassignedVariablesConstants): parameters of abstract methods (including interface methods without a body) cannot be declared final in a meaningful way and should not be reported. The PR also removes debug logging code that had been left in the check, and adds integration test cases for functional interfaces and interfaces with abstract, default, and static methods.

Changes:

  • Add isParameterOfAbstractMethod guard in visitNode to skip variables whose parent is a method with no body.
  • Remove leftover Logger/Loggers debug code and the buggy getVariableNameForLogger helper (which had an inverted null check).
  • Add integration test cases for a @FunctionalInterface and an interface mixing abstract, default, and static methods; add a CHANGELOG entry.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/java/org/greencodeinitiative/creedengo/java/checks/MakeNonReassignedVariablesConstants.java Adds abstract-method-parameter exclusion and removes debug logging code.
src/it/test-projects/.../GCI82/MakeNonReassignedVariablesConstants.java Adds test cases covering functional interface and interface methods (abstract/default/static).
CHANGELOG.md Documents the GCI82 false-detection fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md Outdated
@arhnabri arhnabri changed the title exclusion des variables dont le parent est une méthode abstract fix : exclusion des variables dont le parent est une méthode abstract May 19, 2026
@arhnabri arhnabri added the 💉 bug Something isn't working label May 19, 2026
@arhnabri arhnabri requested a review from dedece35 May 19, 2026 15:43
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@dedece35 dedece35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • prendre en compte le petit retour de Copilot (cf mon commentaire sur la modif proposée par Copilot dans "conversation")
  • cf aussi mon commentaire dans l'issue #121 car vous êtes 2 équipes sur le coup de ce que je vois

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

Labels

💉 bug Something isn't working

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

5 participants