[java-highlighting] IDEA-344501 (part of) IntelliJ Wrong Error Highlighting with Wildcard Method Reference

Do not report 'unexpected wildcard' if the method reference is not in the constructor form (see JLS 15.13)

GitOrigin-RevId: 19d0acbe97b2a4d6ae3f5c611ff6a24490eec09c
This commit is contained in:
Tagir Valeev
2025-11-04 16:07:57 +01:00
committed by intellij-monorepo-bot
parent 1ff463da3d
commit 8034f97303
2 changed files with 7 additions and 1 deletions

View File

@@ -2,6 +2,10 @@ class Test {
interface IFactory {
Object m();
}
interface FooToInt {
int m(Foo<?> foo);
}
@interface Anno {}
@@ -29,6 +33,8 @@ class Test {
IFactory c5 = <error descr="Cannot find class 1">1</error>::new;
IFactory c6 = <error descr="'ABar' is abstract; cannot be instantiated">ABar::new</error>;
IFactory c7 = <error descr="'ABaz' is abstract; cannot be instantiated">ABaz::new</error>;
FooToInt fooToInt = Foo<?>::hashCode;
foo(<error descr="'Anno' is abstract; cannot be instantiated">Anno::new</error>);
foo(<error descr="Enum types cannot be instantiated">E::new</error>);