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 SR, BSR, SL, BXOR, BOR, BAND, BNOT, QUESTION, COLON, EQUAL, NOT_EQUAL, \
11 GE, GT, LE, LT, MOD
12 tokens = (default)NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG
13
14
15 */
16 package com.puppycrawl.tools.checkstyle.checks.coding.magicnumber;
17
18 @InputMagicNumberIntMethodAnnotation(3) // violation
19 public class InputMagicNumberIgnoreFieldDeclarationWithAnnotation {
20 public void createEvents(Double d, String s) {
21 if ((d != null) && (s != null && s.equalsIgnoreCase("Fiit"))) {
22 double anotherDouble = d / 60; // violation
23 if (anotherDouble >= 20) { // violation
24 // do something
25 }
26 }
27 }
28 }