The following issues were found

src/test/java/com/alibaba/json/bvt/bug/Bug_for_Jay.java
2 issues
JUnit tests should include assert() or fail()
Design

Line: 9

              
public class Bug_for_Jay extends TestCase {

    public void test_for_jay() throws Exception {
        JSON.toJSONString(new B(), true);
    }

    public class A {


            

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

              
public class Bug_for_Jay extends TestCase {

    public void test_for_jay() throws Exception {
        JSON.toJSONString(new B(), true);
    }

    public class A {


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug_for_JSONObject.java
2 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 Bug_for_JSONObject extends TestCase {
    public void test_0 () throws Exception {
        JSONSerializer ser = new JSONSerializer();
        ser.config(SerializerFeature.WriteClassName, true);
        ser.write(new JSONObject());
    }
}

            

Reported by PMD.

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

Line: 11

              

public class Bug_for_JSONObject extends TestCase {
    public void test_0 () throws Exception {
        JSONSerializer ser = new JSONSerializer();
        ser.config(SerializerFeature.WriteClassName, true);
        ser.write(new JSONObject());
    }
}

            

Reported by PMD.

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

Line: 6

              import java.util.List;


public class ObjectF {
	
	protected long a;

	
	protected int b;

            

Reported by PMD.

Too many fields
Design

Line: 6

              import java.util.List;


public class ObjectF {
	
	protected long a;

	
	protected int b;

            

Reported by PMD.

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

    public void test_for_issue() throws Exception {
        Model model = new Model();
        model.id = 1001;
        model.name = "wenshao";
        
        String text = JSON.toJSONString(model, SerializerFeature.WriteNonStringValueAsString);

            

Reported by PMD.

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

Line: 21

                      Assert.assertEquals("{\"id\":\"1001\",\"name\":\"wenshao\"}", text);
    }

    public static class Model {

        private int    id;
        private String name;

        public int getId() {

            

Reported by PMD.

src/test/java/com/alibaba/json/test/vans/VansObjectChildren.java
2 issues
Classes implementing Serializable should set a serialVersionUID
Error

Line: 12

               * Created by xiaolin_kxl on 17/1/5.
 */
@JSONType(orders = {"name","uuid","matrix","visible","type","children","castShadow","receiveShadow","geometry"})
public class VansObjectChildren implements Serializable{
    public String name;
    public String uuid;
    public String type;
    public boolean visible;
    public String geometry;

            

Reported by PMD.

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

Line: 21

                  public boolean castShadow;
    public boolean receiveShadow;
    public float[] matrix;
    public ArrayList<VansObjectChildren> children;
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_char_public.java
2 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

              import com.alibaba.fastjson.serializer.SerializerFeature;

public class WriteAsArray_char_public extends TestCase {
    public void test_0 () throws Exception {
        VO vo = new VO();
        vo.setId('x');
        vo.setName("wenshao");
        
        String text = JSON.toJSONString(vo, SerializerFeature.BeanToArray);

            

Reported by PMD.

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

Line: 20

                      Assert.assertEquals("[\"x\",\"wenshao\"]", text);
    }
    
    public static class VO {
        private char id;
        private String name;

        public char getId() {
            return id;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_float_public.java
2 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

              import com.alibaba.fastjson.serializer.SerializerFeature;

public class WriteAsArray_float_public extends TestCase {
    public void test_0 () throws Exception {
        VO vo = new VO();
        vo.setId(123F);
        vo.setName("wenshao");
        
        String text = JSON.toJSONString(vo, SerializerFeature.BeanToArray);

            

Reported by PMD.

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

Line: 20

                      Assert.assertEquals("[123.0,\"wenshao\"]", text);
    }
    
    public static class VO {
        private float id;
        private String name;

        public float getId() {
            return id;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_long_private.java
2 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

              import com.alibaba.fastjson.serializer.SerializerFeature;

public class WriteAsArray_long_private extends TestCase {
    public void test_0 () throws Exception {
        VO vo = new VO();
        vo.setId(123);
        vo.setName("wenshao");
        
        String text = JSON.toJSONString(vo, SerializerFeature.BeanToArray);

            

Reported by PMD.

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

Line: 20

                      Assert.assertEquals("[123,\"wenshao\"]", text);
    }
    
    private static class VO {
        private long id;
        private String name;

        public long getId() {
            return id;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvtVO/AuditStatusType.java
2 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 32

              
        for(int i$ = 0; i$ < len$; ++i$) {
            AuditStatusType temp = arr$[i$];
            if(temp.getEnCode().equals(enCode)) {
                return temp;
            }
        }

        return null;

            

Reported by PMD.

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

Line: 32

              
        for(int i$ = 0; i$ < len$; ++i$) {
            AuditStatusType temp = arr$[i$];
            if(temp.getEnCode().equals(enCode)) {
                return temp;
            }
        }

        return null;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvtVO/ContactTemplateParam.java
2 issues
Avoid unused imports such as 'java.util.Date'
Design

Line: 4

              package com.alibaba.json.bvtVO;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.alibaba.fastjson.annotation.JSONField;


            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.annotation.JSONField'
Design

Line: 8

              
import org.apache.commons.lang.builder.ToStringBuilder;

import com.alibaba.fastjson.annotation.JSONField;


public class ContactTemplateParam implements Serializable {

    private static final long serialVersionUID = 1L;

            

Reported by PMD.