The following issues were found

src/test/java/com/alibaba/json/bvt/basicType/FloatTest.java
33 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 11

               * Created by wenshao on 04/08/2017.
 */
public class FloatTest extends TestCase {
    public void test_0() throws Exception {
        String json = "{\"v1\":-0.012671709,\"v2\":0.6042485,\"v3\":0.13231707,\"v4\":0.80090785,\"v5\":0.6192943}";
        String json2 = "{\"v1\":\"-0.012671709\",\"v2\":\"0.6042485\",\"v3\":\"0.13231707\",\"v4\":\"0.80090785\",\"v5\":\"0.6192943\"}";

        Model m1 = JSON.parseObject(json, Model.class);
        Model m2 = JSON.parseObject(json2, Model.class);

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 11

               * Created by wenshao on 04/08/2017.
 */
public class FloatTest extends TestCase {
    public void test_0() throws Exception {
        String json = "{\"v1\":-0.012671709,\"v2\":0.6042485,\"v3\":0.13231707,\"v4\":0.80090785,\"v5\":0.6192943}";
        String json2 = "{\"v1\":\"-0.012671709\",\"v2\":\"0.6042485\",\"v3\":\"0.13231707\",\"v4\":\"0.80090785\",\"v5\":\"0.6192943\"}";

        Model m1 = JSON.parseObject(json, Model.class);
        Model m2 = JSON.parseObject(json2, Model.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      Model m1 = JSON.parseObject(json, Model.class);
        Model m2 = JSON.parseObject(json2, Model.class);

        assertNotNull(m1);
        assertNotNull(m2);

        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

                      Model m2 = JSON.parseObject(json2, Model.class);

        assertNotNull(m1);
        assertNotNull(m2);

        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

                      assertNotNull(m1);
        assertNotNull(m2);

        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

                      assertNotNull(m2);

        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 23

              
        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);
        assertEquals(0.6042485f, m2.v2);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

                      assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);
        assertEquals(0.6042485f, m2.v2);
        assertEquals(0.13231707f, m2.v3);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

                      assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);
        assertEquals(0.6042485f, m2.v2);
        assertEquals(0.13231707f, m2.v3);
        assertEquals(0.80090785f, m2.v4);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 27

                      assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);
        assertEquals(0.6042485f, m2.v2);
        assertEquals(0.13231707f, m2.v3);
        assertEquals(0.80090785f, m2.v4);
        assertEquals(0.6192943f, m2.v5);
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_new.java
33 issues
This class has too many methods, consider refactoring it.
Design

Line: 9

              import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.parser.JSONScanner;

public class JSONScannerTest_new extends TestCase {

    public void test_scan_new_0() throws Exception {
        JSONScanner lexer = new JSONScanner("new");
        lexer.scanNullOrNew();
    }

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 11

              
public class JSONScannerTest_new extends TestCase {

    public void test_scan_new_0() throws Exception {
        JSONScanner lexer = new JSONScanner("new");
        lexer.scanNullOrNew();
    }

