completion: infer Throwable for thrown bounds in completion so more candidates would be applicable (IDEA-162710)

This commit is contained in:
Anna.Kozlova
2016-10-20 13:14:23 +02:00
parent f455e517e0
commit 8952680a73
6 changed files with 46 additions and 1 deletions
@@ -0,0 +1,15 @@
import java.io.IOException;
import java.util.function.Function;
class LocalDateTime {}
class Launcher {
public static final Function<LocalDateTime, IOException> TO_STRING = (message) -> new IOException(message.toString());
public static void main(String[] args) throws Throwable{
throwException(new LocalDateTime(), TO_STRING);
}
public static <Ex extends Throwable> void throwException(LocalDateTime str, Function<LocalDateTime, Ex> exceptionBuilder) throws Ex {
throw exceptionBuilder.apply(str);
}
}
@@ -0,0 +1,15 @@
import java.io.IOException;
import java.util.function.Function;
class LocalDateTime {}
class Launcher {
public static final Function<LocalDateTime, IOException> TO_STRING = (message) -> new IOException(message.toString());
public static void main(String[] args) throws Throwable{
throwException(new LocalDateTime(), TO<caret>);
}
public static <Ex extends Throwable> void throwException(LocalDateTime str, Function<LocalDateTime, Ex> exceptionBuilder) throws Ex {
throw exceptionBuilder.apply(str);
}
}