1 /*
2 MagicNumber
3 ignoreNumbers = 0.99
4 ignoreHashCodeMethod = (default)false
5 ignoreAnnotation = (default)false
6 ignoreFieldDeclaration = true
7 ignoreAnnotationElementDefaults = false
8 constantWaiverParentToken = (default)TYPECAST, METHOD_CALL, EXPR, ARRAY_INIT, UNARY_MINUS, \
9 UNARY_PLUS, ELIST, STAR, ASSIGN, PLUS, MINUS, DIV, LITERAL_NEW
10 tokens = (default)NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG
11
12
13 */
14 package com.puppycrawl.tools.checkstyle.checks.coding.magicnumber;
15
16 @InputMagicNumberIntMethodAnnotation(3) // violation
17 public class InputMagicNumberIgnoreFieldDeclarationWithAnnotation {
18 public void createEvents(Double d, String s) {
19 if ((d != null) && (s != null && s.equalsIgnoreCase("Fiit"))) {
20 double anotherDouble = d / 60; // violation
21 if (anotherDouble >= 20) { // violation
22 // do something
23 }
24 }
25 }
26 }