PMD CI (pmd-bot)
2021-05-08 18:20:03 +00:00
parent 65e1825230
commit d3cb0dd34e
5 changed files with 27 additions and 12 deletions

View File

@ -5,8 +5,8 @@
<description>Intended as a documentation theme based on Jekyll for technical writers documenting software and other technical products, this theme has all the elements you would need to handle multiple products with both multi-level sidebar navigation, tags, and other documentation features.</description>
<link>https://pmd.github.io/pmd/</link>
<atom:link href="https://pmd.github.io/pmd/feed.xml" rel="self" type="application/rss+xml"/>
<pubDate>Sat, 08 May 2021 17:11:38 +0000</pubDate>
<lastBuildDate>Sat, 08 May 2021 17:11:38 +0000</lastBuildDate>
<pubDate>Sat, 08 May 2021 18:16:56 +0000</pubDate>
<lastBuildDate>Sat, 08 May 2021 18:16:56 +0000</lastBuildDate>
<generator>Jekyll v3.9.0</generator>
</channel>

View File

@ -1449,6 +1449,17 @@ are compared. Constants are identified by looking for an all-caps identifier.</l
<li><a href="https://github.com/pmd/pmd/issues/3230">#3230</a>: [doc] Remove “Edit me” button for language index pages</li>
</ul>
</li>
<li>dist
<ul>
<li><a href="https://github.com/pmd/pmd/issues/2466">#2466</a>: [dist] Distribution archive doesnt include all batch scripts</li>
</ul>
</li>
<li>java-bestpractices
<ul>
<li><a href="https://github.com/pmd/pmd/issues/2737">#2737</a>: [java] Fix misleading rule message on rule SwitchStmtsShouldHaveDefault with non-exhaustive enum switch</li>
<li><a href="https://github.com/pmd/pmd/issues/3236">#3236</a>: [java] LiteralsFirstInComparisons should consider constant fields (contd)</li>
</ul>
</li>
<li>java-codestyle
<ul>
<li><a href="https://github.com/pmd/pmd/issues/2655">#2655</a>: [java] UnnecessaryImport false positive for on-demand imports</li>
@ -1459,6 +1470,7 @@ are compared. Constants are identified by looking for an all-caps identifier.</l
</li>
<li>java-errorprone
<ul>
<li><a href="https://github.com/pmd/pmd/issues/3248">#3248</a>: [java] Documentation is wrong for SingletonClassReturningNewInstance rule</li>
<li><a href="https://github.com/pmd/pmd/issues/3110">#3110</a>: [java] Enhance CompareObjectsWithEquals with list of exceptions</li>
<li><a href="https://github.com/pmd/pmd/issues/3205">#3205</a>: [java] Make CompareObjectWithEquals allow comparing against constants</li>
</ul>

View File

