I stumbled upon an interesting mistake that I had never seen before, and cannot explain why
Consider the following class
public class Sandbox<A,B> { public void put(B b) { } public void put(A a) { } }
Looks good to my eyes. So I compile it and then I get this
name clash: put(B) and put(A) have the same erasure
A? How do two different common types have the same signature? There is completely separate!
I probably missed something completely basic, but I just hadn't encountered this problem before. I took advantage of group support by calling putA and putB , but I'm really curious why this error occurred in the first place.
Will anyone reason?
Thelq source share