The following issues were found

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

Line: 9

              
public class TestDouble extends TestCase {

    public void test_doubleArray_2() throws Exception {
        double[] array = new double[] { 1, 2 };
        A a = new A();
        a.setValue(array);

        String text = JSON.toJSONString(a);

            

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

    public void test_doubleArray_2() throws Exception {
        double[] array = new double[] { 1, 2 };
        A a = new A();
        a.setValue(array);

        String text = JSON.toJSONString(a);

            

Reported by PMD.

Avoid unused local variables such as 'a1'.
Design

Line: 15

                      a.setValue(array);

        String text = JSON.toJSONString(a);
        A a1 = JSON.parseObject(text, A.class);
    }

    public static class A {

        private double[] value;

            

Reported by PMD.

Returning 'value' may expose an internal array.
Design

Line: 23

                      private double[] value;

        public double[] getValue() {
            return value;
        }

        public void setValue(double[] value) {
            this.value = value;
        }

            

Reported by PMD.

The user-supplied array 'value' is stored directly.
Design

Line: 26

                          return value;
        }

        public void setValue(double[] value) {
            this.value = value;
        }
    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 26

                          return value;
        }

        public void setValue(double[] value) {
            this.value = value;
        }
    }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'a1' (lines '15'-'16').
Error

Line: 15

                      a.setValue(array);

        String text = JSON.toJSONString(a);
        A a1 = JSON.parseObject(text, A.class);
    }

    public static class A {

        private double[] value;

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/support/spring/JSONPResponseBodyAdvice.java
7 issues
Logger should be defined private static final and have the correct class
Error

Line: 42

              @ControllerAdvice
public class JSONPResponseBodyAdvice implements ResponseBodyAdvice<Object> {

    public final Log logger = LogFactory.getLog(this.getClass());

    public JSONPResponseBodyAdvice() {
    }



            

Reported by PMD.

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

Line: 42

              @ControllerAdvice
public class JSONPResponseBodyAdvice implements ResponseBodyAdvice<Object> {

    public final Log logger = LogFactory.getLog(this.getClass());

    public JSONPResponseBodyAdvice() {
    }



            

Reported by PMD.

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

Line: 53

              
        return FastJsonHttpMessageConverter.class.isAssignableFrom(converterType)
                &&
                (returnType.getContainingClass().isAnnotationPresent(ResponseJSONP.class) || returnType.hasMethodAnnotation(ResponseJSONP.class));
    }

    public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
                                  Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request,
                                  ServerHttpResponse response) {

            

Reported by PMD.

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

Line: 62

              
        ResponseJSONP responseJsonp = returnType.getMethodAnnotation(ResponseJSONP.class);
        if(responseJsonp == null){
            responseJsonp = returnType.getContainingClass().getAnnotation(ResponseJSONP.class);
        }

        HttpServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest();
        String callbackMethodName = servletRequest.getParameter(responseJsonp.callback());


            

Reported by PMD.

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

Line: 66

                      }

        HttpServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest();
        String callbackMethodName = servletRequest.getParameter(responseJsonp.callback());

        if (!IOUtils.isValidJsonpQueryParam(callbackMethodName)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Invalid jsonp parameter value:" + callbackMethodName);
            }

            

Reported by PMD.

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

Line: 66

                      }

        HttpServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest();
        String callbackMethodName = servletRequest.getParameter(responseJsonp.callback());

        if (!IOUtils.isValidJsonpQueryParam(callbackMethodName)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Invalid jsonp parameter value:" + callbackMethodName);
            }

            

Reported by PMD.

Assigning an Object to null is a code smell. Consider refactoring.
Error

Line: 72

                          if (logger.isDebugEnabled()) {
                logger.debug("Invalid jsonp parameter value:" + callbackMethodName);
            }
            callbackMethodName = null;
        }

        JSONPObject jsonpObject = new JSONPObject(callbackMethodName);
        jsonpObject.addParameter(body);
        beforeBodyWriteInternal(jsonpObject, selectedContentType, returnType, request, response);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug13.java
7 issues
System.out.println is used
Design

