You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
As written here and here, I expected the rule to detect all variables eligible to be declared as a constant (with final or static final keywords) because this avoids initializing a variable with the same value each time a method is called.
But this rule, implemented as is today, adds a lot of code smell that I don't find relevant (or I need further explanation to understand their relevance):
Add the 'final' keyword to a method parameter or constructor
Add the 'final' keyword to a parameter inside a catch
Add the 'final' keyword to a variable which is initialized in a method when the value is not reassigned BUT the value is not the same between 2 calls method
👉 I can understand the interest to add the 'final' keyword to declare a better intention, but I don't see how adding the final keyword would make the code more sustainable.
Describe the bug
Several case of false detection for rule "The variable is never reassigned and can be 'final'" (GCI82).
In addition to the issues: #121 and #122
To Reproduce
Analyze this open source project : https://github.com/tonikelope/megabasterd
Expected behavior
As written here and here, I expected the rule to detect all variables eligible to be declared as a constant (with
finalorstatic finalkeywords) because this avoids initializing a variable with the same value each time a method is called.But this rule, implemented as is today, adds a lot of code smell that I don't find relevant (or I need further explanation to understand their relevance):
👉 I can understand the interest to add the 'final' keyword to declare a better intention, but I don't see how adding the final keyword would make the code more sustainable.
Note
The method parameter case will be handled in #121
Screenshots
Software Versions