File: UnusedVariable.md

package info (click to toggle)
error-prone-java 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 15,076 kB
  • sloc: java: 171,398; xml: 1,459; sh: 34; makefile: 7
file content (19 lines) | stat: -rw-r--r-- 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
The presence of an unused variable may indicate a bug. This check highlights
_private_ fields and parameters which are unused and can be safely removed
without considering the impact on other source files.


## Suppression

False positives on fields and parameters can be suppressed by prefixing the
variable name with `unused`, e.g.:

```java
private static void authenticate(User user, Application unusedApplication) {
  checkState(user.isAuthenticated());
}
```


All false positives can be suppressed by annotating the variable with
`@SuppressWarnings("unused")`.