method ref highlighting: show error on container when functional interface is not fully inferred (IDEA-214550)

GitOrigin-RevId: 8bce63a76385161033d494d1fd2b5439daccaf6d
This commit is contained in:
Anna Kozlova
2019-05-21 11:17:29 +02:00
committed by intellij-monorepo-bot
parent f7b26dca7a
commit 1cfa8a070d
6 changed files with 29 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ interface B<BT> {
class Test {
public static void test() {
method1(Test::<error descr="Incompatible types: A<capture of ? super M> is not convertible to A<? super String>">method2</error>);
method1<error descr="'method1(B<A<? super M>>)' in 'Test' cannot be applied to '(<method reference>)'">(Test::method2)</error>;
}
static <M> void method1(B<A<? super M>> arg) { }

View File

@@ -0,0 +1,23 @@
class Logger {}
class Test {
public static void main(String[] args) {
User user = new User();
Logger logger = null;
foo<error descr="'foo(T, java.util.logging.Logger, java.util.function.Function<T,java.lang.String>)' in 'Test' cannot be applied to '(User, Logger, <method reference>)'">(user, logger, User::getId)</error>;
}
private static <T> void foo(T val, java.util.logging.Logger logger, java.util.function.Function<T, String> idFunction) { }
}
class User {
private String Id;
public String getId() {
return Id;
}
public void setId(String id) {
this.Id = id;
}
}