mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] Update intention descriptions
GitOrigin-RevId: 5e54c459496263c585ade17ee70e81a8147a74c8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4018a61007
commit
69e1f3801c
+1
-1
@@ -1,5 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
Breaks a string at the '\n' and '\n\r' line separators.
|
||||
Breaks a string at the <code>\n</code> and <code>\n\r</code> line separators.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Replaces either
|
||||
<table>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<code>a || b</code> with <code>!(!a && !b)</code> or
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<code>a && b</code> with <code>!(!a || !b)</code>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
when inside a boolean expression.
|
||||
Replaces either <code>a || b</code> with <code>!(!a && !b)</code> or
|
||||
<code>a && b</code> with <code>!(!a || !b)</code> when inside a boolean expression.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
<html><body>
|
||||
This intention changes a library method contract.
|
||||
|
||||
Method contract has the following syntax:<br/>
|
||||
contract ::= (clause ';')* clause<br/>
|
||||
clause ::= args '->' effect<br/>
|
||||
args ::= ((arg ',')* arg )?<br/>
|
||||
arg ::= value-constraint<br/>
|
||||
value-constraint ::= '_' | 'null' | '!null' | 'false' | 'true'<br/>
|
||||
effect ::= value-constraint | 'fail' | 'new' | 'this' | 'param' number<br/>
|
||||
number ::= [1-9] [0-9]*<p/>
|
||||
A method contract has the following syntax:
|
||||
<pre><code>
|
||||
contract ::= (clause ';')* clause
|
||||
clause ::= args '->' effect
|
||||
args ::= ((arg ',')* arg )?
|
||||
arg ::= value-constraint
|
||||
value-constraint ::= '_' | 'null' | '!null' | 'false' | 'true'
|
||||
effect ::= value-constraint | 'fail' | 'new' | 'this' | 'param' number
|
||||
number ::= [1-9] [0-9]*
|
||||
</code></pre>
|
||||
|
||||
The constraints denote the following:<br/>
|
||||
<ul>
|
||||
<li> _ - any value
|
||||
<li> null - null value
|
||||
<li> !null - a value statically proved to be not-null
|
||||
<li> true - true boolean value
|
||||
<li> false - false boolean value
|
||||
<li> fail - the method throws exception, if the arguments satisfy argument constraints
|
||||
<li> new - every time the method is executed, it returns a non-null new object that is distinct from other objects existing in the heap prior to method execution. If the method is pure, the new object is not stored in any field or array and will be lost if method return value is not used.
|
||||
<li> this - the method returns non-null this reference
|
||||
<li> param1 (param2, param3, etc.) - the method returns its first (second, third, etc.) argument
|
||||
<li> <code>_</code>: any value
|
||||
<li> <code>null</code>: null value
|
||||
<li> <code>null!</code>: a value statically proved to be not-null
|
||||
<li> <code>true</code>: true boolean value
|
||||
<li> <code>false</code>: false boolean value
|
||||
<li> <code>fail</code>: the method throws exception if the arguments satisfy argument constraints
|
||||
<li> <code>new</code>: every time the method is executed, it returns a non-null new object that is distinct from other objects existing in the heap prior to method execution. If the method is pure, the new object is not stored in any field or array and will be lost if method return value is not used.
|
||||
<li> <code>this</code>: the method returns non-null this reference
|
||||
<li> <code>param1 (param2, param3, etc.)</code>: the method returns its first (second, third, etc.) argument
|
||||
</ul>
|
||||
Examples:<br/>
|
||||
<ul>
|
||||
<li> <code>@Contract("_, null -> null")</code>: method returns null if its second argument is null.
|
||||
<li> <code>@Contract("_, null -> null; _, !null -> !null")</code>: method returns null if its second argument is null and not-null otherwise.
|
||||
<li> <code>@Contract("true -> fail")</code>: a typical <code>assertFalse</code> method which throws an exception if <code>true</code> is passed to it.
|
||||
</ul>
|
||||
Examples:<p/>
|
||||
<code>@Contract("_, null -> null")</code> - method returns null if its second argument is null<br/>
|
||||
<code>@Contract("_, null -> null; _, !null -> !null")</code> - method returns null if its second argument is null and not-null otherwise<br/>
|
||||
<code>@Contract("true -> fail")</code> - a typical assertFalse method which throws an exception if <code>true</code> is passed to it<br/>
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Extracts an increment or decrement
|
||||
operation, that is used inside another statement, into a separate statement. Due to
|
||||
an operation used inside another statement, into a separate statement. Due to
|
||||
the inherent possibility of side effects in this operation, this intention may
|
||||
alter the semantics of the modified statements.
|
||||
</body>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Moves a comment that is located on the
|
||||
Moves a comment located on the
|
||||
same line as code up to a separate line of its own.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ Replaces constructor calls with builder patterns.
|
||||
<p>
|
||||
Class constructors are left unchanged, but clients are able to construct objects step by step.
|
||||
</p>
|
||||
It can be especially useful for constructors with long list of optional parameters.
|
||||
It can be especially useful for constructors with a long list of optional parameters.
|
||||
</body>
|
||||
</html>
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
<body>
|
||||
Replaces constructor calls with calls to the factory method.
|
||||
<p>
|
||||
Since factory methods can create objects of any type, such replacement can be especially useful when a new instance of the containing class is not desired.
|
||||
Since factory methods can create objects of any type, such a replacement can be especially useful when a new instance of the containing class is not desired.
|
||||
</p>
|
||||
E.g.
|
||||
when current class is extended and objects of subclasses should be created instead.
|
||||
E.g.,
|
||||
when the current class is extended and objects of subclasses should be created instead.
|
||||
Or when caching is introduced and existing objects should be returned.
|
||||
</body>
|
||||
</html>
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Replaces a <code>Collections.emptyList()</code> or <code>Collections.singletonList()</code> call with a call to <code>Arrays.asList()</code>.
|
||||
<p>When the project or module uses the language level 9:</p>
|
||||
<p>When the project or module uses language level 9:</p>
|
||||
<ul>
|
||||
<li>The intention replaces <code>Collections.emptyList()</code> or <code>Collections.singletonList()</code>
|
||||
with a call to <code>java.util.List.of()</code>.</li>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
Wraps locals variable of the AutoCloseable type in a try-with-resources statement.
|
||||
Wraps locals variable of the <code>AutoCloseable</code> type in a try-with-resources statement.
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user