The following issues were found

src/test/java/com/alibaba/json/bvt/asm/ASMDeserTest2.java
4 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 ASMDeserTest2 extends TestCase {

    public void test_codec_1() throws Exception {
        String text = JSON.toJSONString(new VO());

        Assert.assertEquals("{\"value\":[]}", text);

        VO object = JSON.parseObject(text, VO.class);

            

Reported by PMD.

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

Line: 18

                      Assert.assertEquals("{\"value\":[]}", text);

        VO object = JSON.parseObject(text, VO.class);
        Assert.assertEquals(0, object.getValue().size());
    }

    public static class VO {

        private Entity value = new Entity();

            

Reported by PMD.

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

Line: 18

                      Assert.assertEquals("{\"value\":[]}", text);

        VO object = JSON.parseObject(text, VO.class);
        Assert.assertEquals(0, object.getValue().size());
    }

    public static class VO {

        private Entity value = new Entity();

            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 35

              
    }

    public static class Entity extends ArrayList<String> {

    }

}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_415.java
4 issues
JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 15

              import junit.framework.TestCase;

public class Bug_for_issue_415 extends TestCase {
    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_415.");
    }

    public void test_for_issue() throws Exception {
        Teacher t = new Teacher();

            

Reported by PMD.

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

Line: 16

              
public class Bug_for_issue_415 extends TestCase {
    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_415.");
    }

    public void test_for_issue() throws Exception {
        Teacher t = new Teacher();


            

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

                      ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_415.");
    }

    public void test_for_issue() throws Exception {
        Teacher t = new Teacher();

        Address addr = new Address();
        addr.setAddrDetail("中国上海南京路");


            

Reported by PMD.

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

Line: 75

                  public static class Student {

        private String  name;
        private Address address;

        public String getName() {
            return name;
        }


            

Reported by PMD.

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

Line: 14

                  public void test_for_issue() throws Exception {
        String jsonStr = "{publishedDate:\"2015-09-07\"}";
        TestEntity news = JSON.parseObject(jsonStr, TestEntity.class);
        System.out.println(news.getPublishedDate());
    }

    public static class TestEntity {
        private Timestamp publishedDate;


            

Reported by PMD.

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

Line: 11

              
public class Bug_for_issue_414 extends TestCase {

    public void test_for_issue() throws Exception {
        String jsonStr = "{publishedDate:\"2015-09-07\"}";
        TestEntity news = JSON.parseObject(jsonStr, TestEntity.class);
        System.out.println(news.getPublishedDate());
    }


            

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

    public void test_for_issue() throws Exception {
        String jsonStr = "{publishedDate:\"2015-09-07\"}";
        TestEntity news = JSON.parseObject(jsonStr, TestEntity.class);
        System.out.println(news.getPublishedDate());
    }


            

Reported by PMD.

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

Line: 14

                  public void test_for_issue() throws Exception {
        String jsonStr = "{publishedDate:\"2015-09-07\"}";
        TestEntity news = JSON.parseObject(jsonStr, TestEntity.class);
        System.out.println(news.getPublishedDate());
    }

    public static class TestEntity {
        private Timestamp publishedDate;


            

Reported by PMD.

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

Line: 16

                      demo.setId(1009);
        demo.setName("IT");
        demo.setAge(30);
        System.out.println(JSON.toJSON(demo));
    }

    public static class Demo {
        private int 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: 11

              
public class JSONFieldTest extends TestCase {
    
    public void test_field() throws Exception {
        Demo demo = new Demo();
        demo.setId(1009);
        demo.setName("IT");
        demo.setAge(30);
        System.out.println(JSON.toJSON(demo));

            

Reported by PMD.

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

Line: 11

              
public class JSONFieldTest extends TestCase {
    
    public void test_field() throws Exception {
        Demo demo = new Demo();
        demo.setId(1009);
        demo.setName("IT");
        demo.setAge(30);
        System.out.println(JSON.toJSON(demo));

            

Reported by PMD.

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

Line: 19

                      System.out.println(JSON.toJSON(demo));
    }

    public static class Demo {
        private int id;

        @JSONField(serialize = false)
        private String name;


            

Reported by PMD.

src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectK.java
4 issues
The class 'ObjectK' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=8, WMC=8)
Design

Line: 7

              


public class ObjectK {

	private int a;

	private int b = 0;


            

Reported by PMD.

Avoid using redundant field initializer for 'b'
Performance

Line: 11

              
	private int a;

	private int b = 0;

	private int c = 0;

	private int d = 0;


            

Reported by PMD.

Avoid using redundant field initializer for 'c'
Performance

Line: 13

              
	private int b = 0;

	private int c = 0;

	private int d = 0;

	public int getA() {
		return a;

            

Reported by PMD.

Avoid using redundant field initializer for 'd'
Performance

Line: 15

              
	private int c = 0;

	private int d = 0;

	public int getA() {
		return a;
	}


            

Reported by PMD.

src/main/java/com/alibaba/fastjson/serializer/AfterFilter.java
4 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 26

                      JSONSerializer serializer = serializerLocal.get();
        char seperator = seperatorLocal.get();

        boolean ref = serializer.containsReference(value);
        serializer.writeKeyValue(seperator, key, value);
        if (!ref && serializer.references != null) {
            serializer.references.remove(value);
        }
        if (seperator != ',') {

            

Reported by PMD.

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

Line: 27

                      char seperator = seperatorLocal.get();

        boolean ref = serializer.containsReference(value);
        serializer.writeKeyValue(seperator, key, value);
        if (!ref && serializer.references != null) {
            serializer.references.remove(value);
        }
        if (seperator != ',') {
            seperatorLocal.set(COMMA);

            

Reported by PMD.

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

Line: 29

                      boolean ref = serializer.containsReference(value);
        serializer.writeKeyValue(seperator, key, value);
        if (!ref && serializer.references != null) {
            serializer.references.remove(value);
        }
        if (seperator != ',') {
            seperatorLocal.set(COMMA);
        }
    }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 31

                      if (!ref && serializer.references != null) {
            serializer.references.remove(value);
        }
        if (seperator != ',') {
            seperatorLocal.set(COMMA);
        }
    }

    public abstract void writeAfter(Object object);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/asm/Case0.java
4 issues
System.out.println is used
Design

Line: 16

              
        String jsonString = JSON.toJSONString(entity);

        System.out.println(jsonString);

        V0 entity2 = JSON.parseObject(jsonString, V0.class);
        Assert.assertEquals(entity.getValue(), entity2.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: 10

              
public class Case0 extends TestCase {

    public void test_0() throws Exception {
        V0 entity = new V0();
        entity.setValue("abc");

        String jsonString = JSON.toJSONString(entity);


            

Reported by PMD.

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

Line: 19

                      System.out.println(jsonString);

        V0 entity2 = JSON.parseObject(jsonString, V0.class);
        Assert.assertEquals(entity.getValue(), entity2.getValue());
    }

    public static class V0 {

        private int    id;

            

Reported by PMD.

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

Line: 22

                      Assert.assertEquals(entity.getValue(), entity2.getValue());
    }

    public static class V0 {

        private int    id;
        private String value;

        private long   v2;

            

Reported by PMD.

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

Line: 19

                      Object[] array = new Object[] {vo, vo, vo};
        
        String json = JSON.toJSONString(vo, SerializerFeature.DisableCircularReferenceDetect);
        System.out.println(json);
    }

    public static class VO {

        private String brandintroduction;

            

Reported by PMD.

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

Line: 10

              
public class Bug_for_apollo0317 extends TestCase {

    public void test_for_apollo0317() throws Exception {
        String text = "广州市白云区优网通信线缆厂是一家集专业设计、生产、销售、电工解决方案提供为一体的中型企业,旗下主打品牌(简称:普禄克Pluke);公厂拥有自己的研发团队,自主研发改造的高性能电缆生产流水线使产品的性价比大幅度提升,在技术上处于行业领先。\r\n  普禄克Pluke销售服务网络覆盖全国各省市以及南美、东南亚等地区。产品广范应用在军队通信网,政府网,企业网,电信网,电力网,煤炭网,水利网,广电网,校园网 电梯设备、机电设备、汽车、电子、等行业,其中超五类六类网络线缆,彩色网络跳线,设备连接及控制传输电缆,电器连接线多年来获得客户的高度肯定。?普禄克PLUKE在不断创新中为客户创造价值,在工厂战略的指导下,凭借在售前咨询,系统设计,产品采购,工程施工等方面的综合优势和我们多面的工程服务经验,可以根据客户的要求,提供切实可行的技术方案及系统产品。\r\n 工厂未来将着力于商业模式的创新转换,为合作伙伴提供一个共同成长、双赢的、持续发展的商业平台。\r\n 我们企业的宗旨是:销售最好的产品、追求最佳的售后服务、推广最新的办公理念!";

        VO vo = new VO();
        vo.setBrandintroduction(text);
        

            

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

              
public class Bug_for_apollo0317 extends TestCase {

    public void test_for_apollo0317() throws Exception {
        String text = "广州市白云区优网通信线缆厂是一家集专业设计、生产、销售、电工解决方案提供为一体的中型企业,旗下主打品牌(简称:普禄克Pluke);公厂拥有自己的研发团队,自主研发改造的高性能电缆生产流水线使产品的性价比大幅度提升,在技术上处于行业领先。\r\n  普禄克Pluke销售服务网络覆盖全国各省市以及南美、东南亚等地区。产品广范应用在军队通信网,政府网,企业网,电信网,电力网,煤炭网,水利网,广电网,校园网 电梯设备、机电设备、汽车、电子、等行业,其中超五类六类网络线缆,彩色网络跳线,设备连接及控制传输电缆,电器连接线多年来获得客户的高度肯定。?普禄克PLUKE在不断创新中为客户创造价值,在工厂战略的指导下,凭借在售前咨询,系统设计,产品采购,工程施工等方面的综合优势和我们多面的工程服务经验,可以根据客户的要求,提供切实可行的技术方案及系统产品。\r\n 工厂未来将着力于商业模式的创新转换,为合作伙伴提供一个共同成长、双赢的、持续发展的商业平台。\r\n 我们企业的宗旨是:销售最好的产品、追求最佳的售后服务、推广最新的办公理念!";

        VO vo = new VO();
        vo.setBrandintroduction(text);
        

            

Reported by PMD.

Found 'DU'-anomaly for variable 'array' (lines '16'-'20').
Error

Line: 16

                      VO vo = new VO();
        vo.setBrandintroduction(text);
        
        Object[] array = new Object[] {vo, vo, vo};
        
        String json = JSON.toJSONString(vo, SerializerFeature.DisableCircularReferenceDetect);
        System.out.println(json);
    }


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/JSONBytesTest.java
4 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 JSONBytesTest extends TestCase {

    public void test_codec() throws Exception {
        int len = (Character.MAX_VALUE - Character.MIN_VALUE) + 1;
        char[] chars = new char[len];
        for (int i = 0; i < len; ++i) {
            char ch = (char) ((int) Character.MAX_VALUE + i);
            if (ch >= 55296 && ch <= 57344) {

            

Reported by PMD.

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

Line: 27

                      byte[] bytes = JSON.toJSONBytes(text);
        String text2 = (String) JSON.parse(bytes);
        
        Assert.assertEquals(text.length(), text2.length());
        for (int i = 0; i < len; ++i) {
            char c1 = text.charAt(i);
            char c2 = text2.charAt(i);
            
            Assert.assertEquals(c1, c2);

            

Reported by PMD.

Found 'DD'-anomaly for variable 'chars' (lines '13'-'19').
Error

Line: 13

              
    public void test_codec() throws Exception {
        int len = (Character.MAX_VALUE - Character.MIN_VALUE) + 1;
        char[] chars = new char[len];
        for (int i = 0; i < len; ++i) {
            char ch = (char) ((int) Character.MAX_VALUE + i);
            if (ch >= 55296 && ch <= 57344) {
                continue;
            }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'chars' (lines '19'-'19').
Error

Line: 19

                          if (ch >= 55296 && ch <= 57344) {
                continue;
            }
            chars[i] = ch;
        }
        
        String text = new String(chars);
        
        byte[] bytes = JSON.toJSONBytes(text);

            

Reported by PMD.

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

Line: 15

              
        Model model = new Model();
        model.object = JSONNull.getInstance();
        System.out.println(JSON.toJSONString(model));
//        System.out.println(JSON.toJSONString(map));
    }

    public static class Model {
        public Object object;

            

Reported by PMD.

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

Line: 11

               * Created by wenshao on 17/01/2017.
 */
public class Issue997 extends TestCase {
    public void test_for_issue() throws Exception {

        Model model = new Model();
        model.object = JSONNull.getInstance();
        System.out.println(JSON.toJSONString(model));
//        System.out.println(JSON.toJSONString(map));

            

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 17/01/2017.
 */
public class Issue997 extends TestCase {
    public void test_for_issue() throws Exception {

        Model model = new Model();
        model.object = JSONNull.getInstance();
        System.out.println(JSON.toJSONString(model));
//        System.out.println(JSON.toJSONString(map));

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public Object object;
    }
}

            

Reported by PMD.