Skip to content

Commit

Permalink
Improve docs for URLEqualsHashCode.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 652878662
  • Loading branch information
cpovirk authored and Error Prone Team committed Jul 16, 2024
1 parent d3fc5f3 commit 7f90df7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/bugpattern/URLEqualsHashCode.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
Equals and HashCode method of java.net.URL make blocking network calls. Either
use java.net.URI or if that isn't possible, use Collection<URL> or List<URL>.
The `equals` and `hashCode` methods of `java.net.URL` make blocking network
calls. When you place a `URL` into a hash-based container, the container invokes
those methods.

Prefer `java.net.URI`. Or, if you must use `URL` in a
collection, prefer to use a non-hash-based container like a `List<URL>`, and
avoid calling methods like `contains` (which calls `equals`) on it.

0 comments on commit 7f90df7

Please sign in to comment.