Incoherent invocation type inference?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Sun Jan 15 21:44:15 UTC 2017


> The problem of the code of Bernard is not related to the inference, the problem is the unsafe cast in the implementation, if you use an unsafe cast, then you may have a ClassCastException at runtime. It's as simple as that.
Of course that's the problem :-)

I was speculating as to whether there could be something the compiler 
could do to help out programmers setting right expectations for a given 
generic method signature, as I've seen this problem (unchecked issues 
mistaken for inference issues) coming up frequently.

Maurizio


More information about the compiler-dev mailing list