3 ms·
Well the "why are they doing DNS resolution" comes down to "because the contract requires it": > Two URL objects are equal if they have the same protocol, refe
by peeters 7y ago
Well the "why are they doing DNS resolution" comes down to "because the contract requires it":
> Two URL objects are equal if they have the same protocol, reference equivalent hosts, have the same port number on the host, and the same file and fragment of the file.
> Two hosts are considered equivalent if both host names can be resolved into the same IP addresses; else if either host name can't be resolved, the host names must be equal without regard to case; or both host names equal to null.
> Since hosts comparison requires name resolution, this operation is a blocking operation.
So it's not an implementation bug, it's a requirements bug. Now why on Earth they thought this was a reasonable requirement for an equals() method, that's a fair question.