[java] Deprecate rule BooleanInstantiation

This commit is contained in:
Andreas Dangel
2021-07-29 16:58:47 +02:00
parent 33f9ff3394
commit ee4cbae4ac
2 changed files with 3 additions and 1 deletions

View File

@ -347,10 +347,13 @@ bi4 = new BigInteger(0); // reference BigInteger.ZERO instead
since="1.2"
message="Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE or call Boolean.valueOf() instead."
class="net.sourceforge.pmd.lang.java.rule.performance.BooleanInstantiationRule"
deprecated="true"
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.
Deprecated since PMD 6.37.0, use {% rule java/bestpractices/PrimitiveWrapperInstantiation %} instead.
</description>
<priority>2</priority>
<example>

View File

@ -302,7 +302,6 @@
<!-- <rule ref="category/java/performance.xml/AvoidInstantiatingObjectsInLoops" /> -->
<!-- <rule ref="category/java/performance.xml/AvoidUsingShortType"/> -->
<rule ref="category/java/performance.xml/BigIntegerInstantiation"/>
<rule ref="category/java/performance.xml/BooleanInstantiation"/>
<!-- <rule ref="category/java/performance.xml/ConsecutiveAppendsShouldReuse" /> -->
<!-- <rule ref="category/java/performance.xml/ConsecutiveLiteralAppends" /> -->
<!-- <rule ref="category/java/performance.xml/InefficientEmptyStringCheck" /> -->