Varargs methods in Java was one that bit me with an overload in the past (my tale of is told in more detail at <a href="http://the-whiteboard.github.io/java/debugging/warstory/2016/07/27/dont-overload-varargs.html" rel="nofollow">http://the-whiteboard.github.io/java/debugging/warstory/2016...</a> )<p>The issue was that there was a framework class with the method signature of execute(Object ... inParams). The class had overloaded the method signature to be execute(String foo, String bar). If you called it with two args, it got the overloaded call and there were a half dozen calls to this method.<p>At some point, someone added another argument to this so that it was execute(String foo, String bar, String qux) and updated the half dozen less one methods to use the third parameter.<p>However, the two args call in some other code still compiled correctly because it now went back to calling execute(Object ... inParams). Though, the parameters were completely wrong for that call structure and the application suddenly sprouted runtime errors.
Most of these rules are pretty straigthtforward. I don't really find any surprises in the Java method dispatch system, it just sort of works without a lot of thinking about it.<p>The one area I think leaves some question marks for me is the "new" default methods in interfaces, aka "public defender methods".<p>They were introduced awhile back, but they've mostly been avoided until recent years. As they become more common, a thorough understand of how Java deals with double-diamond needs to be understood by Java developers.
Many of these things are at the core of the book Java Puzzlers.<p><a href="http://www.javapuzzlers.com/" rel="nofollow">http://www.javapuzzlers.com/</a>
I'm disappointed that<p>> The method that gets invoked depends on the “actual” instance type, not the “declared” instance type.<p>doesn't apply more broadly. If you have a call(fruit) method and a call(apple) method, when you supply a fruit, it will resolve to call(fruit), even if the fruit instance is actually an apple.
Are these things HN readers didn't know?<p>I didn't know you can do operator overloading in Java (with Manifold). That would be interesting: <a href="https://www.youtube.com/watch?v=pwQs-308OdY">https://www.youtube.com/watch?v=pwQs-308OdY</a>
"half a decade" isn't a brag. Its overselling the fact that you coded for 5 years. Big whoop. Stop being a wordcel and making it seem like you are more qualified than others in the space because you used the term "half a decade" like its some large quantity of time.
A good reason, if any were needed, to escape from the Java OOP maze once and for all and never return. Honestly, talk about a mountain of incidental complexity. People, wake up! It doesn't have to be this way. You've been sold Java's absurd contortions dressed in the emperor's new clothes as the default by universities and big corps for decades. There's a whole other world out there where data is .... just ..... data.