Not sure how, for some reason I've had Java eat a situation that should've failed. I don't know how it ever worked and I don't know why it now fails on a new machine only...

<T, R> Collector<T, R, R> toIdentity(final R identity, final BiConsumer<R, T> accumulator) { ...}

I call this method like so:

<T, R extends List<? super T>> Collector<T, R, R> toList(final R list) {
return toIdentity(


What it did incorrectly all this time was that for R::add it found List.add(T) : boolean

It's incorrect because expected BiConsumer<R,T> has a return type void!

On the new machine it correctly found List.add(int, T) : void instead.

But why is there a difference between machines, it's the exact same JDK/JRE versions!

What's even weirder is that in the "working" environment, using Set instead of List broke, even though they have the same Collection.add(T) function!

Oh Java, you so silly. /fin

Show thread
Sign in to participate in the conversation
Bitcoin Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!