sonarLint扫描问题

Methods should not be empty

说明:不要存在空方法


public Abi() {
    }
    

解决:填写方法注释内容或私有化构造器

  public Abi() {
        throw new IllegalStateException("Abi class");
    }
      public Abi() {
        // Methods should not be empty
    }

字段不应与其包含类的名称重复

说明:字段的名字与类类名不能重复

public class Abi {
    private com.pandabank.jeos.core.response.chain.code.Abi abi;
}

解决:字段名称修改

public class Abi {
    private com.pandabank.jeos.core.response.chain.code.Abi applicationBinaryInterface;
}

The diamond operator (“<>”) should be used

说明:应使用<> 运算符

List<String> strings = new ArrayList<String>();  // Noncompliant
Map<String,List<Integer>> map = new HashMap<String,List<Integer>>(); 

解决:去掉类型

List<String> strings = new ArrayList<>();
Map<String,List<Integer>> map = new HashMap<>();

Public constants and fields initialized at declaration should be “static final” rather than merely “final”

说明:在初始化时声明的公共常量和字段应该是"static final",而不仅仅是"final"

    private final int CHANNELISUSED = 1;

解决:加上 static

    private static final int CHANNELISUSED = 1;

Test classes should comply with a naming conventio

说明:测试类的命名规范

class FooTest {
  @Test
  void check() {  }
}

class BarIT {
  @Nested
  class PositiveCase {
    @Test
    void check() {  }
  }
}

你可能感兴趣的:(sonar,扫描代码问题修改)