我有一个Java类,其中包含一些代码,这些代码应该作为阻止程序出现在Sonar中,但是......它们根本没有显示。我只是获得批评和专业。我已经检查了拦截器的规则,我正在做那些打破它们的东西,但没有任何东西出现,而且项目正在使用这个规则的配置文件所以...任何关于它发生了什么的线索?
public class ThisBreaksEverything {
public ThisBreaksEverything() {
System.out.println("I shouldn't use syso.");
// Downcast
Object o = new Object();
String s = (String) o;
}
void breakingMethod() {
// ClassCastException.
Object x = new Integer(0);
System.out.println((String)x);
}
String[] getAsArray(Collection<String> c) {
return (String[]) c.toArray();
}
boolean twoDifferentTypesOfArrays() {
String[] strings = new String[2];
int[] ints = new int[3];
return strings.equals(ints);
}
public boolean equals(Object o) {
// Always True
return this == this;
}
答案 0 :(得分:0)
您确定在质量配置文件中激活了规则吗?