I am working on some Java 11 test code that is moved over from Java 8. The code looks like this:
HttpsURLConnection urlc = setupURLConnection(url);
boolean eqs = urlc.equals(urlc);
assertFalse("Unexpected equals returned", eqs);
Looking at the Java 11 documentation, it mentions that any non-null reference object should return true when equals is called on itself. However, in Java 8 the above test passes the test, i.e. the above test determines urlc is not equal to itself in Java 8, while in Java 11 the test determines urlc is equal to itself. I can also confirm that the equals method is not overridden by anything, it is just the standard Object.equals method.
Which version of the test is correct and which is incorrect? Could it be possible that the test code is in fact right and there is some issue with the Java 11 code that is causing a test failure? Thanks for your help!