Line: 15

                  public void test_0() throws Exception {
        User user = new User("name1", "11");  
        String object = JSON.toJSONString(user);  
        System.out.println(object);  
        user = JSON.parseObject(object, User.class);//报错  
    }
    
    public static class User {  
        public User() {  

            

Reported by PMD.

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

Line: 12

              

public class Bug13 extends TestCase {
    public void test_0() throws Exception {
        User user = new User("name1", "11");  
        String object = JSON.toJSONString(user);  
        System.out.println(object);  
        user = JSON.parseObject(object, 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: 12

              

public class Bug13 extends TestCase {
    public void test_0() throws Exception {
        User user = new User("name1", "11");  
        String object = JSON.toJSONString(user);  
        System.out.println(object);  
        user = JSON.parseObject(object, User.class);//报错  
    }

            

Reported by PMD.

The value assigned to variable 'user' is never used
Design

Line: 16

                      User user = new User("name1", "11");  
        String object = JSON.toJSONString(user);  
        System.out.println(object);  
        user = JSON.parseObject(object, User.class);//报错  
    }
    
    public static class User {  
        public User() {  
        }  

            

Reported by PMD.

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

Line: 19

                      user = JSON.parseObject(object, User.class);//报错  
    }
    
    public static class User {  
        public User() {  
        }  
      
        private String name, age;  
        private List<Object> group = new ArrayList<Object>(2);  

            

Reported by PMD.

Use one line for each declaration, it enhances code readability.
Design

Line: 23

                      public User() {  
        }  
      
        private String name, age;  
        private List<Object> group = new ArrayList<Object>(2);  
      
        public List<Object> getGroup() {  
            return group;  
        }  

            

Reported by PMD.

Found 'DU'-anomaly for variable 'user' (lines '16'-'17').
Error

Line: 16

                      User user = new User("name1", "11");  
        String object = JSON.toJSONString(user);  
        System.out.println(object);  
        user = JSON.parseObject(object, User.class);//报错  
    }
    
    public static class User {  
        public User() {  
        }  

            

Reported by PMD.

src/test/java/com/alibaba/json/ByteArrayTest2.java
7 issues
System.out.println is used
Design

Line: 42

                      writer.writeObject(file);
        writer.flush();

        System.out.println(bos);

        byte[] data = bos.toByteArray();
        Charset charset = Charset.forName("UTF-8");
        CertFile convertFile =  (CertFile)JSON.parse(data, 0, data.length, charset.newDecoder(), Feature.AllowArbitraryCommas,
                Feature.IgnoreNotMatch, Feature.SortFeidFastMatch, Feature.DisableCircularReferenceDetect,

            

Reported by PMD.

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

Line: 20

              public class ByteArrayTest2  extends TestCase {

    public static class CertFile {
        public String name;
        public byte[] data;
    }

    public void test_0() throws Exception {
        ParserConfig.getGlobalInstance().setAutoTypeSupport(true);

            

Reported by PMD.

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

Line: 21

              
    public static class CertFile {
        public String name;
        public byte[] data;
    }

    public void test_0() throws Exception {
        ParserConfig.getGlobalInstance().setAutoTypeSupport(true);


            

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

                      public byte[] data;
    }

    public void test_0() throws Exception {
        ParserConfig.getGlobalInstance().setAutoTypeSupport(true);

        CertFile file = new CertFile();
        file.name = "testname";


            

Reported by PMD.

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

Line: 25

                  }

    public void test_0() throws Exception {
        ParserConfig.getGlobalInstance().setAutoTypeSupport(true);

        CertFile file = new CertFile();
        file.name = "testname";

        StringBuilder sb = new StringBuilder();

            

Reported by PMD.

Avoid appending characters as strings in StringBuffer.append.
Performance

Line: 32

              
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 2048; i++) {
            sb.append("1");
        }
        file.data = sb.toString().getBytes();

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        JSONWriter writer = new JSONWriter(new OutputStreamWriter(bos));

            

Reported by PMD.

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

Line: 46

              
        byte[] data = bos.toByteArray();
        Charset charset = Charset.forName("UTF-8");
        CertFile convertFile =  (CertFile)JSON.parse(data, 0, data.length, charset.newDecoder(), Feature.AllowArbitraryCommas,
                Feature.IgnoreNotMatch, Feature.SortFeidFastMatch, Feature.DisableCircularReferenceDetect,
                Feature.AutoCloseSource);

        Assert.assertEquals(file.name, convertFile.name);
        Assert.assertArrayEquals(file.data, convertFile.data);

            

Reported by PMD.

src/test/java/com/alibaba/json/SerializerFeatureDistinctTest.java
7 issues
System.out.println is used
Design

Line: 22

                      }
        assertEquals(masks.size(), SerializerFeature.values().length);

        System.out.println(SerializerFeature.values().length);
    }
}

            

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

               * Created by wenshao on 24/06/2017.
 */
public class SerializerFeatureDistinctTest extends TestCase {
    public void test_allfeatures() throws Exception {
        Set<Object> masks = new HashSet<Object>();
        for (SerializerFeature feature : SerializerFeature.values()) {
            Object mask = feature.getMask();
            assertFalse(masks.contains(mask));
            masks.add(mask);

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 13

               * Created by wenshao on 24/06/2017.
 */
public class SerializerFeatureDistinctTest extends TestCase {
    public void test_allfeatures() throws Exception {
        Set<Object> masks = new HashSet<Object>();
        for (SerializerFeature feature : SerializerFeature.values()) {
            Object mask = feature.getMask();
            assertFalse(masks.contains(mask));
            masks.add(mask);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      Set<Object> masks = new HashSet<Object>();
        for (SerializerFeature feature : SerializerFeature.values()) {
            Object mask = feature.getMask();
            assertFalse(masks.contains(mask));
            masks.add(mask);
        }
        assertEquals(masks.size(), SerializerFeature.values().length);

        System.out.println(SerializerFeature.values().length);

            

Reported by PMD.

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

Line: 20

                          assertFalse(masks.contains(mask));
            masks.add(mask);
        }
        assertEquals(masks.size(), SerializerFeature.values().length);

        System.out.println(SerializerFeature.values().length);
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                          assertFalse(masks.contains(mask));
            masks.add(mask);
        }
        assertEquals(masks.size(), SerializerFeature.values().length);

        System.out.println(SerializerFeature.values().length);
    }
}

            

Reported by PMD.

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

Line: 22

                      }
        assertEquals(masks.size(), SerializerFeature.values().length);

        System.out.println(SerializerFeature.values().length);
    }
}

            

Reported by PMD.

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

              import junit.framework.TestCase;

public class Bug_for_yanpei3 extends TestCase {
    public void test_for_issue() throws Exception {
        Map obj = new HashMap();
        obj.put("desc", "\"Puck\"");
        String text = JSON.toJSONString(obj);
//        System.out.println(text);
        // {"desc":"\"Puck\""}

            

Reported by PMD.

The String literal 'desc' appears 4 times in this file; the first occurrence is on line 16
Error

Line: 16

              public class Bug_for_yanpei3 extends TestCase {
    public void test_for_issue() throws Exception {
        Map obj = new HashMap();
        obj.put("desc", "\"Puck\"");
        String text = JSON.toJSONString(obj);
//        System.out.println(text);
        // {"desc":"\"Puck\""}

        Map root = new HashMap();

            

Reported by PMD.

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

Line: 28

                      // {"obj":"{\"desc\":\"\\\"Puck\\\"\"}"}

        JSONObject root2 = JSON.parseObject(text2);
        String text3 = (String) root2.get("obj");
//        System.out.println(text3);
        // {"desc":"\"Puck\""}

        JSONObject obj2 = JSON.parseObject(text3);
        String puck = (String) obj2.get("desc");

            

Reported by PMD.

Avoid unused local variables such as 'puck'.
Design

Line: 33

                      // {"desc":"\"Puck\""}

        JSONObject obj2 = JSON.parseObject(text3);
        String puck = (String) obj2.get("desc");
        Assert.assertEquals(obj.get("desc"), obj2.get("desc"));
        // "Puck"
    }
}

            

Reported by PMD.

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

Line: 33

                      // {"desc":"\"Puck\""}

        JSONObject obj2 = JSON.parseObject(text3);
        String puck = (String) obj2.get("desc");
        Assert.assertEquals(obj.get("desc"), obj2.get("desc"));
        // "Puck"
    }
}

            

Reported by PMD.

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

Line: 34

              
        JSONObject obj2 = JSON.parseObject(text3);
        String puck = (String) obj2.get("desc");
        Assert.assertEquals(obj.get("desc"), obj2.get("desc"));
        // "Puck"
    }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'puck' (lines '33'-'36').
Error

Line: 33

                      // {"desc":"\"Puck\""}

        JSONObject obj2 = JSON.parseObject(text3);
        String puck = (String) obj2.get("desc");
        Assert.assertEquals(obj.get("desc"), obj2.get("desc"));
        // "Puck"
    }
}

            

Reported by PMD.

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

Line: 29

                      money.amount = new BigDecimal("10.03");

        String json = JSON.toJSONString(money);
        System.out.println("json = " + json);

        Money moneyBack = JSON.parseObject(json, Money.class);
        System.out.println("money = " + moneyBack);

        JSONObject jsonObject = JSON.parseObject(json);

            

Reported by PMD.

System.out.println is used
Design

Line: 32

                      System.out.println("json = " + json);

        Money moneyBack = JSON.parseObject(json, Money.class);
        System.out.println("money = " + moneyBack);

        JSONObject jsonObject = JSON.parseObject(json);
        Money moneyCast = JSON.toJavaObject(jsonObject, Money.class);
        System.out.printf("money = " + moneyCast);
    }

            

Reported by PMD.

System.out.printf is used
Design

Line: 36

              
        JSONObject jsonObject = JSON.parseObject(json);
        Money moneyCast = JSON.toJavaObject(jsonObject, Money.class);
        System.out.printf("money = " + moneyCast);
    }
}

            

