The following issues were found

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

Line: 30

                          JSON.parseArray(json, IncomingDataPoint_ext_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_ext_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_ext_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_double'
Design

Line: 4

              package com.alibaba.json.test.a;

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

import java.io.File;


            

Reported by PMD.

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

Line: 26

              //        book.setMetadata(null);
        
        String str = JSON.toJSONString(book);
        System.out.println(str);
        
        JSON.parseObject(str, EpubViewBook.class);
    }
}

            

Reported by PMD.

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

Line: 11

              import com.alibaba.fastjson.JSON;

public class TestKlutz3 extends TestCase {
    public void test_0 () throws Exception {
        EpubViewBook book = new EpubViewBook();
        book.setBookName("xx");
        
        book.setPageList(new ArrayList<EpubViewPage>());
        

            

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

              import com.alibaba.fastjson.JSON;

public class TestKlutz3 extends TestCase {
    public void test_0 () throws Exception {
        EpubViewBook book = new EpubViewBook();
        book.setBookName("xx");
        
        book.setPageList(new ArrayList<EpubViewPage>());
        

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 18

                      book.setPageList(new ArrayList<EpubViewPage>());
        
        EpubViewPage page = new EpubViewPage();
        book.getPageList().add(page);
        
        EpubViewMetaData metadata = new EpubViewMetaData();
        metadata.setProperties(new HashMap<String, String>());
        
//        book.setMetadata(null);

            

Reported by PMD.

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

Line: 35

                          JSON.parseObject(json, Model.class, Feature.SupportArrayToBean);
        }
        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: 44

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

    public static class Model {
        public Integer v1;
        public Integer 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: 9

              /**
 * Created by wenshao on 04/08/2017.
 */
public class IntBenchmark_arrayMapping_obj {
    static String json = "[-1224609302,379420556,-1098099527,-2018662,422842162]";
    static String json2 = "[\"-1224609302\",\"379420556\",\"-1098099527\",\"-2018662\",\"422842162\"]";

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

                  static String json = "[-1224609302,379420556,-1098099527,-2018662,422842162]";
    static String json2 = "[\"-1224609302\",\"379420556\",\"-1098099527\",\"-2018662\",\"422842162\"]";

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

            

Reported by PMD.

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

Line: 25

                      x.setImageUrl("xxx");
        
        String str = JSON.toJSONString(x);
        System.out.println(str);
        
        JSON.parseObject(str, EpubViewPage.class);
    }
}

            

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

              //        JSON.parseObject(str, EpubViewMetaData.class);
//    }
    
    public void test_page () throws Exception {
        EpubViewPage x = new EpubViewPage();
        x.setImageUrl("xxx");
        
        String str = JSON.toJSONString(x);
        System.out.println(str);

            

Reported by PMD.

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

Line: 20

              //        JSON.parseObject(str, EpubViewMetaData.class);
//    }
    
    public void test_page () throws Exception {
        EpubViewPage x = new EpubViewPage();
        x.setImageUrl("xxx");
        
        String str = JSON.toJSONString(x);
        System.out.println(str);

            

Reported by PMD.

Avoid unused imports such as 'java.util.HashMap'
Design

Line: 3

              package com.alibaba.json.test.epubview;

import java.util.HashMap;

import junit.framework.TestCase;

import com.alibaba.fastjson.JSON;

public class TestKlutz2 extends TestCase {

            

Reported by PMD.

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

Line: 18

              
        generator.gen();

        System.out.println(out.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: 12

              
public class MediaContentGenTest extends TestCase {

    public void test_codegen() throws Exception {
        StringBuffer out = new StringBuffer();
        DeserializerGen generator = new DeserializerGen(MediaContent.class, out);

        generator.gen();


            

Reported by PMD.

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

Line: 12

              
public class MediaContentGenTest extends TestCase {

    public void test_codegen() throws Exception {
        StringBuffer out = new StringBuffer();
        DeserializerGen generator = new DeserializerGen(MediaContent.class, out);

        generator.gen();


            

Reported by PMD.

Avoid unused imports such as 'data.media.Image'
Design

Line: 7

              
import com.alibaba.fastjson.codegen.DeserializerGen;

import data.media.Image;
import data.media.MediaContent;

public class MediaContentGenTest extends TestCase {

    public void test_codegen() throws Exception {

            

Reported by PMD.

src/test/java/com/alibaba/json/test/benchmark/entity/Entity100Int.java
4 issues
This class has a bunch of public methods and attributes
Design

Line: 1

              package com.alibaba.json.test.benchmark.entity;

public class Entity100Int {

    private int f0  = 0;
    private int f1  = 1;
    private int f2  = 2;
    private int f3  = 3;
    private int f4  = 4;

            

Reported by PMD.

Too many fields
Design

Line: 3

              package com.alibaba.json.test.benchmark.entity;

public class Entity100Int {

    private int f0  = 0;
    private int f1  = 1;
    private int f2  = 2;
    private int f3  = 3;
    private int f4  = 4;

            

Reported by PMD.

The class 'Entity100Int' has a total cyclomatic complexity of 200 (highest 1).
Design

Line: 3

              package com.alibaba.json.test.benchmark.entity;

public class Entity100Int {

    private int f0  = 0;
    private int f1  = 1;
    private int f2  = 2;
    private int f3  = 3;
    private int f4  = 4;

            

Reported by PMD.

Avoid using redundant field initializer for 'f0'
Performance

Line: 5

              
public class Entity100Int {

    private int f0  = 0;
    private int f1  = 1;
    private int f2  = 2;
    private int f3  = 3;
    private int f4  = 4;
    private int f5  = 5;

            

Reported by PMD.

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

Line: 24

              
        Page<Bean> jsonPage = JSON.parseObject(json, new TypeReference<Page<Bean>>() {
        });
        System.out.println(jsonPage.getItems().get(0).getName());
    }
}

            

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

              import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

public class Main {
    public static void main(String[] args) {
        Page<Bean> page = new Page<Bean>();
        page.setCount(1);
        List<Bean> items = new ArrayList<Bean>();
        Bean item = new Bean();

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 24

              
        Page<Bean> jsonPage = JSON.parseObject(json, new TypeReference<Page<Bean>>() {
        });
        System.out.println(jsonPage.getItems().get(0).getName());
    }
}

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 24

              
        Page<Bean> jsonPage = JSON.parseObject(json, new TypeReference<Page<Bean>>() {
        });
        System.out.println(jsonPage.getItems().get(0).getName());
    }
}

            

Reported by PMD.

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

Line: 9

              
public class TestChineseQuote extends TestCase {

    public void test_chinese_quote() throws Exception {
        String text = "{\"name\":“tiny.luo”,\"school\":\"\"}";

        Gson gson = new Gson();
        User user = gson.fromJson(text, User.class);
        

            

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 TestChineseQuote extends TestCase {

    public void test_chinese_quote() throws Exception {
        String text = "{\"name\":“tiny.luo”,\"school\":\"\"}";

        Gson gson = new Gson();
        User user = gson.fromJson(text, User.class);
        

            

Reported by PMD.

Avoid unused local variables such as 'user'.
Design

Line: 13

                      String text = "{\"name\":“tiny.luo”,\"school\":\"\"}";

        Gson gson = new Gson();
        User user = gson.fromJson(text, User.class);
        
    }

    public static class User {


            

Reported by PMD.

Found 'DU'-anomaly for variable 'user' (lines '13'-'15').
Error

Line: 13

                      String text = "{\"name\":“tiny.luo”,\"school\":\"\"}";

        Gson gson = new Gson();
        User user = gson.fromJson(text, User.class);
        
    }

    public static class User {


            

Reported by PMD.

src/test/java/com/alibaba/json/demo/hibernate/data/OrderDetail.java
4 issues
Do not use the short type
Performance

Line: 29

                   private Product product;
     private Integer quantityOrdered;
     private double priceEach;
     private short orderLineNumber;

    public OrderDetail() {
    }

    public OrderDetail(OrderDetailId id, Order order, Product product, Integer quantityOrdered, double priceEach, short orderLineNumber) {

            

Reported by PMD.

Do not use the short type
Performance

Line: 95

                  }
    
    @Column(name="orderLineNumber", nullable=false)
    public short getOrderLineNumber() {
        return this.orderLineNumber;
    }
    
    public void setOrderLineNumber(short orderLineNumber) {
        this.orderLineNumber = orderLineNumber;

            

Reported by PMD.

Do not use the short type
Performance

Line: 99

                      return this.orderLineNumber;
    }
    
    public void setOrderLineNumber(short orderLineNumber) {
        this.orderLineNumber = orderLineNumber;
    }




            

Reported by PMD.

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

Line: 21

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


     private OrderDetailId id;
     private Order order;
     private Product product;

            

Reported by PMD.

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

Line: 34

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

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

    public static class Model {
        public Integer v1;
        public Integer 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: 8

              /**
 * Created by wenshao on 04/08/2017.
 */
public class IntBenchmark_obj {
    static String json = "{\"v1\":-1224609302,\"v2\":379420556,\"v3\":-1098099527,\"v4\":-2018662,\"v5\":422842162}";
    static String json2 = "{\"v1\":\"-1224609302\",\"v2\":\"379420556\",\"v3\":\"-1098099527\",\"v4\":\"-2018662\",\"v5\":\"422842162\"}";

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

                  static String json = "{\"v1\":-1224609302,\"v2\":379420556,\"v3\":-1098099527,\"v4\":-2018662,\"v5\":422842162}";
    static String json2 = "{\"v1\":\"-1224609302\",\"v2\":\"379420556\",\"v3\":\"-1098099527\",\"v4\":\"-2018662\",\"v5\":\"422842162\"}";

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

            

Reported by PMD.