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