mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
clarify inspection descriptions
GitOrigin-RevId: b376f48172f0ee39a884eb74f6f473839038ee9e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9629bb5f5d
commit
d24901c574
@@ -1,15 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports instantiations of <code>java.util.Set</code> and <code>java.util.Map</code> that contain
|
||||
Reports <code>java.util.Set</code> and <code>java.util.Map</code> variables that contain
|
||||
<code>java.net.URL</code> objects.
|
||||
Such collections will call the <code>equals()</code> and <code>hashCode()</code> methods on inserted objects,
|
||||
which can cause performance problems on <code>URL</code> objects.
|
||||
<p>
|
||||
Adding <code>URL</code> objects to such collections can cause performance problems because of calls to
|
||||
the <code>equals()</code> and <code>hashCode()</code> methods of <code>URL</code>.
|
||||
</p>
|
||||
<p>
|
||||
<code>URL</code>'s <code>equals()</code> and
|
||||
<code>hashCode()</code> methods use a DNS lookup, which depending on the availability of the network and the speed of the DNS server can
|
||||
cause significant delays.
|
||||
<code>URL</code>'s <code>equals()</code> and <code>hashCode()</code> methods can perform a DNS lookup to resolve the host name.
|
||||
This may cause significant delays, depending on the availability and speed of the network and the DNS server.
|
||||
Using <code>java.net.URI</code> instead of <code>java.net.URL</code> will avoid the DNS lookup.
|
||||
</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre><code>
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports <code>hashCode()</code> and <code>equals()</code> being called on <code>java.net.URL</code> objects.
|
||||
Reports <code>hashCode()</code> and <code>equals()</code> calls on <code>java.net.URL</code> objects.
|
||||
<p>
|
||||
The <code>java.net.URL</code> class internally uses an instance of <code>java.net.URLStreamHandler</code>
|
||||
to execute <code>hashCode()</code> and <code>equals()</code>.
|
||||
This can cause performance problems because <code>java.net.URLStreamHandler</code> performs DNS lookups.
|
||||
Depending on the availability of the network and the speed of a DNS server this can cause significant delays.
|
||||
<code>URL</code>'s <code>equals()</code> and <code>hashCode()</code> methods can perform a DNS lookup to resolve the host name.
|
||||
This may cause significant delays, depending on the availability and speed of the network and the DNS server.
|
||||
Using <code>java.net.URI</code> instead of <code>java.net.URL</code> will avoid the DNS lookup.
|
||||
</p>
|
||||
<p>The problem can most likely be solved by using <code>java.net.URI</code> instead.</p>
|
||||
<p><b>Example:</b></p>
|
||||
<pre><code>
|
||||
int f(URL url1, URL url2) {
|
||||
if (url1.equals(url2)) return url1.hashCode();
|
||||
else return url2.hashCode();
|
||||
int equalsHashCode(URL url1, URL url2) {
|
||||
return url1.hashCode() == url2.hashCode();
|
||||
}
|
||||
</code></pre>
|
||||
<!-- tooltip end -->
|
||||
|
||||
Reference in New Issue
Block a user