Files
openide/java/java-impl/resources/inspectionDescriptions/MismatchedCollectionQueryUpdate.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

32 lines
1.0 KiB
HTML

<html>
<body>
Reports collections whose contents are either queried and
not updated, or updated and not queried.
<!-- tooltip end -->
<p>
Such inconsistent queries and updates are pointless and may indicate
either dead code or a typo.
</p>
<p>
Use the inspection settings to specify name patterns that correspond to update/query methods.
Query methods that return an element are automatically detected, and only
those that write data to an output parameter (for example, an <code>OutputStream</code>) need to be specified.
<p>
<p><b>Example:</b></p>
<p>Suppose you have your custom <code>FixedStack</code> class with method <code>store()</code>:
<pre><code>
public class FixedStack&lt;T&gt; extends Collection&lt;T&gt; {
public T store(T t) {
// implementation
}
}
</code></pre>
<p>You can add <code>store</code> to the update methods table in order to report mismatched queries like:
<pre><code>
void test(int i) {
FixedStack&lt;Integer&gt; stack = new FixedStack&lt;&gt;();
stack.store(i);
}
</code></pre>
</body>
</html>