The following issues were found

src/test/java/com/alibaba/json/bvt/DoubleArrayFieldTest_primitive.java
6 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: 12

              
public class DoubleArrayFieldTest_primitive extends TestCase {

    public void test_codec_null() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

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

Line: 23

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();


            

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: 26

                      Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

Returning 'value' may expose an internal array.
Design

Line: 41

                      private double[] value;

        public double[] getValue() {
            return value;
        }

        public void setValue(double[] value) {
            this.value = value;
        }

            

Reported by PMD.

The user-supplied array 'value' is stored directly.
Design

Line: 44

                          return value;
        }

        public void setValue(double[] value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 44

                          return value;
        }

        public void setValue(double[] value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/DoubleFieldTest_A.java
6 issues
System.out.println is used
Design

Line: 19

                      SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);
        String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
        System.out.println(text);

        User user1 = JSON.parseObject(text, User.class);

        Assert.assertEquals(user1.getValue(), user.getValue());
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 33

                      SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);
        String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
        System.out.println(text);

        User user1 = JSON.parseObject(text, User.class);

        Assert.assertEquals(user1.getValue(), user.getValue());
    }

            

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 DoubleFieldTest_A extends TestCase {

    public void test_codec() throws Exception {
        User user = new User();
        user.setValue(1001D);

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);

            

Reported by PMD.

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

Line: 23

              
        User user1 = JSON.parseObject(text, User.class);

        Assert.assertEquals(user1.getValue(), user.getValue());
    }

    public void test_codec_null() throws Exception {
        User user = new User();
        user.setValue(null);

            

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: 26

                      Assert.assertEquals(user1.getValue(), user.getValue());
    }

    public void test_codec_null() throws Exception {
        User user = new User();
        user.setValue(null);

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);

            

Reported by PMD.

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

Line: 37

              
        User user1 = JSON.parseObject(text, User.class);

        Assert.assertEquals(user1.getValue(), user.getValue());
    }

    public static class User {

        private Double value;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/FloatArrayFieldTest_primitive.java
6 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: 12

              
public class FloatArrayFieldTest_primitive extends TestCase {

    public void test_codec_null() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

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

Line: 23

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();


            

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: 26

                      Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

Returning 'value' may expose an internal array.
Design

Line: 41

                      private float[] value;

        public float[] getValue() {
            return value;
        }

        public void setValue(float[] value) {
            this.value = value;
        }

            

Reported by PMD.

The user-supplied array 'value' is stored directly.
Design

Line: 44

                          return value;
        }

        public void setValue(float[] value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 44

                          return value;
        }

        public void setValue(float[] value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/FloatFieldTest_A.java
6 issues
System.out.println is used
Design

Line: 19

                      SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);
        String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
        System.out.println(text);

        User user1 = JSON.parseObject(text, User.class);

        Assert.assertEquals(user1.getValue(), user.getValue());
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 33

                      SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);
        String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
        System.out.println(text);

        User user1 = JSON.parseObject(text, User.class);

        Assert.assertEquals(user1.getValue(), user.getValue());
    }

            

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 FloatFieldTest_A extends TestCase {

    public void test_codec() throws Exception {
        User user = new User();
        user.setValue(1001F);

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);

            

Reported by PMD.

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

Line: 23

              
        User user1 = JSON.parseObject(text, User.class);

        Assert.assertEquals(user1.getValue(), user.getValue());
    }

    public void test_codec_null() throws Exception {
        User user = new User();
        user.setValue(null);

            

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: 26

                      Assert.assertEquals(user1.getValue(), user.getValue());
    }

    public void test_codec_null() throws Exception {
        User user = new User();
        user.setValue(null);

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);

            

Reported by PMD.

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

