Intellij报告代码重复,而实际上它不是
问题描述:
这是代码。方法test和test2中的代码是不同的,因为传递给Test构造函数的参数是不同的。实际上,如果我将任何参数更改为null,intellij将停止报告重复。有没有什么办法解决这一问题?Intellij报告代码重复,而实际上它不是
----更新--------
我经过2个功能做完全不同的事情,但仍的IntelliJ重复报告
public class TestMain {
public void test(int a)
{
System.out.println("haha");
System.out.println("hahaa");
TestMain testMain = new TestMain();
new Test(testMain::test3);
System.out.println("hahaaa");
}
public void test2(int a)
{
System.out.println("haha");
System.out.println("hahaa");
TestMain testMain = new TestMain();
new Test(testMain::still_dup);
System.out.println("hahaaa");
}
public void test3(int a) {
System.out.println("abc");
}
public void still_dup(int a) {
String b = "edf";
b.toLowerCase();
}
public class Test {
Test(handler h) {
}
}
public interface handler<M> {
void entitySelector(int a);
}
public static void main(String[] args) {
TestMain test = new TestMain();
test.test(1);
System.out.println("-------");
test.test2(2);
}
}
您传递了两个不同的方法引用,但两个引用的方法完全相同。 –
@JBNizet这不是重点。即使我通过一个完全不同的功能,它也报告重复。 – Cuero