mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] update inspection descriptions
GitOrigin-RevId: a3c6befa1827ac284422540525f8ddf7cdc37621
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d6f35497e3
commit
6fec7a3fcf
@@ -4,7 +4,7 @@ Reports classes that override the
|
||||
<code>equals()</code> method but do not override the
|
||||
<code>hashCode()</code> method or vice versa, which could potentially lead to problems
|
||||
when the class is added to a <code>Collection</code> or a <code>HashMap</code>.
|
||||
<p>There is a fix that generates stub for absent method.</p>
|
||||
<p>There is a fix that generates default implementation for absent method.</p>
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
class StringHolder {
|
||||
|
||||
+5
-4
@@ -1,14 +1,15 @@
|
||||
<html>
|
||||
<body>
|
||||
<p>
|
||||
This inspection is intended for Java ME and other highly resource constrained environments.
|
||||
Applying the results of this inspection without consideration might have negative effects on code clarity and design.
|
||||
</p>
|
||||
Reports abstract classes which have precisely one
|
||||
direct inheritor. While such classes may offer admirable clarity of design,
|
||||
in memory-constrained or bandwidth-limited environments, they needlessly increase
|
||||
the total footprint of the application. Consider merging the abstract class with its inheritor.
|
||||
|
||||
<p>
|
||||
This inspection is intended for Java ME and other highly resource constrained environments.
|
||||
Applying the results of this inspection without consideration might have negative effects on code clarity and design.
|
||||
</p>
|
||||
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
abstract class Base {} // will be reported
|
||||
|
||||
+3
-3
@@ -6,10 +6,10 @@ to specify initial capacities for collections may result in performance issues,
|
||||
memory copied when capacity is exceeded. This inspection checks allocations of the classes which are listed in inspection settings.
|
||||
<p>Example</p>
|
||||
<pre>
|
||||
new <String, String>();
|
||||
new HashMap<String, String>();
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p>Use the list to specify collection classes that should be checked.</p>
|
||||
<p>Use the checkbox to ignore field initializers.</p>
|
||||
<p>Use the list below to specify collection classes that should be checked.</p>
|
||||
<p>Use the checkbox below to ignore field initializers.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports String literals of length one being used
|
||||
Reports single character string being used
|
||||
as a parameter in <code>String.indexOf()</code> or
|
||||
<code>String.lastIndexOf()</code> calls.
|
||||
There is a fix that allows to replace these string literals with equivalent character literals, gaining some performance enhancement.
|
||||
@@ -8,7 +8,7 @@ There is a fix that allows to replace these string literals with equivalent char
|
||||
<pre>
|
||||
return s.indexOf("x");
|
||||
</pre>
|
||||
<p>After applying the fix:</p>
|
||||
<p>After the quick-fix is applied:</p>
|
||||
<pre>
|
||||
return s.indexOf('x');
|
||||
</pre>
|
||||
|
||||
+4
-5
@@ -1,12 +1,11 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports non-<code>Serializable</code> objects used as arguments to
|
||||
Reports objects not implementing <code>java.io.Serializable</code> used as arguments to
|
||||
<code>javax.servlet.http.HttpSession.setAttribute()</code> or
|
||||
<code>javax.servlet.http.HttpSession.putValue()</code>.
|
||||
Such objects will not be serialized if the HttpSession is passivated or migrated, and may result in difficult-to-diagnose
|
||||
bugs. For purposes of this inspection, objects with <code>java.util.Collection</code> or
|
||||
<code>java.util.Map</code> types are assumed to be <code>Serializable</code>, unless the types
|
||||
they are declared to contain are non-<code>Serializable</code>.
|
||||
Such objects will not be serialized if the 'HttpSession' is passivated or migrated and may result in difficult-to-diagnose
|
||||
bugs. By default objects with <code>java.util.Collection</code> or
|
||||
<code>java.util.Map</code> types are assumed to be <code>Serializable</code>, unless type parameters are non-<code>Serializable</code>.
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
void foo(HttpSession session) {
|
||||
|
||||
@@ -4,8 +4,8 @@ Reports fields which are not guaranteed to be initialized after the object is
|
||||
deserialized by the <code>readObject()</code> method.
|
||||
Inspection doesn't report transient fields.
|
||||
<p>
|
||||
Note: This inspection uses a very conservative dataflow algorithm, and may report instance variables
|
||||
as uninitialized incorrectly. Variables reported as initialized will always be initialized.
|
||||
Note: This inspection uses a very conservative control flow algorithm, and may report fields
|
||||
as uninitialized incorrectly.
|
||||
</p>
|
||||
<p>Example of the reported code:</p>
|
||||
<pre>
|
||||
|
||||
+6
-7
@@ -1,21 +1,20 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports calls to <code>java.lang.Runtime.exec()</code> or any
|
||||
of its variants which take a dynamically-constructed string as the command to execute.
|
||||
Reports calls to <code>java.lang.Runtime.exec</code> which take a dynamically-constructed string as the command to execute.
|
||||
Constructed execution strings are a common source of security breaches.
|
||||
By default this inspection ignores compile-time constants.
|
||||
<p>Example</p>
|
||||
<p>Example of the reported code:</p>
|
||||
<pre>
|
||||
String i = getUserInput();
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
runtime.exec("foo" + i); // reports warning
|
||||
String i = getUserInput();
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
runtime.exec("foo" + i); // reports warning
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
Use the checkbox below to consider any <code>static</code> <code>final</code> fields as constant.
|
||||
Be careful, because strings like the following will be ignored when the option is enabled:
|
||||
<pre>
|
||||
private static final String COMMAND = "ping " + getDomainFromUserInput() + "'";
|
||||
static final String COMMAND = "ping " + getDomainFromUserInput() + "'";
|
||||
</pre>
|
||||
<p>
|
||||
</body>
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports any calls to <code>String.startsWith()</code> or
|
||||
<code>String.endsWith()</code> where single character string literals passed as a parameter.
|
||||
<p>There is a fix that replaces such calls with more efficiently implemented <code>String.charAt()</code>.</p>
|
||||
Because the performance gain is minimal and the code becomes less readable because of the extra non-zero length check,
|
||||
it is recommended to do so only inside tight loops.
|
||||
<p>
|
||||
This inspection is intended for Java ME and other highly resource constrained environments.
|
||||
Applying the results of this inspection without consideration might have negative effects on code clarity and design.
|
||||
</p>
|
||||
Reports any calls to <code>String.startsWith()</code> or
|
||||
<code>String.endsWith()</code> which are passed single character string
|
||||
literals as parameter.
|
||||
<p>There is a fix that replace such calls with more efficiently implemented <code>String.charAt()</code>.</p>
|
||||
Because the performance gain is minimal, the needed extra check for non-zero length, and the negative effect on
|
||||
code clarity, it is recommended to do so only inside tight loops.
|
||||
<p>Example</p>
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
boolean startsWithX(String s) {
|
||||
return s.startsWith("x");
|
||||
}
|
||||
</pre>
|
||||
<p>After applying the fix:</p>
|
||||
<p>After the quick-fix is applied:</p>
|
||||
<pre>
|
||||
boolean startsWithX(String s) {
|
||||
return !s.isEmpty() && s.charAt(0) == 'x';
|
||||
}
|
||||
</pre>
|
||||
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user