added the required javadoc
This commit is contained in:
parent
cfcab692dd
commit
dabcb41efe
|
|
@ -34,19 +34,19 @@ public class InputMagicNumber {
|
|||
for (int i = 0; i < 2; i++);
|
||||
|
||||
if (1 < 2);
|
||||
|
||||
|
||||
if (1.0 < 2.0);
|
||||
|
||||
//magic numbers
|
||||
int int_magic1 = 3;
|
||||
double double_magic1 = 1.5;
|
||||
int int_magic2 = (3 + 4);
|
||||
|
||||
|
||||
int_array = new int[3];
|
||||
|
||||
|
||||
int_magic1 += 3;
|
||||
double_magic1 *= 1.5;
|
||||
|
||||
|
||||
for (int j = 3; j < 5; j += 3) {
|
||||
int_magic1++;
|
||||
}
|
||||
|
|
@ -54,22 +54,22 @@ public class InputMagicNumber {
|
|||
if (int_magic1 < 3) {
|
||||
int_magic1 = int_magic1 + 3;
|
||||
}
|
||||
|
||||
|
||||
//octal
|
||||
int octalVar0 = 00;
|
||||
int octalVar8 = 010;
|
||||
int octalVar9 = 011;
|
||||
|
||||
|
||||
long longOctalVar8 = 010L;
|
||||
long longOctalVar9 = 011l;
|
||||
|
||||
|
||||
//hex
|
||||
int hexVar0 = 0x0;
|
||||
int hexVar16 = 0x10;
|
||||
int hexVar17 = 0X011;
|
||||
long longHexVar0 = 0x0L;
|
||||
long longHexVar16 = 0x10L;
|
||||
long longHexVar17 = 0X11l;
|
||||
long longHexVar17 = 0X11l;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ class Signed
|
|||
private int mPlusThree = +3;
|
||||
private int mMinusTwo = -2;
|
||||
private double mPlusDecimal = +3.5;
|
||||
private double mMinusDecimal = -2.5;
|
||||
private double mMinusDecimal = -2.5;
|
||||
}
|
||||
|
||||
/** test octal and hex negative values */
|
||||
|
|
@ -125,7 +125,7 @@ class ComplexAndFlagged
|
|||
{
|
||||
public static final java.util.List MYLIST = new java.util.ArrayList()
|
||||
{
|
||||
public int size()
|
||||
public int size()
|
||||
{
|
||||
// should be flagged although technically inside const definition
|
||||
return 378;
|
||||
|
|
@ -139,7 +139,7 @@ class ComplexButNotFlagged
|
|||
// (at least in the default configuration of MagicNumberCheck)
|
||||
public static final Integer DEFAULT_INT = new Integer(27);
|
||||
public static final int SECS_PER_DAY = 24 * 60 * 60;
|
||||
public static final javax.swing.border.Border STD_BORDER =
|
||||
public static final javax.swing.border.Border STD_BORDER =
|
||||
javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3);
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ enum MyEnum
|
|||
|
||||
private MyEnum(int value)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -181,4 +181,8 @@ class TestHashCodeMethod {
|
|||
public TestHashCodeMethod() {
|
||||
int z=101;
|
||||
}
|
||||
|
||||
@javax.management.MXBean(42)
|
||||
public void another() {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ public class MagicNumberCheckTest
|
|||
"174:15: '21' is a magic number.",
|
||||
"178:15: '37' is a magic number.",
|
||||
"182:15: '101' is a magic number.",
|
||||
"185:30: '42' is a magic number.",
|
||||
};
|
||||
verify(checkConfig, getPath("InputMagicNumber.java"), expected);
|
||||
}
|
||||
|
|
@ -80,6 +81,7 @@ public class MagicNumberCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MagicNumberCheck.class);
|
||||
checkConfig.addAttribute("ignoreNumbers", "0, 1, 3.0, 8, 16");
|
||||
checkConfig.addAttribute("ignoreAnnotation", "true");
|
||||
final String[] expected = {
|
||||
"22:25: '2' is a magic number.",
|
||||
"28:35: '2' is a magic number.",
|
||||
|
|
@ -126,6 +128,7 @@ public class MagicNumberCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MagicNumberCheck.class);
|
||||
checkConfig.addAttribute("ignoreNumbers", "");
|
||||
checkConfig.addAttribute("ignoreAnnotation", "true");
|
||||
final String[] expected = {
|
||||
"21:24: '1' is a magic number.",
|
||||
"22:25: '2' is a magic number.",
|
||||
|
|
@ -200,6 +203,7 @@ public class MagicNumberCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MagicNumberCheck.class);
|
||||
checkConfig.addAttribute("tokens", "NUM_INT, NUM_LONG");
|
||||
checkConfig.addAttribute("ignoreAnnotation", "true");
|
||||
final String[] expected = {
|
||||
"41:26: '3' is a magic number.",
|
||||
"43:27: '3' is a magic number.",
|
||||
|
|
@ -245,6 +249,7 @@ public class MagicNumberCheckTest
|
|||
createCheckConfig(MagicNumberCheck.class);
|
||||
checkConfig.addAttribute("ignoreNumbers", "-9223372036854775808, -2147483648, -1, 0, 1, 2");
|
||||
checkConfig.addAttribute("tokens", "NUM_INT, NUM_LONG");
|
||||
checkConfig.addAttribute("ignoreAnnotation", "true");
|
||||
final String[] expected = {
|
||||
"41:26: '3' is a magic number.",
|
||||
"43:27: '3' is a magic number.",
|
||||
|
|
@ -285,6 +290,7 @@ public class MagicNumberCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MagicNumberCheck.class);
|
||||
checkConfig.addAttribute("ignoreHashCodeMethod", "true");
|
||||
checkConfig.addAttribute("ignoreAnnotation", "true");
|
||||
final String[] expected = {
|
||||
"41:26: '3' is a magic number.",
|
||||
"42:32: '1.5' is a magic number.",
|
||||
|
|
|
|||
Loading…
Reference in New Issue