The following issues were found

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

              
public class Issue101_NoneASM extends TestCase {

    public void test_for_issure() throws Exception {
        VO vo = new VO();
        vo.a = new Object();
        vo.b = vo.a;
        vo.c = vo.a;
        

            

Reported by PMD.

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

Line: 24

                  }

    @JSONType(serialzeFeatures=SerializerFeature.DisableCircularReferenceDetect)
    private static class VO {

        private Object a;
        private Object b;
        private Object c;


            

Reported by PMD.

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

              
public class Issue101_field extends TestCase {

    public void test_for_issure() throws Exception {
        VO vo = new VO();
        vo.a = new Object();
        vo.b = vo.a;
        vo.c = vo.a;
        

            

Reported by PMD.

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

Line: 23

                      Assert.assertEquals("{\"a\":{},\"b\":{},\"c\":{\"$ref\":\"$.b\"}}", text);
    }

    public static class VO {

        private Object a;
        private Object b;
        private Object c;


            

Reported by PMD.

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

              
public class Issue101_field_NoneASM extends TestCase {

    public void test_for_issure() throws Exception {
        VO vo = new VO();
        vo.a = new Object();
        vo.b = vo.a;
        vo.c = vo.a;
        

            

Reported by PMD.

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

Line: 23

                      Assert.assertEquals("{\"a\":{},\"b\":{},\"c\":{\"$ref\":\"$.b\"}}", text);
    }

    private static class VO {

        private Object a;
        private Object b;
        private Object c;


            

Reported by PMD.

src/main/java/com/alibaba/fastjson/support/spring/GenericFastJsonRedisSerializer.java
2 issues
Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 25

                      }
        try {
            return JSON.toJSONBytes(object, SerializerFeature.WriteClassName);
        } catch (Exception ex) {
            throw new SerializationException("Could not serialize: " + ex.getMessage(), ex);
        }
    }

    public Object deserialize(byte[] bytes) throws SerializationException {

            

Reported by PMD.

Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 36

                      }
        try {
            return JSON.parseObject(new String(bytes, IOUtils.UTF8), Object.class, defaultRedisConfig);
        } catch (Exception ex) {
            throw new SerializationException("Could not deserialize: " + ex.getMessage(), ex);
        }
    }
}

            

Reported by PMD.

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

Line: 6

              import junit.framework.TestCase;

public class ClassReaderTest extends TestCase {
    public void test_read() throws Exception {

    }
}

            

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

              import junit.framework.TestCase;

public class ClassReaderTest extends TestCase {
    public void test_read() throws Exception {

    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/annotation/SerializeUsingTest.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: 19

              
public class SerializeUsingTest extends TestCase {

    public void test_annotation() throws Exception {
        Model model = new Model();
        model.value = 100;
        String json = JSON.toJSONString(model);
        Assert.assertEquals("{\"value\":\"100元\"}", json);
        

            

Reported by PMD.

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

Line: 32

                  public static class Model {

        @JSONField(serializeUsing = ModelValueSerializer.class, deserializeUsing = ModelValueDeserializer.class)
        public int value;
    }

    public static class ModelValueSerializer implements ObjectSerializer {

        public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType,

            

Reported by PMD.

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

               * Created by wenshao on 16/03/2017.
 */
public class Issue1075 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{ \"question\": \"1+1=?\\u1505a\"}";
        JSON.parseObject(json);
    }
}

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 16/03/2017.
 */
public class Issue1075 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{ \"question\": \"1+1=?\\u1505a\"}";
        JSON.parseObject(json);
    }
}

            

Reported by PMD.

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

Line: 9

              

public class Issue94 extends TestCase {
    public void test_for_issue() throws Exception {
        JSONObject o = new JSONObject();
        o.put("line", "{\"1\":\u0080}");
        o.toString();
    }
}

            

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 Issue94 extends TestCase {
    public void test_for_issue() throws Exception {
        JSONObject o = new JSONObject();
        o.put("line", "{\"1\":\u0080}");
        o.toString();
    }
}

            

Reported by PMD.

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

Line: 9

              import java.util.List;


public class ObjectW1 {

    
    private int a;

    

            

Reported by PMD.

Avoid using redundant field initializer for 'f'
Performance

Line: 27

                  private List<CommonObject> e;

    
    private int f = 0;

    public int getA() {
        return a;
    }


            

Reported by PMD.

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

              

public class Issue118 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = JSON.toJSONString("\0");
        assertEquals("\"\\u0000\"", json);
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 11

              public class Issue118 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = JSON.toJSONString("\0");
        assertEquals("\"\\u0000\"", json);
    }
}

            

Reported by PMD.