mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java inspection description fixes
GitOrigin-RevId: 98494155ef08b225374f87b2e037637f40efe281
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ae523ab008
commit
85fd4be0f7
@@ -6,7 +6,7 @@ parameter can be removed and its usages replaced with local variables.
|
||||
There is no sense to have such parameter as values passed to it are overwritten.
|
||||
Usually problem appears as a result of refactoring.
|
||||
|
||||
<p>E.g.</p>
|
||||
<p>For example:</p>
|
||||
<pre><code>
|
||||
void test(int p) {
|
||||
p = 1;
|
||||
|
||||
@@ -4,8 +4,7 @@ Reports <code>abstract</code> classes which can be converted to interfaces.
|
||||
Java doesn't support multiple class inheritance while class can implement multiple interfaces,
|
||||
so it make sense to use interfaces wherever possible instead of classes.
|
||||
A class may be converted to an interface if it has no superclass (other
|
||||
than Object), has no fields declared that are not <code>static</code>, <code>final</code>, and <code>public</code>, and has no
|
||||
methods declared that are not <code>public</code> and <code>abstract</code> and no inner classes that are not <code>public</code>.
|
||||
than Object), has only <code>public static final</code> fields, <code>public abstract</code> methods, and <code>public</code> inner classes.
|
||||
<!-- tooltip end -->
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
+6
-8
@@ -1,16 +1,14 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports <code>clone()</code> methods which are not declared as throwing
|
||||
<code>CloneNotSupportedException</code>. If <code>clone()</code> is not declared
|
||||
to possibly throw <code>CloneNotSupportedException</code>, then subclasses which need to
|
||||
prohibit cloning will not be able to do so in the standard way. This inspection will not report
|
||||
<code>clone()</code> methods declared <code>final</code>,
|
||||
or <code>clone()</code> methods on <code>final</code> classes.
|
||||
Reports <code>clone()</code> methods that don't declare <code>CloneNotSupportedException</code>.
|
||||
If <code>CloneNotSupportedException</code> is not declared, then subclasses will not be able to prohibit cloning
|
||||
in the standard way. This inspection does not report <code>clone()</code> methods declared <code>final</code>
|
||||
and <code>clone()</code> methods on <code>final</code> classes.
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
Use the checkbox below to indicate if this inspection should only warn on <code>protected</code> methods.
|
||||
In <i>Effective Java, Second Edition</i> (but not in the first edition) it is recommended to omit the <code>CloneNotSupportedException</code>
|
||||
declaration on <code>public</code> methods, because methods that don't throw checked exceptions are easier to use.
|
||||
You can disable warnings for public methods if you are following the recommendation given in <i>Effective Java, Second Edition</i>> to omit
|
||||
the exception declaration for public methods to make them easier to use.
|
||||
<p>
|
||||
<p>Example</p>
|
||||
<pre><code>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports comments that contain Java code.
|
||||
Usually commented out code gets outdated very fast and becomes misleading.
|
||||
Usually code that is commented out gets outdated very fast and becomes misleading.
|
||||
As most of the projects use some kind of version control system,
|
||||
it is better to delete commented out code completely and use VCS history instead.
|
||||
<!-- tooltip end -->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports methods declared <code>final</code> and <code>private</code>.
|
||||
As <code>private</code> methods cannot be meaningfully overridden because of its visibility, declaring them
|
||||
Reports methods Reports methods are marked both <code>final</code> and <code>private</code>.
|
||||
As <code>private</code> methods cannot be meaningfully overridden because of their visibility, declaring them
|
||||
<code>final</code> is redundant.
|
||||
<!-- tooltip end -->
|
||||
|
||||
|
||||
+4
-3
@@ -1,12 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports any calls to <code>System.out.println()</code> with an exception as an argument.
|
||||
This is even worse than calling <code>printStackTrace()</code> on an exception, since it will be unclear where the exception originated.
|
||||
Reports calls to <code>System.out.println()</code> with an exception as an argument.
|
||||
Using print statements for logging exceptions hides the stack trace from you, which is important when you need to investigate what happened.
|
||||
It is recommended to use logger instead.
|
||||
Calls to <code>System.out.print()</code>, <code>System.err.println()</code> and <code>System.err.print()</code> with an exception argument will also be
|
||||
reported.
|
||||
It is better to use logger to log exceptions instead.
|
||||
<!-- tooltip end -->
|
||||
<p>E.g. instead of:</p>
|
||||
<p>For example, instead of:</p>
|
||||
<pre><code>
|
||||
try {
|
||||
foo();
|
||||
|
||||
Reference in New Issue
Block a user