Created
October 19, 2017 11:06
-
-
Save aldaris/b092af95f47c9f76bc8bb0d97761da7d to your computer and use it in GitHub Desktop.
Java 9 compilation error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Java9 { | |
public static void main(String[] args) throws Exception { | |
hello("foo", () -> doSomething("bad Java9", "test")); | |
} | |
public static <E extends Exception> void hello(String text, Foo<E> foo) throws Exception { | |
foo.run(); | |
} | |
public static <T, E extends Exception> void hello(String text, Bar<T, E> bar) throws Exception { | |
bar.run(); | |
} | |
public static <T extends CharSequence> void doSomething(String hello, T world) throws IllegalStateException { | |
System.out.println("hello" + world); | |
} | |
@FunctionalInterface | |
interface Foo<E extends Exception> { | |
void run() throws E; | |
} | |
@FunctionalInterface | |
interface Bar<T, E extends Exception> { | |
T run() throws E; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment