Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/params/MethodApplicability.java
Tagir Valeev c449c341b7 [java-highlighting] test-data adjusted (mostly anchors) after recent updates
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: 1e1b77009dc78de49c7cc5c44d4704937397bb23
2025-01-29 11:35:30 +00:00

68 lines
1.3 KiB
Java

interface I {
void m(int i);
}
interface J {
void mm(int i, int j);
}
interface K {
void k(String m);
}
class Foo {
void foo(I i){}
void foo(J j){}
void foo(K k){}
void bar() {
foo<error descr="Ambiguous method call: both 'Foo.foo(I)' and 'Foo.foo(K)' match">((p) -> {
System.out.println<error descr="Cannot resolve method 'println(<lambda parameter>)'">(p)</error>;
})</error>;
foo((p, k) -> {
System.out.println(p);
});
foo((String s) ->{
System.out.println(s);
});
foo(<error descr="Incompatible parameter types in lambda expression: expected int but found String">(String p, String k)</error> -> {
System.out.println(p);
});
}
}
class WithTypeParams {
interface I<T> {
void m(T t);
}
interface J<K, V> {
void n(K k, V v);
}
class Foo {
void foo(I<String> i){}
void foo(J<String, String> j){}
void bar() {
foo((p) -> {
System.out.println(p);
});
foo((p, k) -> {
System.out.println(p);
});
foo((String s) ->{
System.out.println(s);
});
foo((String p, String k) -> {
System.out.println(p);
});
foo(<error descr="Incompatible parameter types in lambda expression: expected String but found int">(int k)</error> -> {System.out.println(k);});
}
}
}