View Javadoc
1   /*
2   MagicNumber
3   ignoreNumbers = (default)-1, 0, 1, 2
4   ignoreHashCodeMethod = true
5   ignoreAnnotation = true
6   ignoreFieldDeclaration = (default)false
7   ignoreAnnotationElementDefaults = (default)true
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  
15  package com.puppycrawl.tools.checkstyle.checks.coding.magicnumber;
16  public class InputMagicNumberIgnoreHashCodeMethod2 {
17      /**
18       * test long hex
19       */
20      long l = 0xffffffffL; // violation
21  
22      /**
23       * test signed values
24       */
25      public static final int CONST_PLUS_THREE = +3;
26      public static final int CONST_MINUS_TWO = -2;
27      private int mPlusThree = +3; // violation
28      private int mMinusTwo = -2; // violation
29      private double mPlusDecimal = +3.5; // violation
30      private double mMinusDecimal = -2.5; // violation
31  
32      /**
33       * test octal and hex negative values
34       */
35      private int hexIntMinusOne = 0xffffffff;
36      private long hexLongMinusOne = 0xffffffffffffffffL;
37      private long hexIntMinValue = 0x80000000; // violation
38      private long hexLongMinValue = 0x8000000000000000L; // violation
39      private int octalIntMinusOne = 037777777777;
40      private long octalLongMinusOne = 01777777777777777777777L;
41      private long octalIntMinValue = 020000000000;  // violation
42      private long octalLongMinValue = 01000000000000000000000L; // violation
43  
44      public static final int TESTINTVAL = (byte) 0x80;
45  
46      public static final java.util.List MYLIST = new java.util.ArrayList() {
47          public int size() {
48  
49              return 378; // violation
50          }
51      };
52  
53      public final double SpecialSum = 2 + 1e10, SpecialDifference = 4 - java.lang.Math.PI;
54      public final Integer DefaultInit = new Integer(27);
55      public final int SpecsPerDay = 24 * 60 * 60, SpecialRatio = 4 / 3;
56      public final javax.swing.border.Border StdBorder =
57              javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3);
58  
59      enum MyEnum2IgnoreHashCodeMethod2 {
60          A_2(3),
61          B_2(54);
62  
63          private MyEnum2IgnoreHashCodeMethod2(int value) {
64  
65          }
66      }
67  }