Files
openide/java/java-tests/testData/codeInsight/highlight/remove_new/beforeClassMethodSameName.java
Nikita Eshkeev 383d5a0aab [java][highlight] IDEA-274531 errors shown incorrectly when a method name is the same as a nested class name
IDEA added a fix to remove the "new" keyword when a callsite looks like a call to a method or a field. It caused the mentioned regression, because sometimes the callsite might simply instantiate a class that has the same name as a method which was mistakenly highlighted as an error. This patch simply adds a check if the resolved element is of a PsiClass and if so then the mentioned highlighting doesn't get added to such callsites.

GitOrigin-RevId: a34e6e1715d93ac21a2ba93cf5f57c54436bc11b
2021-07-28 19:15:35 +00:00

9 lines
95 B
Java

// "Remove 'new'" "false"
class A {
class B {}
B B() {
return new A.<caret>B();
}
}