Reported by PMD.

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

Line: 14

              
public class CurrencyTest3 extends TestCase {
    public static class Money {
        public Currency currency;
        public BigDecimal amount;

        @Override
        public String toString() {
            return "Money{currency=" + currency + ", amount=" + amount + '}';

            

Reported by PMD.

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

Line: 15

              public class CurrencyTest3 extends TestCase {
    public static class Money {
        public Currency currency;
        public BigDecimal amount;

        @Override
        public String toString() {
            return "Money{currency=" + currency + ", amount=" + amount + '}';
        }

            

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

                      }
    }

    public void testJson() throws Exception {
        Money money = new Money();
        money.currency = Currency.getInstance("CNY");
        money.amount = new BigDecimal("10.03");

        String json = JSON.toJSONString(money);

            

Reported by PMD.

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

Line: 23

                      }
    }

    public void testJson() throws Exception {
        Money money = new Money();
        money.currency = Currency.getInstance("CNY");
        money.amount = new BigDecimal("10.03");

        String json = JSON.toJSONString(money);

            

Reported by PMD.

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

              
public class ShortArrayFieldTest_primitive extends TestCase {

    public void test_array() throws Exception {
        Assert.assertEquals("[1]", JSON.toJSONString(new short[] { 1 }));

    }

    public void test_codec_null() 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: 17

              
    }

    public void test_codec_null() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

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

Line: 28

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();


            

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

                      Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

Returning 'value' may expose an internal array.
Design

Line: 46

                      private short[] value;

        public short[] getValue() {
            return value;
        }

        public void setValue(short[] value) {
            this.value = value;
        }

            

Reported by PMD.

The user-supplied array 'value' is stored directly.
Design

Line: 49

                          return value;
        }

