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