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
public class Test {
private final String myField;
public Test(String myField) {
this.myField = myField;
}
}
then the StrictUsedVariable check fails with
error: [StrictUnusedVariable] The field 'myField' is never read. Intentional occurrences are acknowledged by renaming the unused variable with a leading underscore. '_myField', for example.
private final String myField;
^
But if I apply the suggested fix
public class Test {
private final String _myField;
public Test(String myField) {
this._myField = myField;
}
}
I also get a StrictUnusedVariable error
error: [StrictUnusedVariable] The field '_myField' is read but has 'StrictUnusedVariable' suppressed because of its name.
private final String _myField;
^
What did you want to happen?
The check should suggest removing the variable and assignment entirely rather than allowing underscores.
The text was updated successfully, but these errors were encountered:
Refs #2361. Change the severity to `SUGGESTION`. Remove suggested fixes to prefix unused variables with underscores, but keep the suggested fix which renames used variables prefixed with underscores.
What happened?
If you have a class like this
then the
StrictUsedVariable
check fails withBut if I apply the suggested fix
I also get a
StrictUnusedVariable
errorWhat did you want to happen?
The check should suggest removing the variable and assignment entirely rather than allowing underscores.
The text was updated successfully, but these errors were encountered: