Checks that a private field is used in more than one method, constructor, or initializer.
Rationale: a private field used in only one method, constructor, or initializer should be replaced by a local variable.
| name | description | type | default value |
|---|---|---|---|
| ignoreFormat | pattern for field names that should be ignored | regular expression | ^$ (empty) |
To configure the check:
To configure the check to ignore fields whose name ends in Temp:
com.puppycrawl.tools.checkstyle.checks.usage
Checks that a local variable is used after its declaration.
| name | description | type | default value |
|---|---|---|---|
| ignoreFormat | pattern for variable names that should be ignored | regular expression | ^$ (empty) |
To configure the check:
To configure the check to ignore variables whose name ends in Temp:
com.puppycrawl.tools.checkstyle.checks.usage
Checks that a parameter is used.
| name | description | type | default value |
|---|---|---|---|
| ignoreFormat | pattern for parameter names that should be ignored | regular expression | ^$ (empty) |
| ignoreCatch | controls whether catch parameters should be ignored | boolean | true |
| ignoreNonLocal | controls whether parameters of non local (public, protected or package) methods should be ignored | boolean | false |
To configure the check:
To configure the check to ignore parameters whose name ends in Temp:
To configure the check to report unused catch parameters:
com.puppycrawl.tools.checkstyle.checks.usage
Checks that a private field is used.
| name | description | type | default value |
|---|---|---|---|
| ignoreFormat | pattern for field names that should be ignored | regular expression | ^$ (empty) |
To configure the check:
To configure the check to ignore fields whose name ends in Temp:
com.puppycrawl.tools.checkstyle.checks.usage
Checks that a private method is used.
| name | description | type | default value |
|---|---|---|---|
| ignoreFormat | pattern for method names that should be ignored | regular expression | ^$ (empty) |
| allowSerializationMethods | whether the check should allow serialization-related methods (readObject(), writeObject(), readResolve() and writeReplace() | boolean | false |
To configure the check:
To configure the check to ignore methods whose name ends in Temp:
com.puppycrawl.tools.checkstyle.checks.usage