Skip to content

Commit 7f90df7

Browse files
cpovirkError Prone Team
authored and
Error Prone Team
committed
Improve docs for URLEqualsHashCode.
PiperOrigin-RevId: 652878662
1 parent d3fc5f3 commit 7f90df7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/bugpattern/URLEqualsHashCode.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
Equals and HashCode method of java.net.URL make blocking network calls. Either
2-
use java.net.URI or if that isn't possible, use Collection<URL> or List<URL>.
1+
The `equals` and `hashCode` methods of `java.net.URL` make blocking network
2+
calls. When you place a `URL` into a hash-based container, the container invokes
3+
those methods.
4+
5+
Prefer `java.net.URI`. Or, if you must use `URL` in a
6+
collection, prefer to use a non-hash-based container like a `List<URL>`, and
7+
avoid calling methods like `contains` (which calls `equals`) on it.

0 commit comments

Comments
 (0)