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