The following issues were found

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

Line: 13

                  public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
        if (object == null) {
            SerializeWriter out = serializer.out;
            out.writeNull(SerializerFeature.WriteNullStringAsEmpty);
            return;
        }

        serializer.write(object.toString());
    }

            

Reported by PMD.

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

Line: 7

              import java.util.List;


public class ObjectG2 {
	
	private int a;

	
	private boolean b = true;

            

Reported by PMD.

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

    public void test_for_issue() throws Exception {
        String text = "{1:{\"donateLevel\":0,\"goodsInfoInRoomMap\":{102:2160,103:0},\"goodsInfoMap\":null,\"headPhoto\":null,\"headPhotoId\":0,\"id\":-569,\"nickName\":\"啤酒兑咖啡的苦涩\",\"sex\":1,\"vipLevel\":0},2:{\"donateLevel\":0,\"goodsInfoInRoomMap\":{102:11000,103:0},\"goodsInfoMap\":null,\"headPhoto\":null,\"headPhotoId\":1,\"id\":18315,\"nickName\":\"游客6083\",\"sex\":1,\"vipLevel\":0},3:{\"donateLevel\":0,\"goodsInfoInRoomMap\":{102:1940,103:0},\"goodsInfoMap\":null,\"headPhoto\":null,\"headPhotoId\":0,\"id\":-887,\"nickName\":\"傻笑,那段情\",\"sex\":0,\"vipLevel\":0},5:{\"$ref\":\"$[2]\"}}";
        Map<Integer, Object> root = JSON.parseObject(text, new TypeReference<Map<Integer, Object>>() {});
        Assert.assertNotNull(root.get(5));
    }


            

Reported by PMD.

src/main/java/com/alibaba/fastjson/asm/MethodVisitor.java
1 issues
This class has too many methods, consider refactoring it.
Design

Line: 36

               * 
 * @author Eric Bruneton
 */
public interface MethodVisitor {

    // -------------------------------------------------------------------------
    // Annotations and non standard attributes
    // -------------------------------------------------------------------------


            

Reported by PMD.

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

Line: 9

              


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


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug_for_DiffType.java
1 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 junit.framework.TestCase;

public class Bug_for_DiffType extends TestCase {
    public void test_for_diff_type() throws Exception {
        Model model = new Model();
        model.setValue(1001);
        
        String text = JSON.toJSONString(model);
        Model model2 = JSON.parseObject(text, Model.class);

            

Reported by PMD.

src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectE.java
1 issues
The class 'ObjectE' is suspected to be a Data Class (WOC=5.263%, NOPA=0, NOAM=18, WMC=19)
Design

Line: 8

              


public class ObjectE {
	
	private int a;

	
	private int b;

            

Reported by PMD.

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

Line: 9

              import java.util.List;


public class ObjectM1_C {
    
    private int a;

    
    private int b;

            

Reported by PMD.

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

Line: 8

              


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

            

Reported by PMD.

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

Line: 8

              import java.util.List;


public class ObjectL2 {

	int a;

	ObjectL2_A b;


            

Reported by PMD.