The interface org.apache.logging.log4j.Logger in Apache Log4j 2.12.1 has the following 2 methods:
void info(String message, Object... params);
void info(String message, Supplier<?>... paramSuppliers);
In my code, my intention was to call the second method and the second arg was a lambda paramSupplier. Surprisingly, at runtime, the first method was called, which printed the lambda's obj reference instead of the actual param value.
I am puzzled why these methods are not flagged as ambiguous by the compiler. This is on Java 11. I also see many other methods, in the same Logger interface, where the difference in method signature is just that one method takes an Object and the other method takes a Supplier<?> in the same position in the args list, with the types and order of all other method args matching.
I found the following two questions re: overloaded methods disambiguation but those answers did not seem to explain this.