> On Aug 13, 2019, at 12:19 PM, John Rose <[email protected]> wrote: > > The JIT optimization requires skipping the SAME== check if the equals method > will also carry that burden. For that to be valid we need to ensure that > applying equals of the same value to itself is a constant true with no side > effects. This is easy to argue for IMO since that is part of the contract of > Object::equals.
I don't think Object.equals has anything to say about side effects? > (a) classifying equals methods which are well behaved What makes me nervous here: whoever does the classification needs to be very careful about things like exceptions. Once you do something more than 'instanceof', 'getfield', and '==', things get pretty fuzzy quickly (e.g., can I guarantee that some accessor method I call in a third party API won't NPE because of some internal state?)
