1
2
3
4
5
6
7
8
9
10
11 package com.puppycrawl.tools.checkstyle.checks.coding.magicnumber;
12
13
14 @Example4.Annotation(6)
15 public class Example4 {
16 private int field = 7;
17
18 void method1() {
19 int i = 1;
20 int j = 8;
21 }
22 public void method2() {
23 final TestClass testObject = new TestClass(62);
24 final int a = 3;
25 final int[] b = {4, 5};
26 final int c = -3;
27 final int d = +4;
28 final int e = method3(10, 20);
29 final int f = 3 * 4;
30 final int g = 3 / 4;
31 final int h = 3 + 4;
32 final int i = 3 - 4;
33 final int j = (int) 3.4;
34 }
35 private int method3(int a, int b) {
36 return a + b;
37 }
38 public int hashCode() {
39 return 10;
40 }
41 @interface Annotation {
42 int value() default 10;
43 int[] value2() default {10};
44 }
45 class TestClass {
46 TestClass(int field) {}
47 }
48 }
49