@ -1465,7 +1465,7 @@ $('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3
<li><a href="pmd_rules_java_bestpractices.html#replaceenumerationwithiterator">ReplaceEnumerationWithIterator</a>: Consider replacing Enumeration usages with the newer java.util.Iterator</li>
<li><a href="pmd_rules_java_bestpractices.html#replacehashtablewithmap">ReplaceHashtableWithMap</a>: Consider replacing Hashtable usage with the newer java.util.Map if thread safety is not required.</li>
<li><a href="pmd_rules_java_bestpractices.html#replacevectorwithlist">ReplaceVectorWithList</a>: Consider replacing Vector usages with the newer java.util.ArrayList if expensive thread-safe oper…</li>
<li><a href="pmd_rules_java_bestpractices.html#switchstmtsshouldhavedefault">SwitchStmtsShouldHaveDefault</a>: All switch statements should include a default option to catch any unspecified values.</li>
<li><a href="pmd_rules_java_bestpractices.html#switchstmtsshouldhavedefault">SwitchStmtsShouldHaveDefault</a>: Switch statements should be exhaustive, to make their control flow easier to follow. …</li>
<li><a href="pmd_rules_java_bestpractices.html#systemprintln">SystemPrintln</a>: References to System.(out|err).print are usually intended for debugging purposes and can remain …</li>
<li><a href="pmd_rules_java_bestpractices.html#unusedassignment">UnusedAssignment</a>: Reports assignments to variables that are never used before the variable is overwritten, …</li>
<li><a href="pmd_rules_java_bestpractices.html#unusedformalparameter">UnusedFormalParameter</a>: Reports parameters of methods and constructors that are not referenced them in the method body. P…</li>
@ -1706,7 +1706,7 @@ $('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3
<li><a href="pmd_rules_java_errorprone.html#returnfromfinallyblock">ReturnFromFinallyBlock</a>: Avoid returning from a finally block, this can discard exceptions.</li>
<li><a href="pmd_rules_java_errorprone.html#simpledateformatneedslocale">SimpleDateFormatNeedsLocale</a>: Be sure to specify a Locale when creating SimpleDateFormat instances to ensure that locale-approp…</li>
<li><a href="pmd_rules_java_errorprone.html#singlemethodsingleton">SingleMethodSingleton</a>: Some classes contain overloaded getInstance. The problem with overloaded getInstance methods is t…</li>
<li><a href="pmd_rules_java_errorprone.html#singletonclassreturningnewinstance">SingletonClassReturningNewInstance</a>: Some classes contain overloaded getInstance. The problem with overloaded getInstance methods is t</li>
<li><a href="pmd_rules_java_errorprone.html#singletonclassreturningnewinstance">SingletonClassReturningNewInstance</a>: A singleton class should only ever have one instance. Failure to check whether an ins</li>
<li><a href="pmd_rules_java_errorprone.html#staticejbfieldshouldbefinal">StaticEJBFieldShouldBeFinal</a>: According to the J2EE specification, an EJB should not have any static fields with write access. …</li>
<li><a href="pmd_rules_java_errorprone.html#stringbufferinstantiationwithchar">StringBufferInstantiationWithChar</a>: Individual character values provided as initialization arguments will be converted into integers….</li>
<li><a href="pmd_rules_java_errorprone.html#suspiciousequalsmethodname">SuspiciousEqualsMethodName</a>: The method name and parameter number are suspiciously close to Object.equals, which can denote …</li>

View File

@ -2927,7 +2927,10 @@ effectively.</p>
<p><strong>Priority:</strong> Medium (3)</p>
<p>All switch statements should include a default option to catch any unspecified values.</p>
<p>Switch statements should be exhaustive, to make their control flow
easier to follow. This can be achieved by adding a <code class="language-plaintext highlighter-rouge">default</code> case, or,
if the switch is on an enum type, by ensuring there is one switch branch
for each enum constant.</p>
<p><strong>This rule is defined by the following XPath expression:</strong></p>
<div class="language-xpath highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">//</span><span class="nt">SwitchStatement</span><span class="p">[</span><span class="na">@DefaultCase</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nf">false</span><span class="p">()</span><span class="w"> </span><span class="ow">and</span><span class="w"> </span><span class="na">@ExhaustiveEnumSwitch</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nf">false</span><span class="p">()]</span><span class="w">
@ -2935,14 +2938,14 @@ effectively.</p>
<p><strong>Example(s):</strong></p>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kt">void</span> <span class="nf">bar</span><span class="o">()</span> <span class="o">{</span>
<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">class</span> <span class="nc">Foo</span> <span class="o">{{</span>
<span class="kt">int</span> <span class="n">x</span> <span class="o">=</span> <span class="mi">2</span><span class="o">;</span>
<span class="k">switch</span> <span class="o">(</span><span class="n">x</span><span class="o">)</span> <span class="o">{</span>
<span class="k">case</span> <span class="mi">1</span><span class="o">:</span> <span class="kt">int</span> <span class="n">j</span> <span class="o">=</span> <span class="mi">6</span><span class="o">;</span>
<span class="k">case</span> <span class="mi">2</span><span class="o">:</span> <span class="kt">int</span> <span class="n">j</span> <span class="o">=</span> <span class="mi">8</span><span class="o">;</span>
<span class="c1">// missing default: here</span>
<span class="c1">// missing default: here</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}}</span>
</code></pre></div></div>
<p><strong>Use this rule by referencing it:</strong></p>

View File

@ -4633,9 +4633,9 @@ for each call and new objects will be created for every invocation.</p>
<p><strong>Priority:</strong> Medium High (2)</p>
<p>Some classes contain overloaded getInstance. The problem with overloaded getInstance methods
is that the instance created using the overloaded method is not cached and so,
for each call and new objects will be created for every invocation.</p>
<p>A singleton class should only ever have one instance. Failure to check
whether an instance has already been created may result in multiple
instances being created.</p>
<p><strong>This rule is defined by the following Java class:</strong> <a href="https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/SingletonClassReturningNewInstanceRule.java">net.sourceforge.pmd.lang.java.rule.errorprone.SingletonClassReturningNewInstanceRule</a></p>
@ -4645,7 +4645,7 @@ for each call and new objects will be created for every invocation.</p>
<span class="kd">private</span> <span class="kd">static</span> <span class="nc">Singleton</span> <span class="n">instance</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<span class="kd">public</span> <span class="kd">static</span> <span class="nc">Singleton</span> <span class="nf">getInstance</span><span class="o">()</span> <span class="o">{</span>
<span class="kd">synchronized</span><span class="o">(</span><span class="nc">Singleton</span><span class="o">.</span><span class="na">class</span><span class="o">)</span> <span class="o">{</span>
<span class="k">return</span> <span class="k">new</span> <span class="nf">Singleton</span><span class="o">();</span>
<span class="k">return</span> <span class="k">new</span> <span class="nf">Singleton</span><span class="o">();</span> <span class="c1">// this should be assigned to the field</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>