Created
September 14, 2016 15:29
-
-
Save kmizu/25b6130df3ad943e15c0ed5b4865c605 to your computer and use it in GitHub Desktop.
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 Unsound { | |
static class Bound<A, B extends A> {} | |
static class Bind<A> { | |
<B extends A> A bad(Bound<A,B> bound, B b) {return b;} | |
} | |
public static <T,U> U coerce(T t) { | |
Bound<U,? super T> bound = null; | |
Bind<U> bind = new Bind<U>(); | |
return bind.bad(bound, t); | |
} | |
public static void main(String[] args) { | |
String s = Unsound.coerce(new Object()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment