Hi Joe,

Looks good.

Brian

> On May 2, 2019, at 2:42 PM, Joe Darcy <joe.da...@oracle.com> wrote:
> 
> Bug JDK-8223112 notes indirectly that if Objects.equals is called with (foo, 
> null) and foo has a buggy equals method that returns true for null, the wrong 
> result will be computed.
> 
> I don't think code should be added to Objects.equals itself to guard against 
> this case. Instead, I think the operational semantics of the implementation 
> should be made explicit in the specification.
> 
> Please review the patch below.
> 
> Thanks,
> 
> -Joe
> 
> diff -r 7ab4310ed472 src/java.base/share/classes/java/util/Objects.java
> --- a/src/java.base/share/classes/java/util/Objects.java    Wed May 01 
> 20:25:31 2019 -0700
> +++ b/src/java.base/share/classes/java/util/Objects.java    Thu May 02 
> 14:41:06 2019 -0700
> @@ -62,10 +62,11 @@
>       * Returns {@code true} if the arguments are equal to each other
>       * and {@code false} otherwise.
>       * Consequently, if both arguments are {@code null}, {@code true}
> -     * is returned and if exactly one argument is {@code null}, {@code
> -     * false} is returned.  Otherwise, equality is determined by using
> -     * the {@link Object#equals equals} method of the first
> -     * argument.
> +     * is returned.  Otherwise, if the first argument is not {@code
> +     * null}, equality is determined by calling the {@link
> +     * Object#equals equals} method of the first argument with the
> +     * second argument of this method. Otherwise, {@code false} is
> +     * returned.

Reply via email to