    public void test_scan_new_1() throws Exception {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 11

              
public class JSONScannerTest_new extends TestCase {

    public void test_scan_new_0() throws Exception {
        JSONScanner lexer = new JSONScanner("new");
        lexer.scanNullOrNew();
    }

    public void test_scan_new_1() throws Exception {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 16

                      lexer.scanNullOrNew();
    }

    public void test_scan_new_1() throws Exception {
        JSONException error = null;
        try {
            JSONScanner lexer = new JSONScanner("nww");
            lexer.scanNullOrNew();
        } catch (JSONException e) {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 27

                      Assert.assertNotNull(error);
    }

    public void test_scan_new_2() throws Exception {
        JSONException error = null;
        try {
            JSONScanner lexer = new JSONScanner("nee");
            lexer.scanNullOrNew();
        } catch (JSONException e) {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 38

                      Assert.assertNotNull(error);
    }

    public void test_scan_new_3() throws Exception {
        JSONException error = null;
        try {
            JSONScanner lexer = new JSONScanner("neel");
            lexer.scanNullOrNew();
        } catch (JSONException e) {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 49

                      Assert.assertNotNull(error);
    }

    public void test_scan_new_4() throws Exception {
        JSONException error = null;
        try {
            JSONScanner lexer = new JSONScanner("neww");
            lexer.scanNullOrNew();
        } catch (JSONException e) {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 60

                      Assert.assertNotNull(error);
    }

    public void test_scan_new_5() throws Exception {
        JSONException error = null;
        try {
            JSONScanner lexer = new JSONScanner("newe");
            lexer.scanNullOrNew();
        } catch (JSONException e) {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 71

                      Assert.assertNotNull(error);
    }

    public void test_scan_new_6() throws Exception {
        JSONException error = null;
        try {
            JSONScanner lexer = new JSONScanner("new\"");
            lexer.scanNullOrNew();
        } catch (JSONException e) {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 82

                      Assert.assertNotNull(error);
    }

    public void test_scan_new_7() throws Exception {
        JSONScanner lexer = new JSONScanner("new a");
        lexer.scanNullOrNew();
    }

    public void test_scan_new_8() throws Exception {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/basicType/FloatTest2_obj.java
33 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 11

               * Created by wenshao on 04/08/2017.
 */
public class FloatTest2_obj extends TestCase {
    public void test_0() throws Exception {
        String json = "{\"v1\":-0.012671709,\"v2\":0.6042485,\"v3\":0.13231707,\"v4\":0.80090785,\"v5\":0.6192943}";
        String json2 = "{\"v1\":\"-0.012671709\",\"v2\":\"0.6042485\",\"v3\":\"0.13231707\",\"v4\":\"0.80090785\",\"v5\":\"0.6192943\"}";

        Model m1 = JSON.parseObject(json, Model.class);
        Model m2 = JSON.parseObject(json2, Model.class);

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 11

               * Created by wenshao on 04/08/2017.
 */
public class FloatTest2_obj extends TestCase {
    public void test_0() throws Exception {
        String json = "{\"v1\":-0.012671709,\"v2\":0.6042485,\"v3\":0.13231707,\"v4\":0.80090785,\"v5\":0.6192943}";
        String json2 = "{\"v1\":\"-0.012671709\",\"v2\":\"0.6042485\",\"v3\":\"0.13231707\",\"v4\":\"0.80090785\",\"v5\":\"0.6192943\"}";

        Model m1 = JSON.parseObject(json, Model.class);
        Model m2 = JSON.parseObject(json2, Model.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      Model m1 = JSON.parseObject(json, Model.class);
        Model m2 = JSON.parseObject(json2, Model.class);

        assertNotNull(m1);
        assertNotNull(m2);

        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

                      Model m2 = JSON.parseObject(json2, Model.class);

        assertNotNull(m1);
        assertNotNull(m2);

        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

                      assertNotNull(m1);
        assertNotNull(m2);

        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

                      assertNotNull(m2);

        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 23

              
        assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);
        assertEquals(0.6042485f, m2.v2);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

                      assertEquals(-0.012671709f, m1.v1);
        assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);
        assertEquals(0.6042485f, m2.v2);
        assertEquals(0.13231707f, m2.v3);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

                      assertEquals(0.6042485f, m1.v2);
        assertEquals(0.13231707f, m1.v3);
        assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);
        assertEquals(0.6042485f, m2.v2);
        assertEquals(0.13231707f, m2.v3);
        assertEquals(0.80090785f, m2.v4);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 27

                      assertEquals(0.80090785f, m1.v4);
        assertEquals(0.6192943f, m1.v5);

        assertEquals(-0.012671709f, m2.v1);
        assertEquals(0.6042485f, m2.v2);
        assertEquals(0.13231707f, m2.v3);
        assertEquals(0.80090785f, m2.v4);
        assertEquals(0.6192943f, m2.v5);
    }

            

Reported by PMD.

src/test/java/com/alibaba/fastjson/validate/JSONValidateTest_basic.java
33 issues
System.out.println is used
Design

Line: 39

              


        System.out.println(intVal & 0xFFFFFFFFL);

        System.out.println((int) b);

        byte[] bytes0 = new byte[8];
        byte[] bytes1 = new byte[8];

            

Reported by PMD.

System.out.println is used
Design

Line: 41

              
        System.out.println(intVal & 0xFFFFFFFFL);

        System.out.println((int) b);

        byte[] bytes0 = new byte[8];
        byte[] bytes1 = new byte[8];
        byte[] bytes2 = new byte[8];


            

Reported by PMD.

System.out.println is used
Design

Line: 50

                      putLong(bytes0, 0, a);
        putLong(bytes1, 0, b);
        putLong(bytes2, 0, 0xFFFFFFFF00000000L);
        System.out.println("");

    }

    static void putLong(byte[] b, int off, long val) {
        b[off + 7] = (byte) (val       );

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 8

              
public class JSONValidateTest_basic extends TestCase
{
    public void test_for_bastic_true() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":true}").validate());
        assertTrue(JSONValidator.from("[true]").validate());
        assertTrue(JSONValidator.from("true").validate());
    }


            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 8

              
public class JSONValidateTest_basic extends TestCase
{
    public void test_for_bastic_true() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":true}").validate());
        assertTrue(JSONValidator.from("[true]").validate());
        assertTrue(JSONValidator.from("true").validate());
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 9

              public class JSONValidateTest_basic extends TestCase
{
    public void test_for_bastic_true() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":true}").validate());
        assertTrue(JSONValidator.from("[true]").validate());
        assertTrue(JSONValidator.from("true").validate());
    }

    public void test_for_bastic_false() throws Exception {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 9

              public class JSONValidateTest_basic extends TestCase
{
    public void test_for_bastic_true() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":true}").validate());
        assertTrue(JSONValidator.from("[true]").validate());
        assertTrue(JSONValidator.from("true").validate());
    }

    public void test_for_bastic_false() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 10

              {
    public void test_for_bastic_true() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":true}").validate());
        assertTrue(JSONValidator.from("[true]").validate());
        assertTrue(JSONValidator.from("true").validate());
    }

    public void test_for_bastic_false() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":false}").validate());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 10

