Ambiguous method in Java 8, why? [duplicate]
This question already has an answer here: Java type inference: reference is ambiguous in Java 8, but not Java 7 2 answers public static void main(String... args){ then(bar()); // Compilation Error } public static <E extends Exception> E bar() { return null; } public static void then(Throwable actual) { } public static void then(CharSequence actual) { } Compilation result (from command line javac Ambiguous.java ) Ambiguous.java:4: error: reference to then is ambiguous then(bar()); ^ both method then(Throwable) in Ambiguous and method then(CharSequence) in Ambiguous match 1 error Why this method