mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 05:09:37 +07:00
Also: report every incompatible parameter, not only the first one Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only) GitOrigin-RevId: a9d75a78207d0910f0bcbb6060e38acedc3f07d3
68 lines
1.4 KiB
Java
68 lines
1.4 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 type in lambda expression: expected int but found String">String p</error>, <error descr="Incompatible parameter type in lambda expression: expected int but found String">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 type in lambda expression: expected String but found int">int k</error>) -> {System.out.println(k);});
|
|
}
|
|
}
|
|
} |