mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
36 lines
1.1 KiB
HTML
36 lines
1.1 KiB
HTML
<html>
|
|
<body>
|
|
Reports usages of the <code>+</code> unary operator. The unary plus is usually a null operation, and
|
|
its presence might represent a coding error. For example, in a combination with the increment operator (like in <code>+++</code>)
|
|
or with the equal operator (like in <code>=+</code>).
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
void unaryPlus(int i) {
|
|
int x = + +i;
|
|
}
|
|
</code></pre>
|
|
<p>The following quick fixes are suggested:</p>
|
|
<ul>
|
|
<li><p>Remove <code>+</code> operators before the <code>i</code> variable:</p>
|
|
<pre><code>
|
|
void unaryPlus(int i) {
|
|
int x = i;
|
|
}
|
|
</code></pre>
|
|
</li>
|
|
<li><p>Replace <code>+</code> operators with the prefix increment operator:</p>
|
|
<pre><code>
|
|
void unaryPlus(int i) {
|
|
int x = ++i;
|
|
}
|
|
</code></pre>
|
|
</li>
|
|
</ul>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
Use the checkbox below to report unary pluses that are used together with a binary or another unary expression.
|
|
It means the inspection will not report situations when a unary plus expression is used in array
|
|
initializer expressions or as a method argument.
|
|
</p>
|
|
</body>
|
|
</html> |