The following issues were found

src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectO1_A.java
2 issues
Classes implementing Serializable should set a serialVersionUID
Error

Line: 8

              import java.io.Serializable;


public class ObjectO1_A implements Serializable {
	
	int a;
	
	int b;
	

            

Reported by PMD.

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

Line: 8

              import java.io.Serializable;


public class ObjectO1_A implements Serializable {
	
	int a;
	
	int b;
	

            

Reported by PMD.

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

Line: 5

              
import java.util.List;

public class ObjectD {
	
	private int a;

	
	private int b;

            

Reported by PMD.

Too many fields
Design

Line: 5

              
import java.util.List;

public class ObjectD {
	
	private int a;

	
	private int b;

            

Reported by PMD.

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

Line: 20

                      map.put(2, "b");
        
        String text = JSON.toJSONString(map);
        System.out.println(text);
        
        Map<Integer, Object> map2 = JSON.parseObject(text, new TypeReference<Map<Integer, Object>>() {});
        Assert.assertEquals(map, map2);
    }
}

            

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

              
public class SpecialKeyTest extends TestCase {

    public void test_0() throws Exception {
        Map<Integer, Object> map = new HashMap<Integer, Object>();
        map.put(1, "a");
        map.put(2, "b");
        
        String text = JSON.toJSONString(map);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug_for_liqing.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: 8

              import junit.framework.TestCase;

public class Bug_for_liqing extends TestCase {
    public void test_for_issue() throws Exception {
        ParserConfig config = new ParserConfig();
        config.setAutoTypeSupport(true);
        String json = "{\"@type\":\"java.util.HashMap\",\"wcChangeAttr\":{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_liqing.TpFeedBackDO\",\"attributes\":{\"@type\":\"java.util.concurrent.ConcurrentHashMap\"},\"wcStatus\":102B}}";
        JSON.parse(json, config);
    }

            

Reported by PMD.

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

Line: 8

              import junit.framework.TestCase;

public class Bug_for_liqing extends TestCase {
    public void test_for_issue() throws Exception {
        ParserConfig config = new ParserConfig();
        config.setAutoTypeSupport(true);
        String json = "{\"@type\":\"java.util.HashMap\",\"wcChangeAttr\":{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_liqing.TpFeedBackDO\",\"attributes\":{\"@type\":\"java.util.concurrent.ConcurrentHashMap\"},\"wcStatus\":102B}}";
        JSON.parse(json, config);
    }

            

Reported by PMD.

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

              import com.alibaba.fastjson.JSONObject;

public class SlashTest extends TestCase {
    public void test_0 () throws Exception {
        String text = "{\"errorMessage\":\"resource '/rpc/hello/none.json' is not found !\"}";
        JSONObject json = (JSONObject) JSON.parse(text);
        
        Assert.assertEquals("{\"errorMessage\":\"resource '/rpc/hello/none.json' is not found !\"}", json.toString());
    }

            

Reported by PMD.

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

Line: 14

                      String text = "{\"errorMessage\":\"resource '/rpc/hello/none.json' is not found !\"}";
        JSONObject json = (JSONObject) JSON.parse(text);
        
        Assert.assertEquals("{\"errorMessage\":\"resource '/rpc/hello/none.json' is not found !\"}", json.toString());
    }
}

            

Reported by PMD.

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

Line: 3

              package com.alibaba.fastjson.deserializer.issues3796.bean;

public class ObjectC {
	
	private int a;
	
	private int b = 0;
	
	private long c;

            

Reported by PMD.

Avoid using redundant field initializer for 'b'
Performance

Line: 7

              	
	private int a;
	
	private int b = 0;
	
	private long c;
	
	private int d;


            

Reported by PMD.

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

Line: 9

              import java.util.List;


public class ObjectQ {
	
	private int a;
	
	private int b;
	

            

Reported by PMD.

Avoid using redundant field initializer for 'c'
Performance

Line: 15

              	
	private int b;
	
	private boolean c = false;
	
	private List<CommonObject> d;

	public int getA() {
		return a;

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/serializer/SimpleDateFormatSerializer.java
2 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 10

              
public class SimpleDateFormatSerializer implements ObjectSerializer {

    private final String pattern;

    public SimpleDateFormatSerializer(String pattern){
        this.pattern = pattern;
    }


            

Reported by PMD.

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

Line: 18

              
    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
    	if (object == null) {
    		serializer.out.writeNull();
    		return;
    	}
    	
        Date date = (Date) object;
        SimpleDateFormat format = new SimpleDateFormat(pattern, serializer.locale);

            

Reported by PMD.

src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectQ1.java
2 issues
Too many fields
Design

Line: 8

              import java.util.List;


public class ObjectQ1 {
	
	private int a;

	
	private int b;

            

Reported by PMD.

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

Line: 8

              import java.util.List;


public class ObjectQ1 {
	
	private int a;

	
	private int b;

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/parser/deserializer/EnumCreatorDeserializer.java
2 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 11

              import java.lang.reflect.Type;

public class EnumCreatorDeserializer implements ObjectDeserializer {
    private final Method creator;
    private final Class paramType;

    public EnumCreatorDeserializer(Method creator) {
        this.creator = creator;
        paramType = creator.getParameterTypes()[0];

            

Reported by PMD.

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

Line: 12

              
public class EnumCreatorDeserializer implements ObjectDeserializer {
    private final Method creator;
    private final Class paramType;

    public EnumCreatorDeserializer(Method creator) {
        this.creator = creator;
        paramType = creator.getParameterTypes()[0];
    }

            

Reported by PMD.