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