News for hackers. Stuff that matters.
Re:Java Generics FAQs by slantedview on Friday April 17, 2015 @12:53AM (#9392318)
> There's no (good) way of going "this is a Comparable<Foo> and a Comparable<Bar>, but not a Comparable<Baz>" that's detectable at run

It's a shame that various libraries/frameworks have resorted to building APIs around Type Tokens - where users have to create anonymous classes - to create something that effectively reifies some generic type information. It's a lame solution, but a solution.

Re:Java Generics FAQs by tel on Friday April 17, 2015 @10:50AM (#9394632)
It's a dangerous solution as well given that it relies on user land extensible code to be correct in order to ensure type safety. Generally this is true whenever you have coercion, but type tokens done wrong give an (invalid!) excuse to coerce.