        public void setValue(short[] value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 49

                          return value;
        }

        public void setValue(short[] value) {
            this.value = value;
        }

    }
}

            

Reported by PMD.

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

    @SuppressWarnings("rawtypes")
    public void test_bytes() throws Exception {
        for (int i = 0; i < 10; ++i) {
            String charset = "UTF-8";
            String text = "{name:'张三', age:27}";


            

Reported by PMD.

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

Line: 19

                          String charset = "UTF-8";
            String text = "{name:'张三', age:27}";

            Map map = JSON.parseObject(text.getBytes(charset), Map.class);
            Assert.assertEquals("张三", map.get("name"));
            Assert.assertEquals(27, map.get("age"));
        }

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

            

Reported by PMD.

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

Line: 20

                          String text = "{name:'张三', age:27}";

            Map map = JSON.parseObject(text.getBytes(charset), Map.class);
            Assert.assertEquals("张三", map.get("name"));
            Assert.assertEquals(27, map.get("age"));
        }

        for (int i = 0; i < 10; ++i) {
            String charset = "UTF-8";

            

Reported by PMD.

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

Line: 21

              
            Map map = JSON.parseObject(text.getBytes(charset), Map.class);
            Assert.assertEquals("张三", map.get("name"));
            Assert.assertEquals(27, map.get("age"));
        }

        for (int i = 0; i < 10; ++i) {
            String charset = "UTF-8";
            String text = "{name:'张三', age:27}";

            

Reported by PMD.

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

Line: 28

                          String charset = "UTF-8";
            String text = "{name:'张三', age:27}";

            JSONObject map = (JSONObject) JSON.parse(text.getBytes(charset));
            Assert.assertEquals("张三", map.get("name"));
            Assert.assertEquals(27, map.get("age"));
        }
    }
}

            

Reported by PMD.

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

Line: 29

                          String text = "{name:'张三', age:27}";

            JSONObject map = (JSONObject) JSON.parse(text.getBytes(charset));
            Assert.assertEquals("张三", map.get("name"));
            Assert.assertEquals(27, map.get("age"));
        }
    }
}

            

Reported by PMD.

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

Line: 30

              
            JSONObject map = (JSONObject) JSON.parse(text.getBytes(charset));
            Assert.assertEquals("张三", map.get("name"));
            Assert.assertEquals(27, map.get("age"));
        }
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug2.java
7 issues
System.out.println is used
Design

Line: 22

              
        String jsonString = JSON.toJSONString(entity);

        System.out.println(jsonString);

        Entity entity2 = JSON.parseObject(jsonString, Entity.class);
        Assert.assertEquals(entity.getArticles().size(), entity2.getArticles().size());
    }


            

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

              
public class Bug2 extends TestCase {

    public void test_0() throws Exception {
        Entity entity = new Entity();

        entity.setArticles(Collections.singletonList(new Article()));

        String jsonString = JSON.toJSONString(entity);

            

Reported by PMD.

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

Line: 25

                      System.out.println(jsonString);

        Entity entity2 = JSON.parseObject(jsonString, Entity.class);
        Assert.assertEquals(entity.getArticles().size(), entity2.getArticles().size());
    }

    public static class Entity {

        private List<HashMap<String, String>> list     = new ArrayList<HashMap<String, String>>();

            

Reported by PMD.

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

Line: 25

                      System.out.println(jsonString);

        Entity entity2 = JSON.parseObject(jsonString, Entity.class);
        Assert.assertEquals(entity.getArticles().size(), entity2.getArticles().size());
    }

    public static class Entity {

        private List<HashMap<String, String>> list     = new ArrayList<HashMap<String, String>>();

            

Reported by PMD.

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

Line: 25

                      System.out.println(jsonString);

        Entity entity2 = JSON.parseObject(jsonString, Entity.class);
        Assert.assertEquals(entity.getArticles().size(), entity2.getArticles().size());
    }

    public static class Entity {

        private List<HashMap<String, String>> list     = new ArrayList<HashMap<String, String>>();

            

Reported by PMD.

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

Line: 28

                      Assert.assertEquals(entity.getArticles().size(), entity2.getArticles().size());
    }

    public static class Entity {

        private List<HashMap<String, String>> list     = new ArrayList<HashMap<String, String>>();
        private List<Article>                 articles = null;

        public List<HashMap<String, String>> getList() {

            

Reported by PMD.

Avoid using redundant field initializer for 'articles'
Performance

Line: 31

                  public static class Entity {

        private List<HashMap<String, String>> list     = new ArrayList<HashMap<String, String>>();
        private List<Article>                 articles = null;

        public List<HashMap<String, String>> getList() {
            return list;
        }


            

Reported by PMD.