Line: 37

              
        User user1 = JSON.parseObject(text, User.class);

        Assert.assertEquals(user1.getValue(), user.getValue());
    }

    public static class User {

        private Float value;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/JSONArrayTest3.java
6 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: 12

              import junit.framework.TestCase;

public class JSONArrayTest3 extends TestCase {
    public void test_0() throws Exception {
        JSONArray array = new JSONArray();
        array.set(1, "1001");
        Assert.assertEquals(2, array.size());
        Assert.assertNull(array.get(0));
        Assert.assertEquals("1001", array.get(1));

            

Reported by PMD.

The String literal '1001' appears 8 times in this file; the first occurrence is on line 14
Error

Line: 14

              public class JSONArrayTest3 extends TestCase {
    public void test_0() throws Exception {
        JSONArray array = new JSONArray();
        array.set(1, "1001");
        Assert.assertEquals(2, array.size());
        Assert.assertNull(array.get(0));
        Assert.assertEquals("1001", array.get(1));
        
        array.clear();

            

Reported by PMD.

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

Line: 26

                      Assert.assertEquals(1, array.size());
        Assert.assertEquals("1001", array.get(0));
        
        array.fluentAdd("1002").fluentClear();
        Assert.assertEquals(0, array.size());
        
        array.fluentAdd("1002").fluentRemove("1002");
        Assert.assertEquals(0, array.size());
        

            

Reported by PMD.

The String literal '1002' appears 7 times in this file; the first occurrence is on line 26
Error

Line: 26

                      Assert.assertEquals(1, array.size());
        Assert.assertEquals("1001", array.get(0));
        
        array.fluentAdd("1002").fluentClear();
        Assert.assertEquals(0, array.size());
        
        array.fluentAdd("1002").fluentRemove("1002");
        Assert.assertEquals(0, array.size());
        

            

Reported by PMD.

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

Line: 29

                      array.fluentAdd("1002").fluentClear();
        Assert.assertEquals(0, array.size());
        
        array.fluentAdd("1002").fluentRemove("1002");
        Assert.assertEquals(0, array.size());
        
        array.fluentAdd("1002").fluentRemove(0);
        Assert.assertEquals(0, array.size());
        

            

Reported by PMD.

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

Line: 32

                      array.fluentAdd("1002").fluentRemove("1002");
        Assert.assertEquals(0, array.size());
        
        array.fluentAdd("1002").fluentRemove(0);
        Assert.assertEquals(0, array.size());
        
        array.fluentSet(1, "1001");
        Assert.assertEquals(2, array.size());
        Assert.assertNull(array.get(0));

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/JSONTest3.java
6 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: 15

              import junit.framework.TestCase;

public class JSONTest3 extends TestCase {
    public void test_json() throws Exception {
        ExtraProcessor extraProcessor = new ExtraProcessor() {

            public void processExtra(Object object, String key, Object value) {
                Model model = (Model) object;
                model.attributes.put(key, value);

            

Reported by PMD.

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

Line: 20

              
            public void processExtra(Object object, String key, Object value) {
                Model model = (Model) object;
                model.attributes.put(key, value);
            }
        };
        
        Model model = JSON.parseObject("{\"id\":1001}", (Type) Model.class, extraProcessor);
        Assert.assertEquals(1, model.attributes.size());

            

Reported by PMD.

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

Line: 25

                      };
        
        Model model = JSON.parseObject("{\"id\":1001}", (Type) Model.class, extraProcessor);
        Assert.assertEquals(1, model.attributes.size());
        Assert.assertEquals(1001, model.attributes.get("id"));
    }
    
    public static class Model {
        private Map<String, Object> attributes = new HashMap<String, Object>();

            

Reported by PMD.

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

Line: 26

                      
        Model model = JSON.parseObject("{\"id\":1001}", (Type) Model.class, extraProcessor);
        Assert.assertEquals(1, model.attributes.size());
        Assert.assertEquals(1001, model.attributes.get("id"));
    }
    
    public static class Model {
        private Map<String, Object> attributes = new HashMap<String, Object>();
    }

            

Reported by PMD.

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

Line: 30

                  }
    
    public static class Model {
        private Map<String, Object> attributes = new HashMap<String, Object>();
    }
}

            

Reported by PMD.

Private field 'attributes' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 30

                  }
    
    public static class Model {
        private Map<String, Object> attributes = new HashMap<String, Object>();
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/JSONTypeTest.java
6 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: 10

              import com.alibaba.fastjson.annotation.JSONType;

public class JSONTypeTest extends TestCase {
	public void test_0() throws Exception {
		VO vo = new VO();
		vo.setId(1001);
		vo.setName("xx");
		vo.setAge(33);


            

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: 20

              				JSON.toJSONString(vo));
	}
	
	public void test_1() throws Exception {
		V1 vo = new V1();
		vo.setId(1001);
		vo.setName("xx");
		vo.setAge(33);
		

            

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: 30

              				JSON.toJSONString(vo));
	}
	
	public void test_2() throws Exception {
		V1 vo = new V1();
		vo.setId(1001);
		vo.setName("xx");
		vo.setAge(33);
		

            

Reported by PMD.

The class 'VO' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=6, WMC=6)
Design

Line: 41

              	}

	@JSONType
	public static class VO {
		private int id;
		private String name;
		private int age;

		public int getId() {

            

Reported by PMD.

The class 'V1' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=6, WMC=6)
Design

Line: 72

              	}

	@JSONType(orders = { "id", "name", "age" })
	public static class V1 {
		private int id;
		private String name;
		private int age;

		public int getId() {

            

Reported by PMD.

The class 'V2' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=6, WMC=6)
Design

Line: 103

              	}
	
	@JSONType(orders = { "id", "name", "age" },asm=false)
	private class V2 {
		private int id;
		private String name;
		private int age;
		
		public int getId() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/JSONTypeTest1.java
6 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

              
public class JSONTypeTest1 extends TestCase {

    public void test_ignores() throws Exception {
        A a = new A();
        a.setF1(1001);
        a.setF2(1002);
        a.setF3(1003);


            

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: 20

                      Assert.assertEquals("{\"f1\":1001,\"f3\":1003}", JSON.toJSONString(a));
    }

    public void test_ignoresParent() throws Exception {
        B b = new B();
        b.setF1(1001);
        b.setF2(1002);
        b.setF3(1003);
        b.setF4(1004);

            

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: 31

                      Assert.assertEquals("{\"f1\":1001,\"f3\":1003,\"f5\":1005}", JSON.toJSONString(b));
    }
    
    public void test_ignoresParent2() throws Exception {
        C c = new C();
        c.setF1(1001);
        c.setF2(1002);
        c.setF3(1003);
        c.setF4(1004);

            

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: 43

                      Assert.assertEquals("{\"f1\":1001,\"f3\":1003,\"f5\":1005,\"f6\":1006}", JSON.toJSONString(c));
    }
    
    public void test_ignoresParent3() throws Exception {
        D d = new D();
        d.setF1(1001);
        d.setF2(1002);
        d.setF3(1003);
        d.setF4(1004);

            

Reported by PMD.

The class 'A' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=6, WMC=6)
Design

Line: 57

                  }

    @JSONType(ignores = "f2")
    public static class A {

        private int f1;
        private int f2;
        private int f3;


            

Reported by PMD.

The class 'B' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=4, WMC=4)
Design

Line: 90

                  }

    @JSONType(ignores = { "f4" })
    public static class B extends A {

        private int f4;
        private int f5;

        public int getF4() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/LinkedListFieldTest.java
6 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

              
public class LinkedListFieldTest extends TestCase {

    public void test_codec_null() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

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

Line: 25

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();


            

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: 28

                      Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

Avoid using implementation types like 'LinkedList'; use the interface instead
Design

Line: 42

              
    public static class V0 {

        private LinkedList value;

        public LinkedList getValue() {
            return value;
        }


            

Reported by PMD.

Avoid using implementation types like 'LinkedList'; use the interface instead
Design

Line: 44

              
        private LinkedList value;

        public LinkedList getValue() {
            return value;
        }

        public void setValue(LinkedList value) {
            this.value = value;

            

Reported by PMD.

Avoid using implementation types like 'LinkedList'; use the interface instead
Design

Line: 48

                          return value;
        }

        public void setValue(LinkedList value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/LongArrayFieldTest.java
6 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: 12

              
public class LongArrayFieldTest extends TestCase {

    public void test_codec_null() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

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

Line: 23

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();


            

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: 26

                      Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

Returning 'value' may expose an internal array.
Design

Line: 41

                      private Long[] value;

        public Long[] getValue() {
            return value;
        }

        public void setValue(Long[] value) {
            this.value = value;
        }

            

Reported by PMD.

The user-supplied array 'value' is stored directly.
Design

Line: 44

                          return value;
        }

        public void setValue(Long[] value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 44

                          return value;
        }

        public void setValue(Long[] value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.