Skip to content

Instantly share code, notes, and snippets.

@libetl
Created October 13, 2017 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save libetl/b42bbb274c47924d19f2a71fa22d3ca9 to your computer and use it in GitHub Desktop.
Save libetl/b42bbb274c47924d19f2a71fa22d3ca9 to your computer and use it in GitHub Desktop.
How to crash javac
public class TestExtendConsumer {
@FunctionalInterface public interface NumberConsumer<E extends Number> extends java.util.function.Consumer<E>{void accept(E number);}
private static <E extends Number> void extend(E number) {
System.out.println(number);
}
public static void main(String[] args) {
NumberConsumer numberConsumer = TestExtendConsumer::extend;
//works with NumberConsumer<Integer>
numberConsumer.accept(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment