mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
32 lines
1.0 KiB
HTML
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<T> extends Collection<T> {
|
|
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<Integer> stack = new FixedStack<>();
|
|
stack.store(i);
|
|
}
|
|
</code></pre>
|
|
</body>
|
|
</html> |