Just ran into an example of where Java’s dumb erasure strategy just didn’t cut it.
I wrote a small class to collect up vararg junk into typed collections, something like:
public class Collector {
public Collection collect( typename... vs ) {...}
public Collection collect( Collection collection, typename... vs ) {...}
};
This worked fine up until the point where the typename was a typed collection, at which point the second method was invoked instead.
My work around was to rename the latter to “collectInto”
Lame…