Source code: com/puppycrawl/tools/checkstyle/usage/InputUnusedLocal.java
1 package com.puppycrawl.tools.checkstyle.usage;
2
3 import java.awt.Rectangle;
4
5 /** Test input for unused local variable check */
6 public class InputUnusedLocal
7 {
8 private int mUnreadPrimitive = 0;
9
10 public InputUnusedLocal()
11 {
12 int readPrimitive = 0;
13 int mUnreadPrimitive = 0;
14 int i = readPrimitive;
15 i++;
16
17 this.mUnreadPrimitive++;
18 }
19
20 private void method()
21 {
22 String readObject = "";
23 Rectangle rectangle = null;
24 Object unreadObject;
25 int i = readObject.length();
26
27 int j = rectangle.x;
28
29 i += j;
30 }
31
32 private void methodArrays()
33 {
34 int[] array = {};
35 int[] array2 = {};
36 int[] unreadArray;
37 int i = array[0];
38 array2[0] = 0;
39 i++;
40 }
41
42 /** tests that neither type nor typecast are considered to be a reference */
43 public void method2()
44 {
45 int java;
46 java.io.File file = (java.io.File) null;
47 if (file != null) {
48 }
49 }
50 }