              {
    public void test_for_bastic_true() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":true}").validate());
        assertTrue(JSONValidator.from("[true]").validate());
        assertTrue(JSONValidator.from("true").validate());
    }

    public void test_for_bastic_false() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":false}").validate());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 11

                  public void test_for_bastic_true() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":true}").validate());
        assertTrue(JSONValidator.from("[true]").validate());
        assertTrue(JSONValidator.from("true").validate());
    }

    public void test_for_bastic_false() throws Exception {
        assertTrue(JSONValidator.from("{\"id\":false}").validate());
        assertTrue(JSONValidator.from("[false]").validate());

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug_for_zhuel.java
32 issues
System.out.println is used
Design

Line: 122

                      fs[0] = f1;
        fs[1] = f2;
        fs[2] = f3;
        System.out.println(JSON.VERSION);
        String sfs = JSON.toJSONString(fs, true);

        Assert.assertSame(fs[0].getMaster(), fs[0].getPs()[0]);
        System.out.println(sfs);


            

Reported by PMD.

System.out.println is used
Design

Line: 126

                      String sfs = JSON.toJSONString(fs, true);

        Assert.assertSame(fs[0].getMaster(), fs[0].getPs()[0]);
        System.out.println(sfs);

        {
            Family[] result = JSON.parseObject(sfs, Family[].class);
            Assert.assertSame(result[0].getMaster(), result[0].getPs()[0]);
            Assert.assertSame(result[1].getMaster(), result[1].getPs()[0]);

            

Reported by PMD.

Avoid really long methods.
Design

Line: 12

              
public class Bug_for_zhuel extends TestCase {

    public void test_for_zhuel() throws Exception {
        Person[] ps = new Person[3];
        Person p1 = new Person();
        p1.setAge(50);
        p1.setHight("170");
        p1.setId("p1's id");

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 12

              
public class Bug_for_zhuel extends TestCase {

    public void test_for_zhuel() throws Exception {
        Person[] ps = new Person[3];
        Person p1 = new Person();
        p1.setAge(50);
        p1.setHight("170");
        p1.setId("p1's id");

            

Reported by PMD.

The method 'test_for_zhuel()' has a NCSS line count of 118.
Design

Line: 12

              
public class Bug_for_zhuel extends TestCase {

    public void test_for_zhuel() throws Exception {
        Person[] ps = new Person[3];
        Person p1 = new Person();
        p1.setAge(50);
        p1.setHight("170");
        p1.setId("p1's id");

            

Reported by PMD.

The method test_for_zhuel() has an NCSS line count of 118
Design

Line: 12

              
public class Bug_for_zhuel extends TestCase {

    public void test_for_zhuel() throws Exception {
        Person[] ps = new Person[3];
        Person p1 = new Person();
        p1.setAge(50);
        p1.setHight("170");
        p1.setId("p1's id");

            

Reported by PMD.

The String literal 'daughter's name' appears 4 times in this file; the first occurrence is on line 58
Error

Line: 58

                      pp3.setAge(10);
        pp3.setHight("125");
        pp3.setId("pp3's id");
        pp3.setName("daughter's name");
        pp3.setNames(new String[] { "pp3's id", "daughter's name" });
        pp3.setSex("女");
        ps1[0] = pp1;
        ps1[1] = pp2;
        ps1[2] = pp3;

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 136

                      }
        {
            JSONArray array = JSON.parseArray(sfs);
            for (int i = 0; i < array.size(); ++i) {
                JSONObject jsonObj = array.getJSONObject(i);
                Assert.assertSame(jsonObj.get("master"), jsonObj.getJSONArray("ps").get(0));
            }
        }
    }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 137

                      {
            JSONArray array = JSON.parseArray(sfs);
            for (int i = 0; i < array.size(); ++i) {
                JSONObject jsonObj = array.getJSONObject(i);
                Assert.assertSame(jsonObj.get("master"), jsonObj.getJSONArray("ps").get(0));
            }
        }
    }


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 138

                          JSONArray array = JSON.parseArray(sfs);
            for (int i = 0; i < array.size(); ++i) {
                JSONObject jsonObj = array.getJSONObject(i);
                Assert.assertSame(jsonObj.get("master"), jsonObj.getJSONArray("ps").get(0));
            }
        }
    }

    public static class Family {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/basicType/FloatNullTest.java
32 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 14

               * Created by wenshao on 10/08/2017.
 */
public class FloatNullTest extends TestCase {
    public void test_null() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 14

               * Created by wenshao on 10/08/2017.
 */
public class FloatNullTest extends TestCase {
    public void test_null() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

              public class FloatNullTest extends TestCase {
    public void test_null() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                  public void test_null() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 21

                      assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 21

                      assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 23

              
    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_1() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

                  public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_1() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

                      Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_1() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
        assertNotNull(model);

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/parser/deserializer/EnumDeserializer.java
32 issues
The class 'EnumDeserializer' has a Standard Cyclomatic Complexity of 6 (Highest = 14).
Design

Line: 19

              import static com.alibaba.fastjson.util.TypeUtils.fnv1a_64_magic_prime;

@SuppressWarnings("rawtypes")
public class EnumDeserializer implements ObjectDeserializer {

    protected final Class<?> enumClass;
    protected final Enum[]   enums;
    protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

            

Reported by PMD.

The class 'EnumDeserializer' has a Modified Cyclomatic Complexity of 6 (Highest = 14).
Design

Line: 19

              import static com.alibaba.fastjson.util.TypeUtils.fnv1a_64_magic_prime;

@SuppressWarnings("rawtypes")
public class EnumDeserializer implements ObjectDeserializer {

    protected final Class<?> enumClass;
    protected final Enum[]   enums;
    protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 21

              @SuppressWarnings("rawtypes")
public class EnumDeserializer implements ObjectDeserializer {

    protected final Class<?> enumClass;
    protected final Enum[]   enums;
    protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

    public EnumDeserializer(Class<?> enumClass){

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 22

              public class EnumDeserializer implements ObjectDeserializer {

    protected final Class<?> enumClass;
    protected final Enum[]   enums;
    protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

    public EnumDeserializer(Class<?> enumClass){
        this.enumClass = enumClass;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 23

              
    protected final Class<?> enumClass;
    protected final Enum[]   enums;
    protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

    public EnumDeserializer(Class<?> enumClass){
        this.enumClass = enumClass;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 24

                  protected final Class<?> enumClass;
    protected final Enum[]   enums;
    protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

    public EnumDeserializer(Class<?> enumClass){
        this.enumClass = enumClass;

        ordinalEnums = (Enum[]) enumClass.getEnumConstants();

            

Reported by PMD.

The constructor 'EnumDeserializer(Class)' has a cyclomatic complexity of 17.
Design

Line: 26

                  protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

    public EnumDeserializer(Class<?> enumClass){
        this.enumClass = enumClass;

        ordinalEnums = (Enum[]) enumClass.getEnumConstants();

        Map<Long, Enum> enumMap = new HashMap<Long, Enum>();

            

Reported by PMD.

The constructor 'EnumDeserializer(Class)' has an NPath complexity of 1284, current threshold is 200
Design

Line: 26

                  protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

    public EnumDeserializer(Class<?> enumClass){
        this.enumClass = enumClass;

        ordinalEnums = (Enum[]) enumClass.getEnumConstants();

        Map<Long, Enum> enumMap = new HashMap<Long, Enum>();

            

Reported by PMD.

The constructor 'EnumDeserializer' has a Standard Cyclomatic Complexity of 14.
Design

Line: 26

                  protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

    public EnumDeserializer(Class<?> enumClass){
        this.enumClass = enumClass;

        ordinalEnums = (Enum[]) enumClass.getEnumConstants();

        Map<Long, Enum> enumMap = new HashMap<Long, Enum>();

            

Reported by PMD.

The constructor 'EnumDeserializer' has a Modified Cyclomatic Complexity of 14.
Design

Line: 26

                  protected final Enum[]   ordinalEnums;
    protected       long[]   enumNameHashCodes;

    public EnumDeserializer(Class<?> enumClass){
        this.enumClass = enumClass;

        ordinalEnums = (Enum[]) enumClass.getEnumConstants();

        Map<Long, Enum> enumMap = new HashMap<Long, Enum>();

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/filters/ValueFilterTest.java
32 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 18

              
public class ValueFilterTest extends TestCase {

    public void test_valuefilter() throws Exception {
        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";

            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 22

                      ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";
                }

                return value;
            }

            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 22

                      ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";
                }

                return value;
            }

            

Reported by PMD.

The String literal 'AAA' appears 4 times in this file; the first occurrence is on line 23
Error

Line: 23

              
            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";
                }

                return value;
            }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 33

              
        SerializeWriter out = new SerializeWriter();
        JSONSerializer serializer = new JSONSerializer(out);
        serializer.getValueFilters().add(filter);

        A a = new A();
        serializer.write(a);

        String text = out.toString();

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 42

                      Assert.assertEquals("{\"id\":\"AAA\"}", text);
    }
    
    public void test_toJSONString() throws Exception {
        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";

            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 46

                      ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";
                }

                return value;
            }

            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 46

                      ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";
                }

                return value;
            }

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 58

                      Assert.assertEquals("{\"id\":\"AAA\"}", JSON.toJSONString(new A(), filter));
    }

    public void test_valuefilter_1() throws Exception {
        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("name")) {
                    return "AAA";

            

Reported by PMD.

The String literal 'name' appears 5 times in this file; the first occurrence is on line 62
Error

Line: 62

                      ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("name")) {
                    return "AAA";
                }

                return value;
            }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/basicType/DoubleNullTest.java
32 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 14

               * Created by wenshao on 10/08/2017.
 */
public class DoubleNullTest extends TestCase {
    public void test_null() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 14

               * Created by wenshao on 10/08/2017.
 */
public class DoubleNullTest extends TestCase {
    public void test_null() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

              public class DoubleNullTest extends TestCase {
    public void test_null() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                  public void test_null() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 21

                      assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 21

                      assertNull(model.v2);
    }

    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 23

              
    public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_1() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

                  public void test_null_quote() throws Exception {
        Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_1() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

                      Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\"}", Model.class);
        assertNotNull(model);
        assertNull(model.v1);
        assertNull(model.v2);
    }

    public void test_null_1() throws Exception {
        Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
        assertNotNull(model);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug_for_generic.java
32 issues
System.out.println is used
Design

Line: 21

                  public void test() throws Exception {
        String json = "{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_generic$NotifyDetail\",\"args\":[\"61354557\",\"依依\",\"六\"],\"destId\":60721687,\"detailId\":3155063,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344530416000},\"hotId\":0,\"srcId\":1000,\"templateId\":482}";
        JSON.parseObject(json, NotifyDetail.class);
        System.out.println("NotifyDetail对象没问题");
        String json2 = "{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_generic$Pagination\",\"fromIndex\":0,\"list\":[{\"@type\":\"NotifyDetail\",\"args\":[\"61354557\",\"依依\",\"六\"],\"destId\":60721687,\"detailId\":3155063,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344530416000},\"hotId\":0,\"srcId\":1000,\"templateId\":482},{\"@type\":\"NotifyDetail\",\"args\":[\"14527269\",\"懒洋洋\",\"///最佳拍档,非常\",\"24472950\"],\"destId\":60721687,\"detailId\":3151609,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344354485000},\"hotId\":0,\"srcId\":1000,\"templateId\":40},{\"@type\":\"NotifyDetail\",\"args\":[\"51090218\",\"天之涯\",\"天会黑,人会变。三分\"],\"destId\":60721687,\"detailId\":3149221,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344247529000},\"hotId\":0,\"srcId\":1000,\"templateId\":459},{\"@type\":\"NotifyDetail\",\"args\":[\"51687981\",\"摹然回首梦已成年\",\"星星在哪里都很亮的,\"],\"destId\":60721687,\"detailId\":3149173,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344247414000},\"hotId\":0,\"srcId\":1000,\"templateId\":459},{\"@type\":\"NotifyDetail\",\"args\":[\"41486427\",\"寒江蓑笠\",\"双休了\"],\"destId\":60721687,\"detailId\":3148148,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344244730000},\"hotId\":0,\"srcId\":1000,\"templateId\":459}],\"maxLength\":5,\"nextPage\":2,\"pageIndex\":1,\"prevPage\":1,\"toIndex\":5,\"totalPage\":3,\"totalResult\":13}";
        JSON.parseObject(json2, Pagination.class);
    }

    public static class Pagination<T> implements Serializable {

            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 14

              
public class Bug_for_generic extends TestCase {

    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("NotifyDetail");
    }

    public void test() throws Exception {
        String json = "{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_generic$NotifyDetail\",\"args\":[\"61354557\",\"依依\",\"六\"],\"destId\":60721687,\"detailId\":3155063,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344530416000},\"hotId\":0,\"srcId\":1000,\"templateId\":482}";

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 15

              public class Bug_for_generic extends TestCase {

    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("NotifyDetail");
    }

    public void test() throws Exception {
        String json = "{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_generic$NotifyDetail\",\"args\":[\"61354557\",\"依依\",\"六\"],\"destId\":60721687,\"detailId\":3155063,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344530416000},\"hotId\":0,\"srcId\":1000,\"templateId\":482}";
        JSON.parseObject(json, NotifyDetail.class);

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 18

                      ParserConfig.global.addAccept("NotifyDetail");
    }

    public void test() throws Exception {
        String json = "{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_generic$NotifyDetail\",\"args\":[\"61354557\",\"依依\",\"六\"],\"destId\":60721687,\"detailId\":3155063,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344530416000},\"hotId\":0,\"srcId\":1000,\"templateId\":482}";
        JSON.parseObject(json, NotifyDetail.class);
        System.out.println("NotifyDetail对象没问题");
        String json2 = "{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_generic$Pagination\",\"fromIndex\":0,\"list\":[{\"@type\":\"NotifyDetail\",\"args\":[\"61354557\",\"依依\",\"六\"],\"destId\":60721687,\"detailId\":3155063,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344530416000},\"hotId\":0,\"srcId\":1000,\"templateId\":482},{\"@type\":\"NotifyDetail\",\"args\":[\"14527269\",\"懒洋洋\",\"///最佳拍档,非常\",\"24472950\"],\"destId\":60721687,\"detailId\":3151609,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344354485000},\"hotId\":0,\"srcId\":1000,\"templateId\":40},{\"@type\":\"NotifyDetail\",\"args\":[\"51090218\",\"天之涯\",\"天会黑,人会变。三分\"],\"destId\":60721687,\"detailId\":3149221,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344247529000},\"hotId\":0,\"srcId\":1000,\"templateId\":459},{\"@type\":\"NotifyDetail\",\"args\":[\"51687981\",\"摹然回首梦已成年\",\"星星在哪里都很亮的,\"],\"destId\":60721687,\"detailId\":3149173,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344247414000},\"hotId\":0,\"srcId\":1000,\"templateId\":459},{\"@type\":\"NotifyDetail\",\"args\":[\"41486427\",\"寒江蓑笠\",\"双休了\"],\"destId\":60721687,\"detailId\":3148148,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344244730000},\"hotId\":0,\"srcId\":1000,\"templateId\":459}],\"maxLength\":5,\"nextPage\":2,\"pageIndex\":1,\"prevPage\":1,\"toIndex\":5,\"totalPage\":3,\"totalResult\":13}";
        JSON.parseObject(json2, Pagination.class);

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 18

                      ParserConfig.global.addAccept("NotifyDetail");
    }

    public void test() throws Exception {
        String json = "{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_generic$NotifyDetail\",\"args\":[\"61354557\",\"依依\",\"六\"],\"destId\":60721687,\"detailId\":3155063,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344530416000},\"hotId\":0,\"srcId\":1000,\"templateId\":482}";
        JSON.parseObject(json, NotifyDetail.class);
        System.out.println("NotifyDetail对象没问题");
        String json2 = "{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_generic$Pagination\",\"fromIndex\":0,\"list\":[{\"@type\":\"NotifyDetail\",\"args\":[\"61354557\",\"依依\",\"六\"],\"destId\":60721687,\"detailId\":3155063,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344530416000},\"hotId\":0,\"srcId\":1000,\"templateId\":482},{\"@type\":\"NotifyDetail\",\"args\":[\"14527269\",\"懒洋洋\",\"///最佳拍档,非常\",\"24472950\"],\"destId\":60721687,\"detailId\":3151609,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344354485000},\"hotId\":0,\"srcId\":1000,\"templateId\":40},{\"@type\":\"NotifyDetail\",\"args\":[\"51090218\",\"天之涯\",\"天会黑,人会变。三分\"],\"destId\":60721687,\"detailId\":3149221,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344247529000},\"hotId\":0,\"srcId\":1000,\"templateId\":459},{\"@type\":\"NotifyDetail\",\"args\":[\"51687981\",\"摹然回首梦已成年\",\"星星在哪里都很亮的,\"],\"destId\":60721687,\"detailId\":3149173,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344247414000},\"hotId\":0,\"srcId\":1000,\"templateId\":459},{\"@type\":\"NotifyDetail\",\"args\":[\"41486427\",\"寒江蓑笠\",\"双休了\"],\"destId\":60721687,\"detailId\":3148148,\"display\":false,\"foundTime\":{\"@type\":\"java.sql.Timestamp\",\"val\":1344244730000},\"hotId\":0,\"srcId\":1000,\"templateId\":459}],\"maxLength\":5,\"nextPage\":2,\"pageIndex\":1,\"prevPage\":1,\"toIndex\":5,\"totalPage\":3,\"totalResult\":13}";
        JSON.parseObject(json2, Pagination.class);

            

Reported by PMD.

The class 'Pagination' has a Standard Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 26

                      JSON.parseObject(json2, Pagination.class);
    }

    public static class Pagination<T> implements Serializable {

        /**
     * 
     */
        private static final long serialVersionUID = 5038839734218582220L;

            

Reported by PMD.

The class 'Pagination' is suspected to be a Data Class (WOC=15.789%, NOPA=0, NOAM=14, WMC=32)
Design

Line: 26

                      JSON.parseObject(json2, Pagination.class);
    }

    public static class Pagination<T> implements Serializable {

        /**
     * 
     */
        private static final long serialVersionUID = 5038839734218582220L;

            

Reported by PMD.

The class 'Pagination' has a Modified Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 26

                      JSON.parseObject(json2, Pagination.class);
    }

    public static class Pagination<T> implements Serializable {

        /**
     * 
     */
        private static final long serialVersionUID = 5038839734218582220L;

            

Reported by PMD.

Avoid using redundant field initializer for 'totalResult'
Performance

Line: 33

                   */
        private static final long serialVersionUID = 5038839734218582220L;

        private int               totalResult      = 0;

        private int               totalPage        = 1;

        private int               pageIndex        = 1;


            

Reported by PMD.

Avoid using redundant field initializer for 'fromIndex'
Performance

Line: 41

              
        private int               maxLength        = 5;

        private int               fromIndex        = 0;

        private int               toIndex          = 0;

        private List<T>           list             = new ArrayList<T>();


            

Reported by PMD.