Merge branch 'pr-790'

This commit is contained in:
Juan Martín Sotuyo Dodero
2018-01-21 14:47:11 -03:00
2 changed files with 15 additions and 4 deletions

View File

@ -190,6 +190,8 @@ for (int i = 0; i < 10; i++) {
<description>
The method Object.finalize() is called by the garbage collector on an object when garbage collection determines
that there are no more references to the object. It should not be invoked by application logic.
Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
</description>
<priority>3</priority>
<example>
@ -1401,7 +1403,7 @@ public void doSomething() {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#emptyfinalizer">
<description>
Empty finalize methods serve no purpose and should be removed.
Empty finalize methods serve no purpose and should be removed. Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
</description>
<priority>3</priority>
<properties>
@ -1765,7 +1767,7 @@ if (x == null) { // preferred
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#finalizedoesnotcallsuperfinalize">
<description>
If the finalize() is implemented, its last action should be to call super.finalize.
If the finalize() is implemented, its last action should be to call super.finalize. Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
</description>
<priority>3</priority>
<properties>
@ -1809,7 +1811,7 @@ protected void finalize() {
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#finalizeonlycallssuperfinalize">
<description>
If the finalize() is implemented, it should do something besides just calling super.finalize().
If the finalize() is implemented, it should do something besides just calling super.finalize(). Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
</description>
<priority>3</priority>
<properties>
@ -1845,6 +1847,8 @@ protected void finalize() {
<description>
Methods named finalize() should not have parameters. It is confusing and most likely an attempt to
overload Object.finalize(). It will not be called by the VM.
Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
</description>
<priority>3</priority>
<properties>
@ -1877,6 +1881,8 @@ public class Foo {
<description>
When overriding the finalize(), the new method should be set as protected. If made public,
other classes may invoke it at inappropriate times.
Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
</description>
<priority>3</priority>
<properties>

View File

@ -64,7 +64,7 @@ sb.append('a'); // use this instead
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#avoidarrayloops">
<description>
Instead of manually copying data between two arrays, use the efficient System.arraycopy method instead.
Instead of manually copying data between two arrays, use the efficient Arrays.copyOf or System.arraycopy method instead.
</description>
<priority>3</priority>
<properties>
@ -253,6 +253,7 @@ bi4 = new BigInteger(0); // reference BigInteger.ZERO instead
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_performance.html#booleaninstantiation">
<description>
Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead.
Note that new Boolean() is deprecated since JDK 9 for that reason.
</description>
<priority>2</priority>
<example>
@ -272,6 +273,7 @@ Boolean buz = Boolean.valueOf(false); // ...., just reference Boolean.FALSE;
<description>
Calling new Byte() causes memory allocation that can be avoided by the static Byte.valueOf().
It makes use of an internal cache that recycles earlier instances making it more memory efficient.
Note that new Byte() is deprecated since JDK 9 for that reason.
</description>
<priority>2</priority>
<properties>
@ -419,6 +421,7 @@ good.append("This is a long string, which is pre-sized");
<description>
Calling new Integer() causes memory allocation that can be avoided by the static Integer.valueOf().
It makes use of an internal cache that recycles earlier instances making it more memory efficient.
Note that new Integer() is deprecated since JDK 9 for that reason.
</description>
<priority>2</priority>
<properties>
@ -452,6 +455,7 @@ public class Foo {
<description>
Calling new Long() causes memory allocation that can be avoided by the static Long.valueOf().
It makes use of an internal cache that recycles earlier instances making it more memory efficient.
Note that new Long() is deprecated since JDK 9 for that reason.
</description>
<priority>2</priority>
<properties>
@ -616,6 +620,7 @@ public class Foo {
<description>
Calling new Short() causes memory allocation that can be avoided by the static Short.valueOf().
It makes use of an internal cache that recycles earlier instances making it more memory efficient.
Note that new Short() is deprecated since JDK 9 for that reason.
</description>
<priority>2</priority>
<properties>