Recently I was debugging a case of NoSuchMethodError when using the Google Guava library. Conceptually my code was doing the following:

In runtime I was using library in version 19 and I was getting the following error:

I decompiled the code and got something similar to this

If you look closely you can see that the error is correct. The method mentioned in the stacktrace does not exist. Why? Because the method in the source code has different third parameter. It is not Object but effectively Object[] as varargs are compiled to arrays.

So the question is: why did my code try to call different method even though there is no other method with similar signature? I immediately suspected that there must be other Guava jar in different version with method matching the error. And I was right, the code was compiled with latest version which has the following

Tu sum up — code was compiled with latest version of Guava which has “overload” for three parameters. This is an interesting case of source compatibility but not the binary compatibility between versions. After changing runtime library to the latest version the error was gone.