The following issues were found

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

Line: 20

                      dep.setParent(dep);        

        String text = JSON.toJSONString(dep);
        System.out.println(text);
        
        JSON.parseObject(text, Department.class);
    }

    public static class Department {

            

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

              
public class Demo2 extends TestCase {

    public void test_0() throws Exception {
        Department dep = new Department();
        dep.setId(123);
        dep.setName("一级部门");
        dep.setParent(dep);        


            

Reported by PMD.

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

Line: 13

              
public class Demo2 extends TestCase {

    public void test_0() throws Exception {
        Department dep = new Department();
        dep.setId(123);
        dep.setName("一级部门");
        dep.setParent(dep);        


            

Reported by PMD.

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

Line: 25

                      JSON.parseObject(text, Department.class);
    }

    public static class Department {
    
        private int                  id;
        private String               name;
        private Department parent;
        private transient List<Department> children = new ArrayList<Department>();

            

Reported by PMD.

src/test/java/com/alibaba/json/test/benchmark/basic/LinkedListBenchmark.java
4 issues
System.out.println is used
Design

Line: 28

                          JSON.toJSONString(obj);
        }
        long millis = System.currentTimeMillis() - start;
        System.out.println("milli : " + millis);
    }
}

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 10

              /**
 * Created by wenshao on 06/08/2017.
 */
public class LinkedListBenchmark {
    public static void main(String[] args) throws Exception {
        LinkedList linkedList = new LinkedList();
        for (int i = 0; i < 1000; ++i) {
            linkedList.add(i);
        }

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 11

               * Created by wenshao on 06/08/2017.
 */
public class LinkedListBenchmark {
    public static void main(String[] args) throws Exception {
        LinkedList linkedList = new LinkedList();
        for (int i = 0; i < 1000; ++i) {
            linkedList.add(i);
        }


            

Reported by PMD.

Found 'DU'-anomaly for variable 'linkedList' (lines '12'-'20').
Error

Line: 12

               */
public class LinkedListBenchmark {
    public static void main(String[] args) throws Exception {
        LinkedList linkedList = new LinkedList();
        for (int i = 0; i < 1000; ++i) {
            linkedList.add(i);
        }

        for (int i = 0; i < 10; i++) {

            

Reported by PMD.

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

Line: 30

                          JSON.parseArray(json, IncomingDataPoint_double.class);
        }
        long millis = System.currentTimeMillis() - start;
        System.out.println("IncomingDataPoint_double millis : " + millis);
    }
}

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 13

              /**
 * Created by wenshao on 04/08/2017.
 */
public class IncomingDataPointBenchmark_file_double {
    static String json;

    public static void main(String[] args) throws Exception {
        File file = new File("/Users/wenshao/Downloads/datalist_double");
        json = FileUtils.readFileToString(file);

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 16

              public class IncomingDataPointBenchmark_file_double {
    static String json;

    public static void main(String[] args) throws Exception {
        File file = new File("/Users/wenshao/Downloads/datalist_double");
        json = FileUtils.readFileToString(file);
        for (int i = 0; i < 10; ++i) {
            perf();
        }

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.json.bvtVO.IncomingDataPoint'
Design

Line: 4

              package com.alibaba.json.test.a;

import com.alibaba.fastjson.JSON;
import com.alibaba.json.bvtVO.IncomingDataPoint;
import com.alibaba.json.bvtVO.IncomingDataPoint_double;
import org.apache.commons.io.FileUtils;

import java.io.File;


            

Reported by PMD.

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

Line: 30

                          JSON.parseArray(json, IncomingDataPoint.class);
        }
        long millis = System.currentTimeMillis() - start;
        System.out.println("IncomingDataPoint millis : " + millis);
    }
}

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 13

              /**
 * Created by wenshao on 04/08/2017.
 */
public class IncomingDataPointBenchmark_file {
    static String json;

    public static void main(String[] args) throws Exception {
        File file = new File("/Users/wenshao/Downloads/datalist");
        json = FileUtils.readFileToString(file);

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 16

              public class IncomingDataPointBenchmark_file {
    static String json;

    public static void main(String[] args) throws Exception {
        File file = new File("/Users/wenshao/Downloads/datalist");
        json = FileUtils.readFileToString(file);
        for (int i = 0; i < 10; ++i) {
            perf();
        }

            

Reported by PMD.

Avoid unused imports such as 'org.apache.commons.io.IOUtils'
Design

Line: 6

              import com.alibaba.fastjson.JSON;
import com.alibaba.json.bvtVO.IncomingDataPoint;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;

import java.io.File;

/**
 * Created by wenshao on 04/08/2017.

            

Reported by PMD.

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

              
public class WriteAsArray_string_special_2 extends TestCase {

    public void test_0() throws Exception {
        Model model2 = JSON.parseObject("[\"abc\\0\\1\\2\\3\\4\\5\\6\\7\\b\\t\\n\\v\\f\\F\\r\\'\\/\\xFF\\u000B\"]",
                                        Model.class, Feature.SupportArrayToBean);
        Assert.assertEquals("abc\0\1\2\3\4\5\6\7\b\t\n\u000B\f\f\r'/\u00FF\u000B", model2.name);
    }


            

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

                      Assert.assertEquals("abc\0\1\2\3\4\5\6\7\b\t\n\u000B\f\f\r'/\u00FF\u000B", model2.name);
    }

    public void test_error() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("[\"abc\\k\"]", Model.class, Feature.SupportArrayToBean);
        } catch (JSONException ex) {
            error = ex;

            

Reported by PMD.

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

Line: 31

              
    public static class Model {

        public String name;

    }
}

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '20'-'24').
Error

Line: 20

                  }

    public void test_error() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("[\"abc\\k\"]", Model.class, Feature.SupportArrayToBean);
        } catch (JSONException ex) {
            error = ex;
        }

            

Reported by PMD.

src/test/java/com/alibaba/json/test/benchmark/basic/BigIntegerBenchmark.java
4 issues
System.out.println is used
Design

Line: 36

                          JSON.parseObject(json, Model.class);
        }
        long millis = System.currentTimeMillis() - start;
        System.out.println("millis : " + millis);
    }

    public static void perf2() {
        long start = System.currentTimeMillis();
        for (int i = 0; i < 1000 * 1000 * 10; ++i) {

            

Reported by PMD.

System.out.println is used
Design

Line: 45

                          JSON.parseObject(json2, Model.class);
        }
        long millis = System.currentTimeMillis() - start;
        System.out.println("millis : " + millis);
    }

    public static class Model {
        public BigInteger v1;
        public BigInteger v2;

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 10

              /**
 * Created by wenshao on 04/08/2017.
 */
public class BigIntegerBenchmark {
    static String json = "{\"v1\":-1883391953414482124,\"v2\":-3019416596934963650,\"v3\":6497525620823745793,\"v4\":2136224289077142499,\"v5\":-2090575024006307745}";
    static String json2 = "{\"v1\":\"-1883391953414482124\",\"v2\":\"-3019416596934963650\",\"v3\":\"6497525620823745793\",\"v4\":\"2136224289077142499\",\"v5\":\"-2090575024006307745\"}";

    public static void main(String[] args) throws Exception {
//        Model model = new Model();

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 14

                  static String json = "{\"v1\":-1883391953414482124,\"v2\":-3019416596934963650,\"v3\":6497525620823745793,\"v4\":2136224289077142499,\"v5\":-2090575024006307745}";
    static String json2 = "{\"v1\":\"-1883391953414482124\",\"v2\":\"-3019416596934963650\",\"v3\":\"6497525620823745793\",\"v4\":\"2136224289077142499\",\"v5\":\"-2090575024006307745\"}";

    public static void main(String[] args) throws Exception {
//        Model model = new Model();
//        model.v1 = new Random().nextLong();
//        model.v2 = new Random().nextLong();
//        model.v3 = new Random().nextLong();
//        model.v4 = new Random().nextLong();

            

Reported by PMD.

src/test/java/com/alibaba/json/test/benchmark/decode/EishayDecodeByClassName.java
4 issues
Avoid throwing raw exception types.
Design

Line: 30

                  public void execute(Codec codec) throws Exception {
        MediaContent content = codec.decodeObject(text, MediaContent.class);
        if (content == null) {
            throw new Exception();
        }
    }

}

            

Reported by PMD.

System.out.println is used
Design

Line: 19

              
        text = JSON.toJSONString(EishayDecodeBytes.instance.getContent(), SerializerFeature.WriteEnumUsingToString,
                                 SerializerFeature.SortField, SerializerFeature.WriteClassName);
        System.out.println(text);
        System.out.println();

        // JavaBeanMapping.getGlobalInstance().putDeserializer(Image.class, new ImageDeserializer());
        // JavaBeanMapping.getGlobalInstance().putDeserializer(Media.class, new MediaDeserializer());
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 20

                      text = JSON.toJSONString(EishayDecodeBytes.instance.getContent(), SerializerFeature.WriteEnumUsingToString,
                                 SerializerFeature.SortField, SerializerFeature.WriteClassName);
        System.out.println(text);
        System.out.println();

        // JavaBeanMapping.getGlobalInstance().putDeserializer(Image.class, new ImageDeserializer());
        // JavaBeanMapping.getGlobalInstance().putDeserializer(Media.class, new MediaDeserializer());
    }


            

Reported by PMD.

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

Line: 12

              
public class EishayDecodeByClassName extends BenchmarkCase {

    private final String text;

    public EishayDecodeByClassName(){
        super("EishayDecode");

        text = JSON.toJSONString(EishayDecodeBytes.instance.getContent(), SerializerFeature.WriteEnumUsingToString,

            

Reported by PMD.

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

              
public class WriteAsArray_enum_public extends TestCase {

    public void test_0() throws Exception {
        VO vo = new VO();
        vo.setId(Type.AA);
        vo.setName("wenshao");

        String text = JSON.toJSONString(vo, SerializerFeature.BeanToArray);

            

Reported by PMD.

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

Line: 21

                      String text = JSON.toJSONString(vo, SerializerFeature.BeanToArray);
        Assert.assertEquals("[\"AA\",\"wenshao\"]", text);
        VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
        Assert.assertEquals(vo.getId(), vo2.getId());
        Assert.assertEquals(vo.getName(), vo2.getName());
    }

    public static class VO {


            

Reported by PMD.

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

Line: 22

                      Assert.assertEquals("[\"AA\",\"wenshao\"]", text);
        VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
        Assert.assertEquals(vo.getId(), vo2.getId());
        Assert.assertEquals(vo.getName(), vo2.getName());
    }

    public static class VO {

        private Type   id;

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals(vo.getName(), vo2.getName());
    }

    public static class VO {

        private Type   id;
        private String name;

        public Type getId() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvtVO/ArgCheckTest.java
4 issues
JUnit tests should include assert() or fail()
Design

Line: 10

              public class ArgCheckTest {

    @Test
    public void testJSON() {
        TestDTO dto = new TestDTO();
        dto.setChannel("channel");
        TestDTO[] dtos = new TestDTO[2];
        dtos[0] = dto;
        dtos[1] = dto;

            

Reported by PMD.

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

Line: 19

                      JSON.toJSONString(dtos);
    }

    public static class TestDTO {

        private String       channel;
        private String       txCode;



            

Reported by PMD.

Found 'DD'-anomaly for variable 'dtos' (lines '13'-'14').
Error

Line: 13

                  public void testJSON() {
        TestDTO dto = new TestDTO();
        dto.setChannel("channel");
        TestDTO[] dtos = new TestDTO[2];
        dtos[0] = dto;
        dtos[1] = dto;
        JSON.toJSONString(dtos);
    }


            

Reported by PMD.

Found 'DD'-anomaly for variable 'dtos' (lines '14'-'15').
Error

Line: 14

                      TestDTO dto = new TestDTO();
        dto.setChannel("channel");
        TestDTO[] dtos = new TestDTO[2];
        dtos[0] = dto;
        dtos[1] = dto;
        JSON.toJSONString(dtos);
    }

    public static class TestDTO {

            

Reported by PMD.

src/test/java/com/alibaba/json/demo/hibernate/data/Customer.java
4 issues
The class 'Customer' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=30, WMC=33)
Design

Line: 12

              
@Entity
@Table(name="Customer", catalog="classicmodels")
public class Customer implements java.io.Serializable
{
    private static final long serialVersionUID = 1L;

    private Integer customerNumber;
    private Employee employee;

            

Reported by PMD.

Avoid long parameter lists.
Design

Line: 44

                      this.country = country;
    }

    public Customer(Employee employee, String customerName, String contactLastName, String contactFirstName, String phone, String addressLine1, String addressLine2, String city, String state, String postalCode, String country, Double creditLimit, Set<Payment> payments, Set<Order> orders) {
       this.employee = employee;
       this.customerName = customerName;
       this.contactLastName = contactLastName;
       this.contactFirstName = contactFirstName;
       this.phone = phone;

            

Reported by PMD.

Avoid unused imports such as 'javax.persistence'
Design

Line: 5

              
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import static javax.persistence.GenerationType.IDENTITY;

import com.fasterxml.jackson.annotation.*;

@Entity

            

Reported by PMD.

Avoid unused imports such as 'com.fasterxml.jackson.annotation'
Design

Line: 8

              import javax.persistence.*;
import static javax.persistence.GenerationType.IDENTITY;

import com.fasterxml.jackson.annotation.*;

@Entity
@Table(name="Customer", catalog="classicmodels")
public class Customer implements java.io.Serializable
{

            

Reported by PMD.