Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change of LocalVariableCouldBeFinal #147

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

danferds
Copy link

Copy link
Owner

@ktuukkan ktuukkan left a comment

Choose a reason for hiding this comment

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

Generally I agree and prefer constants over variables, but as the title says these could be final. However, it doesn mean they should or must.

PMD is a tool that does static analysis based on hard-coded rules - i.e. without actual understanding over the code being inspected - and in the end the decision is yours.

In this PR most changes are surrounded by short and concise code, leaving very little room for errors regarding variable re-assignment. Hence, the only place where I find using final truly feasible is the GenericTypeResolver, because the code there is slightly more complex. But even there, the flow is quite straight-forward and the intermediate variables are mainly used to store next child while drilling down the object hierarchy.

I have a feeling this is related to some sort of assigment work, so I'd suggest to study PMD rule(s) and then look at the code and think carefully if the suggested changes make difference in code quality or not.

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.

None yet

2 participants