> On Aug 12, 2019, at 12:34 PM, Brian Goetz <[email protected]> wrote:
> 
> I believe much of the "is this legal" ground here has been covered by 
> previous attempts to intrinsify various methods (though this would probably 
> the first time we apply this reasoning to user-overridable methods.)  
> Essentially, this would be using invariants of the specification to enable 
> certain transformations.  Specifically, the specification 
> 
>     
> https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)
>  
> <https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)>
> 
> clearly says that for a non-null reference x, x.equals(x) must be true.  Can 
> we use that to optimize `x==y || x.equals(y)`?  I can see the arguments on 
> both sides.  

"I didn't get the boolean value I expected because my 'equals' method doesn't 
follow the specified contract" is one thing. What I'm more concerned with is 
"I'm getting an exception from a method that I never called, but only when 
-XXfoobar is turned on".

Reply via email to