pmd/pmd_rules_java.html
Travis CI (pmd-bot) 121aa1e8e2 Update documentation
TRAVIS_JOB_NUMBER=3045.2
TRAVIS_COMMIT_RANGE=b0518c902fd0...1cfc477e4877
2018-11-11 13:30:16 +00:00

1931 lines
143 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Index of all built-in rules available for Java">
<meta name="keywords" content="rule_referencesjava, ">
<title>Java Rules | PMD Source Code Analyzer</title>
<link rel="stylesheet" href="css/syntax.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">-->
<link rel="stylesheet" href="css/modern-business.css">
<link rel="stylesheet" href="css/lavish-bootstrap.css">
<link rel="stylesheet" href="css/customstyles.css">
<link rel="stylesheet" href="css/theme-blue.css">
<link rel="stylesheet" href="css/pmd-customstyles.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="js/jquery.navgoco.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/2.0.0/anchor.min.js"></script>
<script src="js/toc.js"></script>
<script src="js/customscripts.js"></script>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="" href="https://pmd.github.io/pmd/feed.xml">
<script>
$(document).ready(function() {
// Initialize navgoco with default options
$("#mysidebar").navgoco({
caretHtml: '',
accordion: true,
openClass: 'active', // open
save: false, // leave false or nav highlighting doesn't work right
cookie: {
name: 'navgoco',
expires: false,
path: '/'
},
slide: {
duration: 400,
easing: 'swing'
}
});
$("#collapseAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', false);
});
$("#expandAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', true);
});
});
</script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<script>
$(document).ready(function() {
$("#tg-sb-link").click(function() {
$("#tg-sb-sidebar").toggle();
$("#tg-sb-content").toggleClass('col-md-9');
$("#tg-sb-content").toggleClass('col-md-12');
$("#tg-sb-icon").toggleClass('fa-toggle-on');
$("#tg-sb-icon").toggleClass('fa-toggle-off');
});
});
</script>
</head>
<body>
<!-- Content is offset by the height of the topnav bar. -->
<!-- There's already a padding-top rule in modern-business.css, but it apparently doesn't work on Firefox 60 and Chrome 67 -->
<div id="topbar-content-offset">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container topnavlinks">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="fa fa-home fa-lg navbar-brand" href="index.html">&nbsp;<span class="projectTitle"> PMD Source Code Analyzer Project</span></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<!-- toggle sidebar button -->
<li><a id="tg-sb-link" href="#"><i id="tg-sb-icon" class="fa fa-toggle-on"></i> Nav</a></li>
<!-- entries without drop-downs appear here -->
<li><a href="https://github.com/pmd/pmd/releases/latest" target="_blank">Download</a></li>
<li><a href="https://github.com/pmd/pmd" target="_blank">Fork us on github</a></li>
<!-- entries with drop-downs appear here -->
<!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
<!--comment out this block if you want to hide search-->
<li>
<!--start search-->
<div id="search-demo-container">
<input type="text" id="search-input" placeholder="search...">
<ul id="results-container"></ul>
</div>
<script src="js/jekyll-search.js" type="text/javascript"></script>
<script type="text/javascript">
SimpleJekyllSearch.init({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
dataSource: 'search.json',
searchResultTemplate: '<li><a href="{url}" title="Java Rules">{title}</a></li>',
noResultsText: 'No results found.',
limit: 10,
fuzzy: true,
})
</script>
<!--end search-->
</li>
</ul>
</div>
</div>
<!-- /.container -->
</nav>
<!-- Page Content -->
<div class="container">
<div class="col-lg-12">&nbsp;</div>
<!-- Content Row -->
<div class="row">
<!-- Sidebar Column -->
<div class="col-md-3" id="tg-sb-sidebar">
<ul id="mysidebar" class="nav">
<li class="sidebarTitle">PMD 6.10.0</li>
<li>
<a href="#">About</a>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="pmd_release_notes.html">Release notes</a></li>
<li><a href="pmd_about_help.html">Getting help</a></li>
</ul>
</li>
<li>
<a href="#">User Documentation</a>
<ul>
<li><a href="pmd_userdocs_installation.html">Installation and basic CLI usage</a></li>
<li><a href="pmd_userdocs_making_rulesets.html">Making rulesets</a></li>
<li><a href="pmd_userdocs_configuring_rules.html">Configuring rules</a></li>
<li><a href="pmd_userdocs_best_practices.html">Best practices</a></li>
<li><a href="pmd_userdocs_suppressing_warnings.html">Suppressing warnings</a></li>
<li><a href="pmd_userdocs_incremental_analysis.html">Incremental analysis</a></li>
<li><a href="pmd_userdocs_cli_reference.html">PMD CLI reference</a></li>
<li class="subfolders">
<a href="#">Extending PMD</a>
<ul>
<li><a href="pmd_userdocs_extending_writing_pmd_rules.html">Writing a rule</a></li>
<li><a href="pmd_userdocs_extending_writing_xpath_rules.html">Writing XPath rules</a></li>
<li><a href="pmd_userdocs_extending_defining_properties.html">Defining rule properties</a></li>
<li><a href="pmd_userdocs_extending_metrics_howto.html">Using and defining code metrics</a></li>
<li><a href="pmd_userdocs_extending_rule_guidelines.html">Rule guidelines</a></li>
<li><a href="pmd_userdocs_extending_testing.html">Testing your rules</a></li>
</ul>
</li>
<li><a href="pmd_userdocs_cpd.html">Copy-paste detection</a></li>
<li class="subfolders">
<a href="#">Tools / Integrations</a>
<ul>
<li><a href="pmd_userdocs_tools_maven.html">Maven PMD plugin</a></li>
<li><a href="pmd_userdocs_tools_ant.html">Ant</a></li>
<li><a href="pmd_userdocs_tools_ci.html">CI integrations</a></li>
<li><a href="pmd_userdocs_tools.html">Other Tools / Integrations</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#">Rule Reference</a>
<ul>
<li class="subfolders">
<a href="#">Apex Rules</a>
<ul>
<li><a href="pmd_rules_apex.html">Index</a></li>
<li><a href="pmd_rules_apex_bestpractices.html">Best Practices</a></li>
<li><a href="pmd_rules_apex_codestyle.html">Code Style</a></li>
<li><a href="pmd_rules_apex_design.html">Design</a></li>
<li><a href="pmd_rules_apex_errorprone.html">Error Prone</a></li>
<li><a href="pmd_rules_apex_performance.html">Performance</a></li>
<li><a href="pmd_rules_apex_security.html">Security</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Ecmascript Rules</a>
<ul>
<li><a href="pmd_rules_ecmascript.html">Index</a></li>
<li><a href="pmd_rules_ecmascript_bestpractices.html">Best Practices</a></li>
<li><a href="pmd_rules_ecmascript_codestyle.html">Code Style</a></li>
<li><a href="pmd_rules_ecmascript_errorprone.html">Error Prone</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Java Rules</a>
<ul>
<li class="active"><a href="pmd_rules_java.html">Index</a></li>
<li><a href="pmd_rules_java_bestpractices.html">Best Practices</a></li>
<li><a href="pmd_rules_java_codestyle.html">Code Style</a></li>
<li><a href="pmd_rules_java_design.html">Design</a></li>
<li><a href="pmd_rules_java_documentation.html">Documentation</a></li>
<li><a href="pmd_rules_java_errorprone.html">Error Prone</a></li>
<li><a href="pmd_rules_java_multithreading.html">Multithreading</a></li>
<li><a href="pmd_rules_java_performance.html">Performance</a></li>
<li><a href="pmd_rules_java_security.html">Security</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Java Server Pages Rules</a>
<ul>
<li><a href="pmd_rules_jsp.html">Index</a></li>
<li><a href="pmd_rules_jsp_bestpractices.html">Best Practices</a></li>
<li><a href="pmd_rules_jsp_codestyle.html">Code Style</a></li>
<li><a href="pmd_rules_jsp_design.html">Design</a></li>
<li><a href="pmd_rules_jsp_errorprone.html">Error Prone</a></li>
<li><a href="pmd_rules_jsp_security.html">Security</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Maven POM Rules</a>
<ul>
<li><a href="pmd_rules_pom.html">Index</a></li>
<li><a href="pmd_rules_pom_errorprone.html">Error Prone</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">PLSQL Rules</a>
<ul>
<li><a href="pmd_rules_plsql.html">Index</a></li>
<li><a href="pmd_rules_plsql_bestpractices.html">Best Practices</a></li>
<li><a href="pmd_rules_plsql_codestyle.html">Code Style</a></li>
<li><a href="pmd_rules_plsql_design.html">Design</a></li>
<li><a href="pmd_rules_plsql_errorprone.html">Error Prone</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Salesforce VisualForce Rules</a>
<ul>
<li><a href="pmd_rules_vf.html">Index</a></li>
<li><a href="pmd_rules_vf_security.html">Security</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">VM Rules</a>
<ul>
<li><a href="pmd_rules_vm.html">Index</a></li>
<li><a href="pmd_rules_vm_bestpractices.html">Best Practices</a></li>
<li><a href="pmd_rules_vm_design.html">Design</a></li>
<li><a href="pmd_rules_vm_errorprone.html">Error Prone</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">XML Rules</a>
<ul>
<li><a href="pmd_rules_xml.html">Index</a></li>
<li><a href="pmd_rules_xml_errorprone.html">Error Prone</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">XSL Rules</a>
<ul>
<li><a href="pmd_rules_xsl.html">Index</a></li>
<li><a href="pmd_rules_xsl_codestyle.html">Code Style</a></li>
<li><a href="pmd_rules_xsl_performance.html">Performance</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#">Language Specific Documentation</a>
<ul>
<li><a href="pmd_languages_jsp.html">JSP Support</a></li>
<li><a href="pmd_java_metrics_index.html">Java code metrics</a></li>
<li><a href="pmd_apex_metrics_index.html">Apex code metrics</a></li>
</ul>
</li>
<li>
<a href="#">Developer Documentation</a>
<ul>
<li><a href="pmd_devdocs_development.html">Developer resources</a></li>
<li><a href="pmd_devdocs_building.html">Building PMD from source</a></li>
<li><a href="https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md" target="_blank">Contributing</a></li>
<li><a href="pmd_devdocs_writing_documentation.html">Writing documentation</a></li>
<li><a href="pmd_devdocs_roadmap.html">Roadmap</a></li>
<li><a href="pmd_devdocs_how_pmd_works.html">How PMD works</a></li>
<li><a href="pmd_devdocs_pmdtester.html">Pmdtester</a></li>
<li class="subfolders">
<a href="#">Major contributions</a>
<ul>
<li><a href="pmd_devdocs_major_adding_new_language.html">Adding a new language</a></li>
<li><a href="pmd_devdocs_major_adding_new_cpd_language.html">Adding a new CPD language</a></li>
<li><a href="pmd_devdocs_major_adding_new_metrics_framework.html">Adding metrics support to a language</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#">Project documentation</a>
<ul>
<li class="subfolders">
<a href="#">Trivia about PMD</a>
<ul>
<li><a href="pmd_projectdocs_trivia_news.html">PMD in the press</a></li>
<li><a href="pmd_projectdocs_trivia_products.html">Products & books related to PMD</a></li>
<li><a href="pmd_projectdocs_trivia_similarprojects.html">Similar projects</a></li>
<li><a href="pmd_projectdocs_trivia_meaning.html">What does 'PMD' mean?</a></li>
</ul>
</li>
<li><a href="pmd_projectdocs_faq.html">FAQ</a></li>
<li><a href="license.html">License</a></li>
<li><a href="pmd_projectdocs_credits.html">Credits</a></li>
<li><a href="pmd_release_notes_old.html">Old release notes</a></li>
<li class="subfolders">
<a href="#">Project management</a>
<ul>
<li><a href="pmd_projectdocs_committers_releasing.html">Release process</a></li>
<li><a href="pmd_projectdocs_committers_merging_pull_requests.html">Merging pull requests</a></li>
</ul>
</li>
</ul>
</li>
<!-- if you aren't using the accordion, uncomment this block:
<p class="external">
<a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
</p>
-->
</ul>
<!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
<script>$("li.active").parents('li').toggleClass("active");</script>
</div>
<!-- Content Column -->
<div class="col-md-9" id="tg-sb-content">
<div class="post-header">
<h1 class="post-title-main">Java Rules</h1>
</div>
<div class="post-content">
<div class="summary">Index of all built-in rules available for Java</div>
<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
<script>
$( document ).ready(function() {
// Handler for .ready() called.
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
});
</script>
<div id="toc"></div>
<a target="_blank" href="https://github.com/pmd/pmd/blob/master/docs/pages/pmd/rules/java.md" class="btn btn-default githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>
<h2 id="best-practices">Best Practices</h2>
<div class="bs-callout bs-callout-">Rules which enforce generally accepted best practices.</div>
<ul>
<li><a href="pmd_rules_java_bestpractices.html#abstractclasswithoutabstractmethod">AbstractClassWithoutAbstractMethod</a>: The abstract class does not contain any abstract methods. An abstract class suggestsan incomplete…</li>
<li><a href="pmd_rules_java_bestpractices.html#accessorclassgeneration">AccessorClassGeneration</a>: Instantiation by way of private constructors from outside of the constructors class often causes…</li>
<li><a href="pmd_rules_java_bestpractices.html#accessormethodgeneration">AccessorMethodGeneration</a>: When accessing a private field / method from another class, the Java compiler will generate a acc…</li>
<li><a href="pmd_rules_java_bestpractices.html#arrayisstoreddirectly">ArrayIsStoredDirectly</a>: Constructors and methods receiving arrays should clone objects and store the copy.This prevents f…</li>
<li><a href="pmd_rules_java_bestpractices.html#avoidprintstacktrace">AvoidPrintStackTrace</a>: Avoid printStackTrace(); use a logger call instead.</li>
<li><a href="pmd_rules_java_bestpractices.html#avoidreassigningparameters">AvoidReassigningParameters</a>: Reassigning values to incoming parameters is not recommended. Use temporary local variables inst…</li>
<li><a href="pmd_rules_java_bestpractices.html#avoidstringbufferfield">AvoidStringBufferField</a>: StringBuffers/StringBuilders can grow considerably, and so may become a source of memory leaksif …</li>
<li><a href="pmd_rules_java_bestpractices.html#avoidusinghardcodedip">AvoidUsingHardCodedIP</a>: Application with hard-coded IP addresses can become impossible to deploy in some cases.Externaliz…</li>
<li><a href="pmd_rules_java_bestpractices.html#checkresultset">CheckResultSet</a>: Always check the return values of navigation methods (next, previous, first, last) of a ResultSet…</li>
<li><a href="pmd_rules_java_bestpractices.html#constantsininterface">ConstantsInInterface</a>: Avoid constants in interfaces. Interfaces should define types, constants are implementation detai…</li>
<li><a href="pmd_rules_java_bestpractices.html#defaultlabelnotlastinswitchstmt">DefaultLabelNotLastInSwitchStmt</a>: By convention, the default label should be the last label in a switch statement.</li>
<li><a href="pmd_rules_java_bestpractices.html#forloopcanbeforeach">ForLoopCanBeForeach</a>: Reports loops that can be safely replaced with the foreach syntax. The rule considers loops overl…</li>
<li><a href="pmd_rules_java_bestpractices.html#guardlogstatement">GuardLogStatement</a>: Whenever using a log level, one should check if the loglevel is actually enabled, orotherwise ski…</li>
<li><a href="pmd_rules_java_bestpractices.html#junit4suitesshouldusesuiteannotation">JUnit4SuitesShouldUseSuiteAnnotation</a>: In JUnit 3, test suites are indicated by the suite() method. In JUnit 4, suites are indicatedthro…</li>
<li><a href="pmd_rules_java_bestpractices.html#junit4testshoulduseafterannotation">JUnit4TestShouldUseAfterAnnotation</a>: In JUnit 3, the tearDown method was used to clean up all data entities required in running tests….</li>
<li><a href="pmd_rules_java_bestpractices.html#junit4testshouldusebeforeannotation">JUnit4TestShouldUseBeforeAnnotation</a>: In JUnit 3, the setUp method was used to set up all data entities required in running tests. JUni…</li>
<li><a href="pmd_rules_java_bestpractices.html#junit4testshouldusetestannotation">JUnit4TestShouldUseTestAnnotation</a>: In JUnit 3, the framework executed all methods which started with the word test as a unit test. I…</li>
<li><a href="pmd_rules_java_bestpractices.html#junitassertionsshouldincludemessage">JUnitAssertionsShouldIncludeMessage</a>: JUnit assertions should include an informative message - i.e., use the three-argument version of …</li>
<li><a href="pmd_rules_java_bestpractices.html#junittestcontainstoomanyasserts">JUnitTestContainsTooManyAsserts</a>: Unit tests should not contain too many asserts. Many asserts are indicative of a complex test, fo…</li>
<li><a href="pmd_rules_java_bestpractices.html#junittestsshouldincludeassert">JUnitTestsShouldIncludeAssert</a>: JUnit tests should include at least one assertion. This makes the tests more robust, and using a…</li>
<li><a href="pmd_rules_java_bestpractices.html#junituseexpected">JUnitUseExpected</a>: In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions.</li>
<li><a href="pmd_rules_java_bestpractices.html#loosecoupling">LooseCoupling</a>: The use of implementation types (i.e., HashSet) as object references limits your ability to use a…</li>
<li><a href="pmd_rules_java_bestpractices.html#methodreturnsinternalarray">MethodReturnsInternalArray</a>: Exposing internal arrays to the caller violates object encapsulation since elements can be remove…</li>
<li><a href="pmd_rules_java_bestpractices.html#missingoverride">MissingOverride</a>: Annotating overridden methods with @Override ensures at compile time that the method r…</li>
<li><a href="pmd_rules_java_bestpractices.html#onedeclarationperline">OneDeclarationPerLine</a>: Java allows the use of several variables declaration of the same type on one line. However, itcan…</li>
<li><a href="pmd_rules_java_bestpractices.html#positionliteralsfirstincaseinsensitivecomparisons">PositionLiteralsFirstInCaseInsensitiveComparisons</a>: Position literals first in comparisons, if the second argument is null then NullPointerExceptions…</li>
<li><a href="pmd_rules_java_bestpractices.html#positionliteralsfirstincomparisons">PositionLiteralsFirstInComparisons</a>: Position literals first in comparisons, if the second argument is null then NullPointerExceptions…</li>
<li><a href="pmd_rules_java_bestpractices.html#preservestacktrace">PreserveStackTrace</a>: Throwing a new exception from a catch block without passing the original exception into thenew ex…</li>
<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#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#unusedformalparameter">UnusedFormalParameter</a>: Avoid passing parameters to methods or constructors without actually referencing them in the meth…</li>
<li><a href="pmd_rules_java_bestpractices.html#unusedimports">UnusedImports</a>: Avoid unused import statements to prevent unwanted dependencies.This rule will also find unused o…</li>
<li><a href="pmd_rules_java_bestpractices.html#unusedlocalvariable">UnusedLocalVariable</a>: Detects when a local variable is declared and/or assigned, but not used.</li>
<li><a href="pmd_rules_java_bestpractices.html#unusedprivatefield">UnusedPrivateField</a>: Detects when a private field is declared and/or assigned a value, but not used.</li>
<li><a href="pmd_rules_java_bestpractices.html#unusedprivatemethod">UnusedPrivateMethod</a>: Unused Private Method detects when a private method is declared but is unused.</li>
<li><a href="pmd_rules_java_bestpractices.html#useassertequalsinsteadofasserttrue">UseAssertEqualsInsteadOfAssertTrue</a>: This rule detects JUnit assertions in object equality. These assertions should be made by more sp…</li>
<li><a href="pmd_rules_java_bestpractices.html#useassertnullinsteadofasserttrue">UseAssertNullInsteadOfAssertTrue</a>: This rule detects JUnit assertions in object references equality. These assertions should be made…</li>
<li><a href="pmd_rules_java_bestpractices.html#useassertsameinsteadofasserttrue">UseAssertSameInsteadOfAssertTrue</a>: This rule detects JUnit assertions in object references equality. These assertions should be made…</li>
<li><a href="pmd_rules_java_bestpractices.html#useasserttrueinsteadofassertequals">UseAssertTrueInsteadOfAssertEquals</a>: When asserting a value is the same as a literal or Boxed boolean, use assertTrue/assertFalse, ins…</li>
<li><a href="pmd_rules_java_bestpractices.html#usecollectionisempty">UseCollectionIsEmpty</a>: The isEmpty() method on java.util.Collection is provided to determine if a collection has any ele…</li>
<li><a href="pmd_rules_java_bestpractices.html#usevarargs">UseVarargs</a>: Java 5 introduced the varargs parameter declaration for methods and constructors. This syntactic…</li>
</ul>
<h2 id="code-style">Code Style</h2>
<div class="bs-callout bs-callout-">Rules which enforce a specific coding style.</div>
<ul>
<li><a href="pmd_rules_java_codestyle.html#abstractnaming">AbstractNaming</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Abstract classes should be named AbstractXXX.</li>
<li><a href="pmd_rules_java_codestyle.html#atleastoneconstructor">AtLeastOneConstructor</a>: Each non-static class should declare at least one constructor.Classes with solely static members …</li>
<li><a href="pmd_rules_java_codestyle.html#avoiddollarsigns">AvoidDollarSigns</a>: Avoid using dollar signs in variable/method/class/interface names.</li>
<li><a href="pmd_rules_java_codestyle.html#avoidfinallocalvariable">AvoidFinalLocalVariable</a>: Avoid using final local variables, turn them into fields.</li>
<li><a href="pmd_rules_java_codestyle.html#avoidprefixingmethodparameters">AvoidPrefixingMethodParameters</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Prefixing parameters by in or out pollutes the name of the parameters and reduces code readab…</li>
<li><a href="pmd_rules_java_codestyle.html#avoidprotectedfieldinfinalclass">AvoidProtectedFieldInFinalClass</a>: Do not use protected fields in final classes since they cannot be subclassed.Clarify your intent …</li>
<li><a href="pmd_rules_java_codestyle.html#avoidprotectedmethodinfinalclassnotextending">AvoidProtectedMethodInFinalClassNotExtending</a>: Do not use protected methods in most final classes since they cannot be subclassed. This shouldon…</li>
<li><a href="pmd_rules_java_codestyle.html#avoidusingnativecode">AvoidUsingNativeCode</a>: Unnecessary reliance on Java Native Interface (JNI) calls directly reduces application portabilit…</li>
<li><a href="pmd_rules_java_codestyle.html#booleangetmethodname">BooleanGetMethodName</a>: Methods that return boolean results should be named as predicate statements to denote this.I.e, ‘…</li>
<li><a href="pmd_rules_java_codestyle.html#callsuperinconstructor">CallSuperInConstructor</a>: It is a good practice to call super() in a constructor. If super() is not called butanother const…</li>
<li><a href="pmd_rules_java_codestyle.html#classnamingconventions">ClassNamingConventions</a>: Configurable naming conventions for type declarations. This rule reports type declarat…</li>
<li><a href="pmd_rules_java_codestyle.html#commentdefaultaccessmodifier">CommentDefaultAccessModifier</a>: To avoid mistakes if we want that a Method, Constructor, Field or Nested class have a default acc…</li>
<li><a href="pmd_rules_java_codestyle.html#confusingternary">ConfusingTernary</a>: Avoid negation within an “if” expression with an “else” clause. For example, rephrase:if (x != …</li>
<li><a href="pmd_rules_java_codestyle.html#controlstatementbraces">ControlStatementBraces</a>: Enforce a policy for braces on control statements. It is recommended to use braces on if … els…</li>
<li><a href="pmd_rules_java_codestyle.html#defaultpackage">DefaultPackage</a>: Use explicit scoping instead of accidental usage of default package private level.The rule allows…</li>
<li><a href="pmd_rules_java_codestyle.html#dontimportjavalang">DontImportJavaLang</a>: Avoid importing anything from the package java.lang. These classes are automatically imported …</li>
<li><a href="pmd_rules_java_codestyle.html#duplicateimports">DuplicateImports</a>: Duplicate or overlapping import statements should be avoided.</li>
<li><a href="pmd_rules_java_codestyle.html#emptymethodinabstractclassshouldbeabstract">EmptyMethodInAbstractClassShouldBeAbstract</a>: Empty or auto-generated methods in an abstract class should be tagged as abstract. This helps to …</li>
<li><a href="pmd_rules_java_codestyle.html#extendsobject">ExtendsObject</a>: No need to explicitly extend Object.</li>
<li><a href="pmd_rules_java_codestyle.html#fielddeclarationsshouldbeatstartofclass">FieldDeclarationsShouldBeAtStartOfClass</a>: Fields should be declared at the top of the class, before any method declarations, constructors, …</li>
<li><a href="pmd_rules_java_codestyle.html#fieldnamingconventions">FieldNamingConventions</a>: Configurable naming conventions for field declarations. This rule reports variable declarations …</li>
<li><a href="pmd_rules_java_codestyle.html#forloopshouldbewhileloop">ForLoopShouldBeWhileLoop</a>: Some for loops can be simplified to while loops, this makes them more concise.</li>
<li><a href="pmd_rules_java_codestyle.html#forloopsmustusebraces">ForLoopsMustUseBraces</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using for statements without using curly braces. If the code formatting or indentation is…</li>
<li><a href="pmd_rules_java_codestyle.html#formalparameternamingconventions">FormalParameterNamingConventions</a>: Configurable naming conventions for formal parameters of methods and lambdas. This rul…</li>
<li><a href="pmd_rules_java_codestyle.html#genericsnaming">GenericsNaming</a>: Names for references to generic values should be limited to a single uppercase letter.</li>
<li><a href="pmd_rules_java_codestyle.html#identicalcatchbranches">IdenticalCatchBranches</a>: Identical catch branches use up vertical space and increase the complexity of code without …</li>
<li><a href="pmd_rules_java_codestyle.html#ifelsestmtsmustusebraces">IfElseStmtsMustUseBraces</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using if..else statements without using surrounding braces. If the code formatting or inden…</li>
<li><a href="pmd_rules_java_codestyle.html#ifstmtsmustusebraces">IfStmtsMustUseBraces</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using if statements without using braces to surround the code block. If the code formatting…</li>
<li><a href="pmd_rules_java_codestyle.html#linguisticnaming">LinguisticNaming</a>: This rule finds Linguistic Naming Antipatterns. It checks for fields, that are named, as if they …</li>
<li><a href="pmd_rules_java_codestyle.html#localhomenamingconvention">LocalHomeNamingConvention</a>: The Local Home interface of a Session EJB should be suffixed by LocalHome.</li>
<li><a href="pmd_rules_java_codestyle.html#localinterfacesessionnamingconvention">LocalInterfaceSessionNamingConvention</a>: The Local Interface of a Session EJB should be suffixed by Local.</li>
<li><a href="pmd_rules_java_codestyle.html#localvariablecouldbefinal">LocalVariableCouldBeFinal</a>: A local variable assigned only once can be declared final.</li>
<li><a href="pmd_rules_java_codestyle.html#localvariablenamingconventions">LocalVariableNamingConventions</a>: Configurable naming conventions for local variable declarations and other locally-scoped …</li>
<li><a href="pmd_rules_java_codestyle.html#longvariable">LongVariable</a>: Fields, formal arguments, or local variable names that are too long can make the code difficult t…</li>
<li><a href="pmd_rules_java_codestyle.html#mdbandsessionbeannamingconvention">MDBAndSessionBeanNamingConvention</a>: The EJB Specification states that any MessageDrivenBean or SessionBean should be suffixed by Bean.</li>
<li><a href="pmd_rules_java_codestyle.html#methodargumentcouldbefinal">MethodArgumentCouldBeFinal</a>: A method argument that is never re-assigned within the method can be declared final.</li>
<li><a href="pmd_rules_java_codestyle.html#methodnamingconventions">MethodNamingConventions</a>: Configurable naming conventions for method declarations. This rule reports method decl…</li>
<li><a href="pmd_rules_java_codestyle.html#misleadingvariablename">MIsLeadingVariableName</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Detects when a non-field has a name starting with m_. This usually denotes a field and could b…</li>
<li><a href="pmd_rules_java_codestyle.html#nopackage">NoPackage</a>: Detects when a class or interface does not have a package definition.</li>
<li><a href="pmd_rules_java_codestyle.html#onlyonereturn">OnlyOneReturn</a>: A method should have only one exit point, and that should be the last statement in the method.</li>
<li><a href="pmd_rules_java_codestyle.html#packagecase">PackageCase</a>: Detects when a package definition contains uppercase characters.</li>
<li><a href="pmd_rules_java_codestyle.html#prematuredeclaration">PrematureDeclaration</a>: Checks for variables that are defined before they might be used. A reference is deemed to be prem…</li>
<li><a href="pmd_rules_java_codestyle.html#remoteinterfacenamingconvention">RemoteInterfaceNamingConvention</a>: Remote Interface of a Session EJB should not have a suffix.</li>
<li><a href="pmd_rules_java_codestyle.html#remotesessioninterfacenamingconvention">RemoteSessionInterfaceNamingConvention</a>: A Remote Home interface type of a Session EJB should be suffixed by Home.</li>
<li><a href="pmd_rules_java_codestyle.html#shortclassname">ShortClassName</a>: Short Classnames with fewer than e.g. five characters are not recommended.</li>
<li><a href="pmd_rules_java_codestyle.html#shortmethodname">ShortMethodName</a>: Method names that are very short are not helpful to the reader.</li>
<li><a href="pmd_rules_java_codestyle.html#shortvariable">ShortVariable</a>: Fields, local variables, or parameter names that are very short are not helpful to the reader.</li>
<li><a href="pmd_rules_java_codestyle.html#suspiciousconstantfieldname">SuspiciousConstantFieldName</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Field names using all uppercase characters - Suns Java naming conventions indicating constants -…</li>
<li><a href="pmd_rules_java_codestyle.html#toomanystaticimports">TooManyStaticImports</a>: If you overuse the static import feature, it can make your program unreadable and unmaintainable,…</li>
<li><a href="pmd_rules_java_codestyle.html#unnecessaryannotationvalueelement">UnnecessaryAnnotationValueElement</a>: Avoid the use of value in annotations when its the only element.</li>
<li><a href="pmd_rules_java_codestyle.html#unnecessaryconstructor">UnnecessaryConstructor</a>: This rule detects when a constructor is not necessary; i.e., when there is only one constructor a…</li>
<li><a href="pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname">UnnecessaryFullyQualifiedName</a>: Import statements allow the use of non-fully qualified names. The use of a fully qualified namew…</li>
<li><a href="pmd_rules_java_codestyle.html#unnecessarylocalbeforereturn">UnnecessaryLocalBeforeReturn</a>: Avoid the creation of unnecessary local variables</li>
<li><a href="pmd_rules_java_codestyle.html#unnecessarymodifier">UnnecessaryModifier</a>: Fields in interfaces and annotations are automatically public static final, and methods are pu…</li>
<li><a href="pmd_rules_java_codestyle.html#unnecessaryreturn">UnnecessaryReturn</a>: Avoid the use of unnecessary return statements.</li>
<li><a href="pmd_rules_java_codestyle.html#uselessparentheses">UselessParentheses</a>: Useless parentheses should be removed.</li>
<li><a href="pmd_rules_java_codestyle.html#uselessqualifiedthis">UselessQualifiedThis</a>: Reports qualified this usages in the same class.</li>
<li><a href="pmd_rules_java_codestyle.html#useunderscoresinnumericliterals">UseUnderscoresInNumericLiterals</a>: Since Java 1.7, numeric literals can use underscores to separate digits. This rule enforces that …</li>
<li><a href="pmd_rules_java_codestyle.html#variablenamingconventions">VariableNamingConventions</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> A variable naming conventions rule - customize this to your liking. Currently, itchecks for fina…</li>
<li><a href="pmd_rules_java_codestyle.html#whileloopsmustusebraces">WhileLoopsMustUseBraces</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using while statements without using braces to surround the code block. If the code forma…</li>
</ul>
<h2 id="design">Design</h2>
<div class="bs-callout bs-callout-">Rules that help you discover design issues.</div>
<ul>
<li><a href="pmd_rules_java_design.html#abstractclasswithoutanymethod">AbstractClassWithoutAnyMethod</a>: If an abstract class does not provides any methods, it may be acting as a simple data containerth…</li>
<li><a href="pmd_rules_java_design.html#avoidcatchinggenericexception">AvoidCatchingGenericException</a>: Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in tr…</li>
<li><a href="pmd_rules_java_design.html#avoiddeeplynestedifstmts">AvoidDeeplyNestedIfStmts</a>: Avoid creating deeply nested if-then statements since they are harder to read and error-prone to …</li>
<li><a href="pmd_rules_java_design.html#avoidrethrowingexception">AvoidRethrowingException</a>: Catch blocks that merely rethrow a caught exception only add to code size and runtime complexity.</li>
<li><a href="pmd_rules_java_design.html#avoidthrowingnewinstanceofsameexception">AvoidThrowingNewInstanceOfSameException</a>: Catch blocks that merely rethrow a caught exception wrapped inside a new instance of the same typ…</li>
<li><a href="pmd_rules_java_design.html#avoidthrowingnullpointerexception">AvoidThrowingNullPointerException</a>: Avoid throwing NullPointerExceptions manually. These are confusing because most people will assum…</li>
<li><a href="pmd_rules_java_design.html#avoidthrowingrawexceptiontypes">AvoidThrowingRawExceptionTypes</a>: Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable,Excep…</li>
<li><a href="pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal">ClassWithOnlyPrivateConstructorsShouldBeFinal</a>: A class with only private constructors should be final, unless the private constructoris invoked …</li>
<li><a href="pmd_rules_java_design.html#collapsibleifstatements">CollapsibleIfStatements</a>: Sometimes two consecutive if statements can be consolidated by separating their conditions with…</li>
<li><a href="pmd_rules_java_design.html#couplingbetweenobjects">CouplingBetweenObjects</a>: This rule counts the number of unique attributes, local variables, and return types within an obj…</li>
<li><a href="pmd_rules_java_design.html#cyclomaticcomplexity">CyclomaticComplexity</a>: The complexity of methods directly affects maintenance costs and readability. Concentrating too m…</li>
<li><a href="pmd_rules_java_design.html#dataclass">DataClass</a>: Data Classes are simple data holders, which reveal most of their state, andwithout complex functi…</li>
<li><a href="pmd_rules_java_design.html#donotextendjavalangerror">DoNotExtendJavaLangError</a>: Errors are system exceptions. Do not extend them.</li>
<li><a href="pmd_rules_java_design.html#exceptionasflowcontrol">ExceptionAsFlowControl</a>: Using Exceptions as form of flow control is not recommended as they obscure true exceptions when …</li>
<li><a href="pmd_rules_java_design.html#excessiveclasslength">ExcessiveClassLength</a>: Excessive class file lengths are usually indications that the class may be burdened with excessiv…</li>
<li><a href="pmd_rules_java_design.html#excessiveimports">ExcessiveImports</a>: A high number of imports can indicate a high degree of coupling within an object. This rule count…</li>
<li><a href="pmd_rules_java_design.html#excessivemethodlength">ExcessiveMethodLength</a>: When methods are excessively long this usually indicates that the method is doing more than itsna…</li>
<li><a href="pmd_rules_java_design.html#excessiveparameterlist">ExcessiveParameterList</a>: Methods with numerous parameters are a challenge to maintain, especially if most of them share th…</li>
<li><a href="pmd_rules_java_design.html#excessivepubliccount">ExcessivePublicCount</a>: Classes with large numbers of public methods and attributes require disproportionate testing effo…</li>
<li><a href="pmd_rules_java_design.html#finalfieldcouldbestatic">FinalFieldCouldBeStatic</a>: If a final field is assigned to a compile-time constant, it could be made static, thus saving ove…</li>
<li><a href="pmd_rules_java_design.html#godclass">GodClass</a>: The God Class rule detects the God Class design flaw using metrics. God classes do too many thing…</li>
<li><a href="pmd_rules_java_design.html#immutablefield">ImmutableField</a>: Identifies private fields whose values never change once they are initialized either in the decla…</li>
<li><a href="pmd_rules_java_design.html#lawofdemeter">LawOfDemeter</a>: The Law of Demeter is a simple rule, that says “only talk to friends”. It helps to reduce couplin…</li>
<li><a href="pmd_rules_java_design.html#logicinversion">LogicInversion</a>: Use opposite operator instead of negating the whole expression with a logic complement operator.</li>
<li><a href="pmd_rules_java_design.html#loosepackagecoupling">LoosePackageCoupling</a>: Avoid using classes from the configured package hierarchy outside of the package hierarchy, excep…</li>
<li><a href="pmd_rules_java_design.html#modifiedcyclomaticcomplexity">ModifiedCyclomaticComplexity</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Complexity directly affects maintenance costs is determined by the number of decision points in a…</li>
<li><a href="pmd_rules_java_design.html#ncssconstructorcount">NcssConstructorCount</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of l…</li>
<li><a href="pmd_rules_java_design.html#ncsscount">NcssCount</a>: This rule uses the NCSS (Non-Commenting Source Statements) metric to determine the number of line…</li>
<li><a href="pmd_rules_java_design.html#ncssmethodcount">NcssMethodCount</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of l…</li>
<li><a href="pmd_rules_java_design.html#ncsstypecount">NcssTypeCount</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of l…</li>
<li><a href="pmd_rules_java_design.html#npathcomplexity">NPathComplexity</a>: The NPath complexity of a method is the number of acyclic execution paths through that method.Whi…</li>
<li><a href="pmd_rules_java_design.html#signaturedeclarethrowsexception">SignatureDeclareThrowsException</a>: A method/constructor shouldnt explicitly throw the generic java.lang.Exception, since itis uncle…</li>
<li><a href="pmd_rules_java_design.html#simplifiedternary">SimplifiedTernary</a>: Look for ternary operators with the form condition ? literalBoolean : fooor condition ? foo : …</li>
<li><a href="pmd_rules_java_design.html#simplifybooleanassertion">SimplifyBooleanAssertion</a>: Avoid negation in an assertTrue or assertFalse test.For example, rephrase: assertTrue(!expr);a…</li>
<li><a href="pmd_rules_java_design.html#simplifybooleanexpressions">SimplifyBooleanExpressions</a>: Avoid unnecessary comparisons in boolean expressions, they serve no purpose and impacts readability.</li>
<li><a href="pmd_rules_java_design.html#simplifybooleanreturns">SimplifyBooleanReturns</a>: Avoid unnecessary if-then-else statements when returning a boolean. The result ofthe conditional …</li>
<li><a href="pmd_rules_java_design.html#simplifyconditional">SimplifyConditional</a>: No need to check for null before an instanceof; the instanceof keyword returns false when given a…</li>
<li><a href="pmd_rules_java_design.html#singularfield">SingularField</a>: Fields whose scopes are limited to just single methods do not rely on the containingobject to pro…</li>
<li><a href="pmd_rules_java_design.html#stdcyclomaticcomplexity">StdCyclomaticComplexity</a>: <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Complexity directly affects maintenance costs is determined by the number of decision points in a…</li>
<li><a href="pmd_rules_java_design.html#switchdensity">SwitchDensity</a>: A high ratio of statements to labels in a switch statement implies that the switch statementis ov…</li>
<li><a href="pmd_rules_java_design.html#toomanyfields">TooManyFields</a>: Classes that have too many fields can become unwieldy and could be redesigned to have fewer field…</li>
<li><a href="pmd_rules_java_design.html#toomanymethods">TooManyMethods</a>: A class with too many methods is probably a good suspect for refactoring, in order to reduce itsc…</li>
<li><a href="pmd_rules_java_design.html#uselessoverridingmethod">UselessOverridingMethod</a>: The overriding method merely calls the same method defined in a superclass.</li>
<li><a href="pmd_rules_java_design.html#useobjectforclearerapi">UseObjectForClearerAPI</a>: When you write a public method, you should be thinking in terms of an API. If your method is publ…</li>
<li><a href="pmd_rules_java_design.html#useutilityclass">UseUtilityClass</a>: For classes that only have static methods, consider making them utility classes.Note that this do…</li>
</ul>
<h2 id="documentation">Documentation</h2>
<div class="bs-callout bs-callout-">Rules that are related to code documentation.</div>
<ul>
<li><a href="pmd_rules_java_documentation.html#commentcontent">CommentContent</a>: A rule for the politically correct… we dont want to offend anyone.</li>
<li><a href="pmd_rules_java_documentation.html#commentrequired">CommentRequired</a>: Denotes whether comments are required (or unwanted) for specific language elements.</li>
<li><a href="pmd_rules_java_documentation.html#commentsize">CommentSize</a>: Determines whether the dimensions of non-header comments found are within the specified limits.</li>
<li><a href="pmd_rules_java_documentation.html#uncommentedemptyconstructor">UncommentedEmptyConstructor</a>: Uncommented Empty Constructor finds instances where a constructor does notcontain statements, but…</li>
<li><a href="pmd_rules_java_documentation.html#uncommentedemptymethodbody">UncommentedEmptyMethodBody</a>: Uncommented Empty Method Body finds instances where a method body does not containstatements, but…</li>
</ul>
<h2 id="error-prone">Error Prone</h2>
<div class="bs-callout bs-callout-">Rules to detect constructs that are either broken, extremely confusing or prone to runtime errors.</div>
<ul>
<li><a href="pmd_rules_java_errorprone.html#assignmentinoperand">AssignmentInOperand</a>: Avoid assignments in operands; this can make code more complicated and harder to read.</li>
<li><a href="pmd_rules_java_errorprone.html#assignmenttononfinalstatic">AssignmentToNonFinalStatic</a>: Identifies a possible unsafe usage of a static field.</li>
<li><a href="pmd_rules_java_errorprone.html#avoidaccessibilityalteration">AvoidAccessibilityAlteration</a>: Methods such as getDeclaredConstructors(), getDeclaredConstructor(Class[]) and setAccessible(),as…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidassertasidentifier">AvoidAssertAsIdentifier</a>: Use of the term assert will conflict with newer versions of Java since it is a reserved word.</li>
<li><a href="pmd_rules_java_errorprone.html#avoidbranchingstatementaslastinloop">AvoidBranchingStatementAsLastInLoop</a>: Using a branching statement as the last part of a loop may be a bug, and/or is confusing.Ensure t…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidcallingfinalize">AvoidCallingFinalize</a>: The method Object.finalize() is called by the garbage collector on an object when garbage collect…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidcatchingnpe">AvoidCatchingNPE</a>: Code should never throw NullPointerExceptions under normal circumstances. A catch block may hide…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidcatchingthrowable">AvoidCatchingThrowable</a>: Catching Throwable errors is not recommended since its scope is very broad. It includes runtime i…</li>
<li><a href="pmd_rules_java_errorprone.html#avoiddecimalliteralsinbigdecimalconstructor">AvoidDecimalLiteralsInBigDecimalConstructor</a>: One might assume that the result of “new BigDecimal(0.1)” is exactly equal to 0.1, but it is actu…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidduplicateliterals">AvoidDuplicateLiterals</a>: Code containing duplicate String literals can usually be improved by declaring the String as a co…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidenumasidentifier">AvoidEnumAsIdentifier</a>: Use of the term enum will conflict with newer versions of Java since it is a reserved word.</li>
<li><a href="pmd_rules_java_errorprone.html#avoidfieldnamematchingmethodname">AvoidFieldNameMatchingMethodName</a>: It can be confusing to have a field name with the same name as a method. While this is permitted,…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidfieldnamematchingtypename">AvoidFieldNameMatchingTypeName</a>: It is somewhat confusing to have a field name matching the declaring class name.This probably mea…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidinstanceofchecksincatchclause">AvoidInstanceofChecksInCatchClause</a>: Each caught exception type should be handled in its own catch clause.</li>
<li><a href="pmd_rules_java_errorprone.html#avoidliteralsinifcondition">AvoidLiteralsInIfCondition</a>: Avoid using hard-coded literals in conditional statements. By declaring them as static variableso…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidlosingexceptioninformation">AvoidLosingExceptionInformation</a>: Statements in a catch block that invoke accessors on the exception without using the informationo…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidmultipleunaryoperators">AvoidMultipleUnaryOperators</a>: The use of multiple unary operators may be problematic, and/or confusing.Ensure that the intended…</li>
<li><a href="pmd_rules_java_errorprone.html#avoidusingoctalvalues">AvoidUsingOctalValues</a>: Integer literals should not start with zero since this denotes that the rest of literal will bein…</li>
<li><a href="pmd_rules_java_errorprone.html#badcomparison">BadComparison</a>: Avoid equality comparisons with Double.NaN. Due to the implicit lack of representationprecision w…</li>
<li><a href="pmd_rules_java_errorprone.html#beanmembersshouldserialize">BeanMembersShouldSerialize</a>: If a class is a bean, or is referenced by a bean directly or indirectly it needs to be serializab…</li>
<li><a href="pmd_rules_java_errorprone.html#brokennullcheck">BrokenNullCheck</a>: The null check is broken since it will throw a NullPointerException itself.It is likely that you …</li>
<li><a href="pmd_rules_java_errorprone.html#callsuperfirst">CallSuperFirst</a>: Super should be called at the start of the method</li>
<li><a href="pmd_rules_java_errorprone.html#callsuperlast">CallSuperLast</a>: Super should be called at the end of the method</li>
<li><a href="pmd_rules_java_errorprone.html#checkskipresult">CheckSkipResult</a>: The skip() method may skip a smaller number of bytes than requested. Check the returned value to …</li>
<li><a href="pmd_rules_java_errorprone.html#classcastexceptionwithtoarray">ClassCastExceptionWithToArray</a>: When deriving an array of a specific class from your Collection, one should provide an array ofth…</li>
<li><a href="pmd_rules_java_errorprone.html#clonemethodmustbepublic">CloneMethodMustBePublic</a>: The java Manual says “By convention, classes that implement this interface should overrideObject….</li>
<li><a href="pmd_rules_java_errorprone.html#clonemethodmustimplementcloneable">CloneMethodMustImplementCloneable</a>: The method clone() should only be implemented if the class implements the Cloneable interface wit…</li>
<li><a href="pmd_rules_java_errorprone.html#clonemethodreturntypemustmatchclassname">CloneMethodReturnTypeMustMatchClassName</a>: If a class implements cloneable the return type of the method clone() must be the class name. Tha…</li>
<li><a href="pmd_rules_java_errorprone.html#clonethrowsclonenotsupportedexception">CloneThrowsCloneNotSupportedException</a>: The method clone() should throw a CloneNotSupportedException.</li>
<li><a href="pmd_rules_java_errorprone.html#closeresource">CloseResource</a>: Ensure that resources (like Connection, Statement, and ResultSet objects) are always closed after…</li>
<li><a href="pmd_rules_java_errorprone.html#compareobjectswithequals">CompareObjectsWithEquals</a>: Use equals() to compare object references; avoid comparing them with ==.</li>
<li><a href="pmd_rules_java_errorprone.html#constructorcallsoverridablemethod">ConstructorCallsOverridableMethod</a>: Calling overridable methods during construction poses a risk of invoking methods on an incomplete…</li>
<li><a href="pmd_rules_java_errorprone.html#dataflowanomalyanalysis">DataflowAnomalyAnalysis</a>: The dataflow analysis tracks local definitions, undefinitions and references to variables on diff…</li>
<li><a href="pmd_rules_java_errorprone.html#donotcallgarbagecollectionexplicitly">DoNotCallGarbageCollectionExplicitly</a>: Calls to System.gc(), Runtime.getRuntime().gc(), and System.runFinalization() are not advised. Co…</li>
<li><a href="pmd_rules_java_errorprone.html#donotcallsystemexit">DoNotCallSystemExit</a>: Web applications should not call System.exit(), since only the web container or theapplication se…</li>
<li><a href="pmd_rules_java_errorprone.html#donotextendjavalangthrowable">DoNotExtendJavaLangThrowable</a>: Extend Exception or RuntimeException instead of Throwable.</li>
<li><a href="pmd_rules_java_errorprone.html#donothardcodesdcard">DoNotHardCodeSDCard</a>: Use Environment.getExternalStorageDirectory() instead of “/sdcard”</li>
<li><a href="pmd_rules_java_errorprone.html#donotthrowexceptioninfinally">DoNotThrowExceptionInFinally</a>: Throwing exceptions within a finally block is confusing since they may mask other exceptions or…</li>
<li><a href="pmd_rules_java_errorprone.html#dontimportsun">DontImportSun</a>: Avoid importing anything from the sun. packages. These packages are not portable and are likel…</li>
<li><a href="pmd_rules_java_errorprone.html#dontusefloattypeforloopindices">DontUseFloatTypeForLoopIndices</a>: Dont use floating point for loop indices. If you must use floating point, use doubleunless your…</li>
<li><a href="pmd_rules_java_errorprone.html#emptycatchblock">EmptyCatchBlock</a>: Empty Catch Block finds instances where an exception is caught, but nothing is done. In most cir…</li>
<li><a href="pmd_rules_java_errorprone.html#emptyfinalizer">EmptyFinalizer</a>: Empty finalize methods serve no purpose and should be removed. Note that Oracle has declared Obje…</li>
<li><a href="pmd_rules_java_errorprone.html#emptyfinallyblock">EmptyFinallyBlock</a>: Empty finally blocks serve no purpose and should be removed.</li>
<li><a href="pmd_rules_java_errorprone.html#emptyifstmt">EmptyIfStmt</a>: Empty If Statement finds instances where a condition is checked but nothing is done about it.</li>
<li><a href="pmd_rules_java_errorprone.html#emptyinitializer">EmptyInitializer</a>: Empty initializers serve no purpose and should be removed.</li>
<li><a href="pmd_rules_java_errorprone.html#emptystatementblock">EmptyStatementBlock</a>: Empty block statements serve no purpose and should be removed.</li>
<li><a href="pmd_rules_java_errorprone.html#emptystatementnotinloop">EmptyStatementNotInLoop</a>: An empty statement (or a semicolon by itself) that is not used as the sole body of a for or wh…</li>
<li><a href="pmd_rules_java_errorprone.html#emptyswitchstatements">EmptySwitchStatements</a>: Empty switch statements serve no purpose and should be removed.</li>
<li><a href="pmd_rules_java_errorprone.html#emptysynchronizedblock">EmptySynchronizedBlock</a>: Empty synchronized blocks serve no purpose and should be removed.</li>
<li><a href="pmd_rules_java_errorprone.html#emptytryblock">EmptyTryBlock</a>: Avoid empty try blocks - whats the point?</li>
<li><a href="pmd_rules_java_errorprone.html#emptywhilestmt">EmptyWhileStmt</a>: Empty While Statement finds all instances where a while statement does nothing. If it is a timin…</li>
<li><a href="pmd_rules_java_errorprone.html#equalsnull">EqualsNull</a>: Tests for null should not use the equals() method. The == operator should be used instead.</li>
<li><a href="pmd_rules_java_errorprone.html#finalizedoesnotcallsuperfinalize">FinalizeDoesNotCallSuperFinalize</a>: If the finalize() is implemented, its last action should be to call super.finalize. Note that Ora…</li>
<li><a href="pmd_rules_java_errorprone.html#finalizeonlycallssuperfinalize">FinalizeOnlyCallsSuperFinalize</a>: If the finalize() is implemented, it should do something besides just calling super.finalize(). N…</li>
<li><a href="pmd_rules_java_errorprone.html#finalizeoverloaded">FinalizeOverloaded</a>: Methods named finalize() should not have parameters. It is confusing and most likely an attempt …</li>
<li><a href="pmd_rules_java_errorprone.html#finalizeshouldbeprotected">FinalizeShouldBeProtected</a>: When overriding the finalize(), the new method should be set as protected. If made public, other…</li>
<li><a href="pmd_rules_java_errorprone.html#idempotentoperations">IdempotentOperations</a>: Avoid idempotent operations - they have no effect.</li>
<li><a href="pmd_rules_java_errorprone.html#importfromsamepackage">ImportFromSamePackage</a>: There is no need to import a type that lives in the same package.</li>
<li><a href="pmd_rules_java_errorprone.html#instantiationtogetclass">InstantiationToGetClass</a>: Avoid instantiating an object just to call getClass() on it; use the .class public member instead.</li>
<li><a href="pmd_rules_java_errorprone.html#invalidslf4jmessageformat">InvalidSlf4jMessageFormat</a>: Check for messages in slf4j loggers with non matching number of arguments and placeholders.</li>
<li><a href="pmd_rules_java_errorprone.html#jumbledincrementer">JumbledIncrementer</a>: Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.</li>
<li><a href="pmd_rules_java_errorprone.html#junitspelling">JUnitSpelling</a>: Some JUnit framework methods are easy to misspell.</li>
<li><a href="pmd_rules_java_errorprone.html#junitstaticsuite">JUnitStaticSuite</a>: The suite() method in a JUnit test needs to be both public and static.</li>
<li><a href="pmd_rules_java_errorprone.html#loggerisnotstaticfinal">LoggerIsNotStaticFinal</a>: In most cases, the Logger reference can be declared as static and final.</li>
<li><a href="pmd_rules_java_errorprone.html#methodwithsamenameasenclosingclass">MethodWithSameNameAsEnclosingClass</a>: Non-constructor methods should not have the same name as the enclosing class.</li>
<li><a href="pmd_rules_java_errorprone.html#misplacednullcheck">MisplacedNullCheck</a>: The null check here is misplaced. If the variable is null a NullPointerException will be thrown.E…</li>
<li><a href="pmd_rules_java_errorprone.html#missingbreakinswitch">MissingBreakInSwitch</a>: Switch statements without break or return statements for each case optionmay indicate problematic…</li>
<li><a href="pmd_rules_java_errorprone.html#missingserialversionuid">MissingSerialVersionUID</a>: Serializable classes should provide a serialVersionUID field.The serialVersionUID field is also n…</li>
<li><a href="pmd_rules_java_errorprone.html#missingstaticmethodinnoninstantiatableclass">MissingStaticMethodInNonInstantiatableClass</a>: A class that has private constructors and does not have any static methods or fields cannot be used.</li>
<li><a href="pmd_rules_java_errorprone.html#morethanonelogger">MoreThanOneLogger</a>: Normally only one logger is used in each class.</li>
<li><a href="pmd_rules_java_errorprone.html#noncaselabelinswitchstatement">NonCaseLabelInSwitchStatement</a>: A non-case label (e.g. a named break/continue label) was present in a switch statement.This legal…</li>
<li><a href="pmd_rules_java_errorprone.html#nonstaticinitializer">NonStaticInitializer</a>: A non-static initializer block will be called any time a constructor is invoked (just prior toinv…</li>
<li><a href="pmd_rules_java_errorprone.html#nullassignment">NullAssignment</a>: Assigning a “null” to a variable (outside of its declaration) is usually bad form. Sometimes, th…</li>
<li><a href="pmd_rules_java_errorprone.html#overridebothequalsandhashcode">OverrideBothEqualsAndHashcode</a>: Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or ov…</li>
<li><a href="pmd_rules_java_errorprone.html#propercloneimplementation">ProperCloneImplementation</a>: Object clone() should be implemented with super.clone().</li>
<li><a href="pmd_rules_java_errorprone.html#properlogger">ProperLogger</a>: A logger should normally be defined private static final and be associated with the correct class…</li>
<li><a href="pmd_rules_java_errorprone.html#returnemptyarrayratherthannull">ReturnEmptyArrayRatherThanNull</a>: For any method that returns an array, it is a better to return an empty array rather than anull r…</li>
<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 methodsis th…</li>
<li><a href="pmd_rules_java_errorprone.html#singletonclassreturningnewinstance">SingletonClassReturningNewInstance</a>: Some classes contain overloaded getInstance. The problem with overloaded getInstance methodsis th…</li>
<li><a href="pmd_rules_java_errorprone.html#staticejbfieldshouldbefinal">StaticEJBFieldShouldBeFinal</a>: According to the J2EE specification, an EJB should not have any static fieldswith write access. H…</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 equals(Object), which can denote a…</li>
<li><a href="pmd_rules_java_errorprone.html#suspicioushashcodemethodname">SuspiciousHashcodeMethodName</a>: The method name and return type are suspiciously close to hashCode(), which may denote an intenti…</li>
<li><a href="pmd_rules_java_errorprone.html#suspiciousoctalescape">SuspiciousOctalEscape</a>: A suspicious octal escape sequence was found inside a String literal.The Java language specificat…</li>
<li><a href="pmd_rules_java_errorprone.html#testclasswithouttestcases">TestClassWithoutTestCases</a>: Test classes end with the suffix Test. Having a non-test class with that name is not a good pract…</li>
<li><a href="pmd_rules_java_errorprone.html#unconditionalifstatement">UnconditionalIfStatement</a>: Do not use “if” statements whose conditionals are always true or always false.</li>
<li><a href="pmd_rules_java_errorprone.html#unnecessarybooleanassertion">UnnecessaryBooleanAssertion</a>: A JUnit test assertion with a boolean literal is unnecessary since it always will evaluate to the…</li>
<li><a href="pmd_rules_java_errorprone.html#unnecessarycasechange">UnnecessaryCaseChange</a>: Using equalsIgnoreCase() is faster than using toUpperCase/toLowerCase().equals()</li>
<li><a href="pmd_rules_java_errorprone.html#unnecessaryconversiontemporary">UnnecessaryConversionTemporary</a>: Avoid the use temporary objects when converting primitives to Strings. Use the static conversion …</li>
<li><a href="pmd_rules_java_errorprone.html#unusednullcheckinequals">UnusedNullCheckInEquals</a>: After checking an object reference for null, you should invoke equals() on that object rather tha…</li>
<li><a href="pmd_rules_java_errorprone.html#usecorrectexceptionlogging">UseCorrectExceptionLogging</a>: To make sure the full stacktrace is printed out, use the logging statement with two arguments: a …</li>
<li><a href="pmd_rules_java_errorprone.html#useequalstocomparestrings">UseEqualsToCompareStrings</a>: Using == or != to compare strings only works if intern version is used on both sides.Use the …</li>
<li><a href="pmd_rules_java_errorprone.html#uselessoperationonimmutable">UselessOperationOnImmutable</a>: An operation on an Immutable object (String, BigDecimal or BigInteger) wont change the object it…</li>
<li><a href="pmd_rules_java_errorprone.html#uselocalewithcaseconversions">UseLocaleWithCaseConversions</a>: When doing String.toLowerCase()/toUpperCase() conversions, use Locales to avoids problems with la…</li>
<li><a href="pmd_rules_java_errorprone.html#useproperclassloader">UseProperClassLoader</a>: In J2EE, the getClassLoader() method might not work as expected. Use Thread.currentThread().getCo…</li>
</ul>
<h2 id="multithreading">Multithreading</h2>
<div class="bs-callout bs-callout-">Rules that flag issues when dealing with multiple threads of execution.</div>
<ul>
<li><a href="pmd_rules_java_multithreading.html#avoidsynchronizedatmethodlevel">AvoidSynchronizedAtMethodLevel</a>: Method-level synchronization can cause problems when new code is added to the method.Block-level …</li>
<li><a href="pmd_rules_java_multithreading.html#avoidthreadgroup">AvoidThreadGroup</a>: Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environmentit…</li>
<li><a href="pmd_rules_java_multithreading.html#avoidusingvolatile">AvoidUsingVolatile</a>: Use of the keyword volatile is generally used to fine tune a Java application, and therefore, r…</li>
<li><a href="pmd_rules_java_multithreading.html#donotusethreads">DoNotUseThreads</a>: The J2EE specification explicitly forbids the use of threads.</li>
<li><a href="pmd_rules_java_multithreading.html#dontcallthreadrun">DontCallThreadRun</a>: Explicitly calling Thread.run() method will execute in the callers thread of control. Instead, …</li>
<li><a href="pmd_rules_java_multithreading.html#doublecheckedlocking">DoubleCheckedLocking</a>: Partially created objects can be returned by the Double Checked Locking pattern when used in Java…</li>
<li><a href="pmd_rules_java_multithreading.html#nonthreadsafesingleton">NonThreadSafeSingleton</a>: Non-thread safe singletons can result in bad state changes. Eliminatestatic singletons if possibl…</li>
<li><a href="pmd_rules_java_multithreading.html#unsynchronizedstaticdateformatter">UnsynchronizedStaticDateFormatter</a>: SimpleDateFormat instances are not synchronized. Sun recommends using separate format instancesfo…</li>
<li><a href="pmd_rules_java_multithreading.html#useconcurrenthashmap">UseConcurrentHashMap</a>: Since Java5 brought a new implementation of the Map designed for multi-threaded access, you canpe…</li>
<li><a href="pmd_rules_java_multithreading.html#usenotifyallinsteadofnotify">UseNotifyAllInsteadOfNotify</a>: Thread.notify() awakens a thread monitoring the object. If more than one thread is monitoring, th…</li>
</ul>
<h2 id="performance">Performance</h2>
<div class="bs-callout bs-callout-">Rules that flag suboptimal code.</div>
<ul>
<li><a href="pmd_rules_java_performance.html#addemptystring">AddEmptyString</a>: The conversion of literals to strings by concatenating them with empty strings is inefficient.It …</li>
<li><a href="pmd_rules_java_performance.html#appendcharacterwithchar">AppendCharacterWithChar</a>: Avoid concatenating characters as strings in StringBuffer/StringBuilder.append methods.</li>
<li><a href="pmd_rules_java_performance.html#avoidarrayloops">AvoidArrayLoops</a>: Instead of manually copying data between two arrays, use the efficient Arrays.copyOf or System.ar…</li>
<li><a href="pmd_rules_java_performance.html#avoidfilestream">AvoidFileStream</a>: The FileInputStream and FileOutputStream classes contains a finalizer method which will cause gar…</li>
<li><a href="pmd_rules_java_performance.html#avoidinstantiatingobjectsinloops">AvoidInstantiatingObjectsInLoops</a>: New objects created within loops should be checked to see if they can created outside them and re…</li>
<li><a href="pmd_rules_java_performance.html#avoidusingshorttype">AvoidUsingShortType</a>: Java uses the short type to reduce memory usage, not to optimize calculation. In fact, the JVM …</li>
<li><a href="pmd_rules_java_performance.html#bigintegerinstantiation">BigIntegerInstantiation</a>: Dont create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) andfor Ja…</li>
<li><a href="pmd_rules_java_performance.html#booleaninstantiation">BooleanInstantiation</a>: Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boole…</li>
<li><a href="pmd_rules_java_performance.html#byteinstantiation">ByteInstantiation</a>: Calling new Byte() causes memory allocation that can be avoided by the static Byte.valueOf().It m…</li>
<li><a href="pmd_rules_java_performance.html#consecutiveappendsshouldreuse">ConsecutiveAppendsShouldReuse</a>: Consecutive calls to StringBuffer/StringBuilder .append should be chained, reusing the target obj…</li>
<li><a href="pmd_rules_java_performance.html#consecutiveliteralappends">ConsecutiveLiteralAppends</a>: Consecutively calling StringBuffer/StringBuilder.append(…) with literals should be avoided.Sinc…</li>
<li><a href="pmd_rules_java_performance.html#inefficientemptystringcheck">InefficientEmptyStringCheck</a>: String.trim().length() == 0 (or String.trim().isEmpty() for the same reason) is an inefficientway…</li>
<li><a href="pmd_rules_java_performance.html#inefficientstringbuffering">InefficientStringBuffering</a>: Avoid concatenating non-literals in a StringBuffer constructor or append() since intermediate buf…</li>
<li><a href="pmd_rules_java_performance.html#insufficientstringbufferdeclaration">InsufficientStringBufferDeclaration</a>: Failing to pre-size a StringBuffer or StringBuilder properly could cause it to re-size many times…</li>
<li><a href="pmd_rules_java_performance.html#integerinstantiation">IntegerInstantiation</a>: Calling new Integer() causes memory allocation that can be avoided by the static Integer.valueOf(…</li>
<li><a href="pmd_rules_java_performance.html#longinstantiation">LongInstantiation</a>: Calling new Long() causes memory allocation that can be avoided by the static Long.valueOf().It m…</li>
<li><a href="pmd_rules_java_performance.html#optimizabletoarraycall">OptimizableToArrayCall</a>: Calls to a collections toArray(E[]) method should specify a target array of zero size. This al…</li>
<li><a href="pmd_rules_java_performance.html#redundantfieldinitializer">RedundantFieldInitializer</a>: Java will initialize fields with known default values so any explicit initialization of those sam…</li>
<li><a href="pmd_rules_java_performance.html#shortinstantiation">ShortInstantiation</a>: Calling new Short() causes memory allocation that can be avoided by the static Short.valueOf().It…</li>
<li><a href="pmd_rules_java_performance.html#simplifystartswith">SimplifyStartsWith</a>: Since it passes in a literal of length 1, calls to (string).startsWith can be rewritten using (st…</li>
<li><a href="pmd_rules_java_performance.html#stringinstantiation">StringInstantiation</a>: Avoid instantiating String objects; this is usually unnecessary since they are immutable and can …</li>
<li><a href="pmd_rules_java_performance.html#stringtostring">StringToString</a>: Avoid calling toString() on objects already known to be string instances; this is unnecessary.</li>
<li><a href="pmd_rules_java_performance.html#toofewbranchesforaswitchstatement">TooFewBranchesForASwitchStatement</a>: Switch statements are intended to be used to support complex branching behaviour. Using a switch …</li>
<li><a href="pmd_rules_java_performance.html#unnecessarywrapperobjectcreation">UnnecessaryWrapperObjectCreation</a>: Most wrapper classes provide static conversion methods that avoid the need to create intermediate…</li>
<li><a href="pmd_rules_java_performance.html#usearraylistinsteadofvector">UseArrayListInsteadOfVector</a>: ArrayList is a much better Collection implementation than Vector if thread-safe operation is not …</li>
<li><a href="pmd_rules_java_performance.html#usearraysaslist">UseArraysAsList</a>: The java.util.Arrays class has a “asList” method that should be used when you want to create a ne…</li>
<li><a href="pmd_rules_java_performance.html#useindexofchar">UseIndexOfChar</a>: Use String.indexOf(char) when checking for the index of a single character; it executes faster.</li>
<li><a href="pmd_rules_java_performance.html#uselessstringvalueof">UselessStringValueOf</a>: No need to call String.valueOf to append to a string; just use the valueOf() argument directly.</li>
<li><a href="pmd_rules_java_performance.html#usestringbufferforstringappends">UseStringBufferForStringAppends</a>: The use of the += operator for appending strings causes the JVM to create and use an internal S…</li>
<li><a href="pmd_rules_java_performance.html#usestringbufferlength">UseStringBufferLength</a>: Use StringBuffer.length() to determine StringBuffer length rather than using StringBuffer.toStrin…</li>
</ul>
<h2 id="security">Security</h2>
<div class="bs-callout bs-callout-">Rules that flag potential security flaws.</div>
<ul>
<li><a href="pmd_rules_java_security.html#hardcodedcryptokey">HardCodedCryptoKey</a>: Do not use hard coded values for cryptographic operations. Please store keys outside of source code.</li>
<li><a href="pmd_rules_java_security.html#insecurecryptoiv">InsecureCryptoIv</a>: Do not use hard coded initialization vector in cryptographic operations. Please use a randomly ge…</li>
</ul>
<h2 id="additional-rulesets">Additional rulesets</h2>
<ul>
<li>
<p>Android (<code class="highlighter-rouge">rulesets/java/android.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#callsuperfirst">CallSuperFirst</a>, <a href="pmd_rules_java_errorprone.html#callsuperlast">CallSuperLast</a>, <a href="pmd_rules_java_errorprone.html#donothardcodesdcard">DoNotHardCodeSDCard</a></p>
</li>
<li>
<p>Basic (<code class="highlighter-rouge">rulesets/java/basic.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#avoidbranchingstatementaslastinloop">AvoidBranchingStatementAsLastInLoop</a>, <a href="pmd_rules_java_errorprone.html#avoiddecimalliteralsinbigdecimalconstructor">AvoidDecimalLiteralsInBigDecimalConstructor</a>, <a href="pmd_rules_java_errorprone.html#avoidmultipleunaryoperators">AvoidMultipleUnaryOperators</a>, <a href="pmd_rules_java_multithreading.html#avoidthreadgroup">AvoidThreadGroup</a>, <a href="pmd_rules_java_bestpractices.html#avoidusinghardcodedip">AvoidUsingHardCodedIP</a>, <a href="pmd_rules_java_errorprone.html#avoidusingoctalvalues">AvoidUsingOctalValues</a>, <a href="pmd_rules_java_performance.html#bigintegerinstantiation">BigIntegerInstantiation</a>, <a href="pmd_rules_java_performance.html#booleaninstantiation">BooleanInstantiation</a>, <a href="pmd_rules_java_errorprone.html#brokennullcheck">BrokenNullCheck</a>, <a href="pmd_rules_java_bestpractices.html#checkresultset">CheckResultSet</a>, <a href="pmd_rules_java_errorprone.html#checkskipresult">CheckSkipResult</a>, <a href="pmd_rules_java_errorprone.html#classcastexceptionwithtoarray">ClassCastExceptionWithToArray</a>, <a href="pmd_rules_java_design.html#collapsibleifstatements">CollapsibleIfStatements</a>, <a href="pmd_rules_java_multithreading.html#dontcallthreadrun">DontCallThreadRun</a>, <a href="pmd_rules_java_errorprone.html#dontusefloattypeforloopindices">DontUseFloatTypeForLoopIndices</a>, <a href="pmd_rules_java_multithreading.html#doublecheckedlocking">DoubleCheckedLocking</a>, <a href="pmd_rules_java_codestyle.html#extendsobject">ExtendsObject</a>, <a href="pmd_rules_java_codestyle.html#forloopshouldbewhileloop">ForLoopShouldBeWhileLoop</a>, <a href="pmd_rules_java_errorprone.html#jumbledincrementer">JumbledIncrementer</a>, <a href="pmd_rules_java_errorprone.html#misplacednullcheck">MisplacedNullCheck</a>, <a href="pmd_rules_java_errorprone.html#overridebothequalsandhashcode">OverrideBothEqualsAndHashcode</a>, <a href="pmd_rules_java_errorprone.html#returnfromfinallyblock">ReturnFromFinallyBlock</a>, <a href="pmd_rules_java_design.html#simplifiedternary">SimplifiedTernary</a>, <a href="pmd_rules_java_errorprone.html#unconditionalifstatement">UnconditionalIfStatement</a></p>
</li>
<li>
<p>Braces (<code class="highlighter-rouge">rulesets/java/braces.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_codestyle.html#forloopsmustusebraces">ForLoopsMustUseBraces</a>, <a href="pmd_rules_java_codestyle.html#ifelsestmtsmustusebraces">IfElseStmtsMustUseBraces</a>, <a href="pmd_rules_java_codestyle.html#ifstmtsmustusebraces">IfStmtsMustUseBraces</a>, <a href="pmd_rules_java_codestyle.html#whileloopsmustusebraces">WhileLoopsMustUseBraces</a></p>
</li>
<li>
<p>Clone Implementation (<code class="highlighter-rouge">rulesets/java/clone.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#clonemethodmustbepublic">CloneMethodMustBePublic</a>, <a href="pmd_rules_java_errorprone.html#clonemethodmustimplementcloneable">CloneMethodMustImplementCloneable</a>, <a href="pmd_rules_java_errorprone.html#clonemethodreturntypemustmatchclassname">CloneMethodReturnTypeMustMatchClassName</a>, <a href="pmd_rules_java_errorprone.html#clonethrowsclonenotsupportedexception">CloneThrowsCloneNotSupportedException</a>, <a href="pmd_rules_java_errorprone.html#propercloneimplementation">ProperCloneImplementation</a></p>
</li>
<li>
<p>Code Size (<code class="highlighter-rouge">rulesets/java/codesize.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_design.html#cyclomaticcomplexity">CyclomaticComplexity</a>, <a href="pmd_rules_java_design.html#excessiveclasslength">ExcessiveClassLength</a>, <a href="pmd_rules_java_design.html#excessivemethodlength">ExcessiveMethodLength</a>, <a href="pmd_rules_java_design.html#excessiveparameterlist">ExcessiveParameterList</a>, <a href="pmd_rules_java_design.html#excessivepubliccount">ExcessivePublicCount</a>, <a href="pmd_rules_java_design.html#modifiedcyclomaticcomplexity">ModifiedCyclomaticComplexity</a>, <a href="pmd_rules_java_design.html#ncssconstructorcount">NcssConstructorCount</a>, <a href="pmd_rules_java_design.html#ncsscount">NcssCount</a>, <a href="pmd_rules_java_design.html#ncssmethodcount">NcssMethodCount</a>, <a href="pmd_rules_java_design.html#ncsstypecount">NcssTypeCount</a>, <a href="pmd_rules_java_design.html#npathcomplexity">NPathComplexity</a>, <a href="pmd_rules_java_design.html#stdcyclomaticcomplexity">StdCyclomaticComplexity</a>, <a href="pmd_rules_java_design.html#toomanyfields">TooManyFields</a>, <a href="pmd_rules_java_design.html#toomanymethods">TooManyMethods</a></p>
</li>
<li>
<p>Comments (<code class="highlighter-rouge">rulesets/java/comments.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_documentation.html#commentcontent">CommentContent</a>, <a href="pmd_rules_java_codestyle.html#commentdefaultaccessmodifier">CommentDefaultAccessModifier</a>, <a href="pmd_rules_java_documentation.html#commentrequired">CommentRequired</a>, <a href="pmd_rules_java_documentation.html#commentsize">CommentSize</a></p>
</li>
<li>
<p>Controversial (<code class="highlighter-rouge">rulesets/java/controversial.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#assignmentinoperand">AssignmentInOperand</a>, <a href="pmd_rules_java_codestyle.html#atleastoneconstructor">AtLeastOneConstructor</a>, <a href="pmd_rules_java_errorprone.html#avoidaccessibilityalteration">AvoidAccessibilityAlteration</a>, <a href="pmd_rules_java_codestyle.html#avoidfinallocalvariable">AvoidFinalLocalVariable</a>, <a href="pmd_rules_java_errorprone.html#avoidliteralsinifcondition">AvoidLiteralsInIfCondition</a>, <a href="pmd_rules_java_codestyle.html#avoidprefixingmethodparameters">AvoidPrefixingMethodParameters</a>, <a href="pmd_rules_java_codestyle.html#avoidusingnativecode">AvoidUsingNativeCode</a>, <a href="pmd_rules_java_performance.html#avoidusingshorttype">AvoidUsingShortType</a>, <a href="pmd_rules_java_multithreading.html#avoidusingvolatile">AvoidUsingVolatile</a>, <a href="pmd_rules_java_codestyle.html#callsuperinconstructor">CallSuperInConstructor</a>, <a href="pmd_rules_java_errorprone.html#dataflowanomalyanalysis">DataflowAnomalyAnalysis</a>, <a href="pmd_rules_java_codestyle.html#defaultpackage">DefaultPackage</a>, <a href="pmd_rules_java_errorprone.html#donotcallgarbagecollectionexplicitly">DoNotCallGarbageCollectionExplicitly</a>, <a href="pmd_rules_java_errorprone.html#dontimportsun">DontImportSun</a>, <a href="pmd_rules_java_errorprone.html#nullassignment">NullAssignment</a>, <a href="pmd_rules_java_bestpractices.html#onedeclarationperline">OneDeclarationPerLine</a>, <a href="pmd_rules_java_codestyle.html#onlyonereturn">OnlyOneReturn</a>, <a href="pmd_rules_java_errorprone.html#suspiciousoctalescape">SuspiciousOctalEscape</a>, <a href="pmd_rules_java_codestyle.html#unnecessaryconstructor">UnnecessaryConstructor</a>, <a href="pmd_rules_java_codestyle.html#uselessparentheses">UnnecessaryParentheses</a>, <a href="pmd_rules_java_multithreading.html#useconcurrenthashmap">UseConcurrentHashMap</a>, <a href="pmd_rules_java_design.html#useobjectforclearerapi">UseObjectForClearerAPI</a></p>
</li>
<li>
<p>Coupling (<code class="highlighter-rouge">rulesets/java/coupling.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_design.html#couplingbetweenobjects">CouplingBetweenObjects</a>, <a href="pmd_rules_java_design.html#excessiveimports">ExcessiveImports</a>, <a href="pmd_rules_java_design.html#lawofdemeter">LawOfDemeter</a>, <a href="pmd_rules_java_bestpractices.html#loosecoupling">LooseCoupling</a>, <a href="pmd_rules_java_design.html#loosepackagecoupling">LoosePackageCoupling</a></p>
</li>
<li>
<p>Design (<code class="highlighter-rouge">rulesets/java/design.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_bestpractices.html#abstractclasswithoutabstractmethod">AbstractClassWithoutAbstractMethod</a>, <a href="pmd_rules_java_design.html#abstractclasswithoutanymethod">AbstractClassWithoutAnyMethod</a>, <a href="pmd_rules_java_bestpractices.html#accessorclassgeneration">AccessorClassGeneration</a>, <a href="pmd_rules_java_bestpractices.html#accessormethodgeneration">AccessorMethodGeneration</a>, <a href="pmd_rules_java_errorprone.html#assignmenttononfinalstatic">AssignmentToNonFinalStatic</a>, <a href="pmd_rules_java_design.html#avoiddeeplynestedifstmts">AvoidDeeplyNestedIfStmts</a>, <a href="pmd_rules_java_errorprone.html#avoidinstanceofchecksincatchclause">AvoidInstanceofChecksInCatchClause</a>, <a href="pmd_rules_java_codestyle.html#avoidprotectedfieldinfinalclass">AvoidProtectedFieldInFinalClass</a>, <a href="pmd_rules_java_codestyle.html#avoidprotectedmethodinfinalclassnotextending">AvoidProtectedMethodInFinalClassNotExtending</a>, <a href="pmd_rules_java_bestpractices.html#avoidreassigningparameters">AvoidReassigningParameters</a>, <a href="pmd_rules_java_multithreading.html#avoidsynchronizedatmethodlevel">AvoidSynchronizedAtMethodLevel</a>, <a href="pmd_rules_java_errorprone.html#badcomparison">BadComparison</a>, <a href="pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal">ClassWithOnlyPrivateConstructorsShouldBeFinal</a>, <a href="pmd_rules_java_errorprone.html#closeresource">CloseResource</a>, <a href="pmd_rules_java_errorprone.html#compareobjectswithequals">CompareObjectsWithEquals</a>, <a href="pmd_rules_java_codestyle.html#confusingternary">ConfusingTernary</a>, <a href="pmd_rules_java_bestpractices.html#constantsininterface">ConstantsInInterface</a>, <a href="pmd_rules_java_errorprone.html#constructorcallsoverridablemethod">ConstructorCallsOverridableMethod</a>, <a href="pmd_rules_java_design.html#dataclass">DataClass</a>, <a href="pmd_rules_java_bestpractices.html#defaultlabelnotlastinswitchstmt">DefaultLabelNotLastInSwitchStmt</a>, <a href="pmd_rules_java_codestyle.html#emptymethodinabstractclassshouldbeabstract">EmptyMethodInAbstractClassShouldBeAbstract</a>, <a href="pmd_rules_java_errorprone.html#equalsnull">EqualsNull</a>, <a href="pmd_rules_java_codestyle.html#fielddeclarationsshouldbeatstartofclass">FieldDeclarationsShouldBeAtStartOfClass</a>, <a href="pmd_rules_java_design.html#finalfieldcouldbestatic">FinalFieldCouldBeStatic</a>, <a href="pmd_rules_java_design.html#godclass">GodClass</a>, <a href="pmd_rules_java_errorprone.html#idempotentoperations">IdempotentOperations</a>, <a href="pmd_rules_java_design.html#immutablefield">ImmutableField</a>, <a href="pmd_rules_java_errorprone.html#instantiationtogetclass">InstantiationToGetClass</a>, <a href="pmd_rules_java_design.html#logicinversion">LogicInversion</a>, <a href="pmd_rules_java_errorprone.html#missingbreakinswitch">MissingBreakInSwitch</a>, <a href="pmd_rules_java_errorprone.html#missingstaticmethodinnoninstantiatableclass">MissingStaticMethodInNonInstantiatableClass</a>, <a href="pmd_rules_java_errorprone.html#noncaselabelinswitchstatement">NonCaseLabelInSwitchStatement</a>, <a href="pmd_rules_java_errorprone.html#nonstaticinitializer">NonStaticInitializer</a>, <a href="pmd_rules_java_multithreading.html#nonthreadsafesingleton">NonThreadSafeSingleton</a>, <a href="pmd_rules_java_performance.html#optimizabletoarraycall">OptimizableToArrayCall</a>, <a href="pmd_rules_java_bestpractices.html#positionliteralsfirstincaseinsensitivecomparisons">PositionLiteralsFirstInCaseInsensitiveComparisons</a>, <a href="pmd_rules_java_bestpractices.html#positionliteralsfirstincomparisons">PositionLiteralsFirstInComparisons</a>, <a href="pmd_rules_java_bestpractices.html#preservestacktrace">PreserveStackTrace</a>, <a href="pmd_rules_java_errorprone.html#returnemptyarrayratherthannull">ReturnEmptyArrayRatherThanNull</a>, <a href="pmd_rules_java_errorprone.html#simpledateformatneedslocale">SimpleDateFormatNeedsLocale</a>, <a href="pmd_rules_java_design.html#simplifybooleanexpressions">SimplifyBooleanExpressions</a>, <a href="pmd_rules_java_design.html#simplifybooleanreturns">SimplifyBooleanReturns</a>, <a href="pmd_rules_java_design.html#simplifyconditional">SimplifyConditional</a>, <a href="pmd_rules_java_errorprone.html#singlemethodsingleton">SingleMethodSingleton</a>, <a href="pmd_rules_java_errorprone.html#singletonclassreturningnewinstance">SingletonClassReturningNewInstance</a>, <a href="pmd_rules_java_design.html#singularfield">SingularField</a>, <a href="pmd_rules_java_design.html#switchdensity">SwitchDensity</a>, <a href="pmd_rules_java_bestpractices.html#switchstmtsshouldhavedefault">SwitchStmtsShouldHaveDefault</a>, <a href="pmd_rules_java_performance.html#toofewbranchesforaswitchstatement">TooFewBranchesForASwitchStatement</a>, <a href="pmd_rules_java_documentation.html#uncommentedemptyconstructor">UncommentedEmptyConstructor</a>, <a href="pmd_rules_java_documentation.html#uncommentedemptymethodbody">UncommentedEmptyMethodBody</a>, <a href="pmd_rules_java_codestyle.html#unnecessarylocalbeforereturn">UnnecessaryLocalBeforeReturn</a>, <a href="pmd_rules_java_multithreading.html#unsynchronizedstaticdateformatter">UnsynchronizedStaticDateFormatter</a>, <a href="pmd_rules_java_bestpractices.html#usecollectionisempty">UseCollectionIsEmpty</a>, <a href="pmd_rules_java_errorprone.html#uselocalewithcaseconversions">UseLocaleWithCaseConversions</a>, <a href="pmd_rules_java_multithreading.html#usenotifyallinsteadofnotify">UseNotifyAllInsteadOfNotify</a>, <a href="pmd_rules_java_design.html#useutilityclass">UseUtilityClass</a>, <a href="pmd_rules_java_bestpractices.html#usevarargs">UseVarargs</a></p>
</li>
<li>
<p>Empty Code (<code class="highlighter-rouge">rulesets/java/empty.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#emptycatchblock">EmptyCatchBlock</a>, <a href="pmd_rules_java_errorprone.html#emptyfinallyblock">EmptyFinallyBlock</a>, <a href="pmd_rules_java_errorprone.html#emptyifstmt">EmptyIfStmt</a>, <a href="pmd_rules_java_errorprone.html#emptyinitializer">EmptyInitializer</a>, <a href="pmd_rules_java_errorprone.html#emptystatementblock">EmptyStatementBlock</a>, <a href="pmd_rules_java_errorprone.html#emptystatementnotinloop">EmptyStatementNotInLoop</a>, <a href="pmd_rules_java_errorprone.html#emptyinitializer">EmptyStaticInitializer</a>, <a href="pmd_rules_java_errorprone.html#emptyswitchstatements">EmptySwitchStatements</a>, <a href="pmd_rules_java_errorprone.html#emptysynchronizedblock">EmptySynchronizedBlock</a>, <a href="pmd_rules_java_errorprone.html#emptytryblock">EmptyTryBlock</a>, <a href="pmd_rules_java_errorprone.html#emptywhilestmt">EmptyWhileStmt</a></p>
</li>
<li>
<p>Finalizer (<code class="highlighter-rouge">rulesets/java/finalizers.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#avoidcallingfinalize">AvoidCallingFinalize</a>, <a href="pmd_rules_java_errorprone.html#emptyfinalizer">EmptyFinalizer</a>, <a href="pmd_rules_java_errorprone.html#finalizedoesnotcallsuperfinalize">FinalizeDoesNotCallSuperFinalize</a>, <a href="pmd_rules_java_errorprone.html#finalizeonlycallssuperfinalize">FinalizeOnlyCallsSuperFinalize</a>, <a href="pmd_rules_java_errorprone.html#finalizeoverloaded">FinalizeOverloaded</a>, <a href="pmd_rules_java_errorprone.html#finalizeshouldbeprotected">FinalizeShouldBeProtected</a></p>
</li>
<li>
<p>Import Statements (<code class="highlighter-rouge">rulesets/java/imports.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_codestyle.html#dontimportjavalang">DontImportJavaLang</a>, <a href="pmd_rules_java_codestyle.html#duplicateimports">DuplicateImports</a>, <a href="pmd_rules_java_errorprone.html#importfromsamepackage">ImportFromSamePackage</a>, <a href="pmd_rules_java_codestyle.html#toomanystaticimports">TooManyStaticImports</a>, <a href="pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname">UnnecessaryFullyQualifiedName</a>, <a href="pmd_rules_java_bestpractices.html#unusedimports">UnusedImports</a></p>
</li>
<li>
<p>J2EE (<code class="highlighter-rouge">rulesets/java/j2ee.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#donotcallsystemexit">DoNotCallSystemExit</a>, <a href="pmd_rules_java_multithreading.html#donotusethreads">DoNotUseThreads</a>, <a href="pmd_rules_java_codestyle.html#localhomenamingconvention">LocalHomeNamingConvention</a>, <a href="pmd_rules_java_codestyle.html#localinterfacesessionnamingconvention">LocalInterfaceSessionNamingConvention</a>, <a href="pmd_rules_java_codestyle.html#mdbandsessionbeannamingconvention">MDBAndSessionBeanNamingConvention</a>, <a href="pmd_rules_java_codestyle.html#remoteinterfacenamingconvention">RemoteInterfaceNamingConvention</a>, <a href="pmd_rules_java_codestyle.html#remotesessioninterfacenamingconvention">RemoteSessionInterfaceNamingConvention</a>, <a href="pmd_rules_java_errorprone.html#staticejbfieldshouldbefinal">StaticEJBFieldShouldBeFinal</a>, <a href="pmd_rules_java_errorprone.html#useproperclassloader">UseProperClassLoader</a></p>
</li>
<li>
<p>JavaBeans (<code class="highlighter-rouge">rulesets/java/javabeans.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#beanmembersshouldserialize">BeanMembersShouldSerialize</a>, <a href="pmd_rules_java_errorprone.html#missingserialversionuid">MissingSerialVersionUID</a></p>
</li>
<li>
<p>JUnit (<code class="highlighter-rouge">rulesets/java/junit.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_bestpractices.html#junitassertionsshouldincludemessage">JUnitAssertionsShouldIncludeMessage</a>, <a href="pmd_rules_java_errorprone.html#junitspelling">JUnitSpelling</a>, <a href="pmd_rules_java_errorprone.html#junitstaticsuite">JUnitStaticSuite</a>, <a href="pmd_rules_java_bestpractices.html#junittestcontainstoomanyasserts">JUnitTestContainsTooManyAsserts</a>, <a href="pmd_rules_java_bestpractices.html#junittestsshouldincludeassert">JUnitTestsShouldIncludeAssert</a>, <a href="pmd_rules_java_design.html#simplifybooleanassertion">SimplifyBooleanAssertion</a>, <a href="pmd_rules_java_errorprone.html#testclasswithouttestcases">TestClassWithoutTestCases</a>, <a href="pmd_rules_java_errorprone.html#unnecessarybooleanassertion">UnnecessaryBooleanAssertion</a>, <a href="pmd_rules_java_bestpractices.html#useassertequalsinsteadofasserttrue">UseAssertEqualsInsteadOfAssertTrue</a>, <a href="pmd_rules_java_bestpractices.html#useassertnullinsteadofasserttrue">UseAssertNullInsteadOfAssertTrue</a>, <a href="pmd_rules_java_bestpractices.html#useassertsameinsteadofasserttrue">UseAssertSameInsteadOfAssertTrue</a>, <a href="pmd_rules_java_bestpractices.html#useasserttrueinsteadofassertequals">UseAssertTrueInsteadOfAssertEquals</a></p>
</li>
<li>
<p>Metrics (<code class="highlighter-rouge">rulesets/java/metrics.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_design.html#cyclomaticcomplexity">CyclomaticComplexity</a></p>
</li>
<li>
<p>MigratingToJUnit4 (<code class="highlighter-rouge">rulesets/java/migrating_to_junit4.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_bestpractices.html#junit4suitesshouldusesuiteannotation">JUnit4SuitesShouldUseSuiteAnnotation</a>, <a href="pmd_rules_java_bestpractices.html#junit4testshoulduseafterannotation">JUnit4TestShouldUseAfterAnnotation</a>, <a href="pmd_rules_java_bestpractices.html#junit4testshouldusebeforeannotation">JUnit4TestShouldUseBeforeAnnotation</a>, <a href="pmd_rules_java_bestpractices.html#junit4testshouldusetestannotation">JUnit4TestShouldUseTestAnnotation</a>, <a href="pmd_rules_java_bestpractices.html#junituseexpected">JUnitUseExpected</a></p>
</li>
<li>
<p>Migration (<code class="highlighter-rouge">rulesets/java/migrating.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#avoidassertasidentifier">AvoidAssertAsIdentifier</a>, <a href="pmd_rules_java_errorprone.html#avoidenumasidentifier">AvoidEnumAsIdentifier</a>, <a href="pmd_rules_java_performance.html#byteinstantiation">ByteInstantiation</a>, <a href="pmd_rules_java_bestpractices.html#forloopcanbeforeach">ForLoopCanBeForeach</a>, <a href="pmd_rules_java_performance.html#integerinstantiation">IntegerInstantiation</a>, <a href="pmd_rules_java_bestpractices.html#junit4suitesshouldusesuiteannotation">JUnit4SuitesShouldUseSuiteAnnotation</a>, <a href="pmd_rules_java_bestpractices.html#junit4testshoulduseafterannotation">JUnit4TestShouldUseAfterAnnotation</a>, <a href="pmd_rules_java_bestpractices.html#junit4testshouldusebeforeannotation">JUnit4TestShouldUseBeforeAnnotation</a>, <a href="pmd_rules_java_bestpractices.html#junit4testshouldusetestannotation">JUnit4TestShouldUseTestAnnotation</a>, <a href="pmd_rules_java_bestpractices.html#junituseexpected">JUnitUseExpected</a>, <a href="pmd_rules_java_performance.html#longinstantiation">LongInstantiation</a>, <a href="pmd_rules_java_bestpractices.html#replaceenumerationwithiterator">ReplaceEnumerationWithIterator</a>, <a href="pmd_rules_java_bestpractices.html#replacehashtablewithmap">ReplaceHashtableWithMap</a>, <a href="pmd_rules_java_bestpractices.html#replacevectorwithlist">ReplaceVectorWithList</a>, <a href="pmd_rules_java_performance.html#shortinstantiation">ShortInstantiation</a></p>
</li>
<li>
<p>Migration13 (<code class="highlighter-rouge">rulesets/java/migrating_to_13.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_bestpractices.html#replaceenumerationwithiterator">ReplaceEnumerationWithIterator</a>, <a href="pmd_rules_java_bestpractices.html#replacehashtablewithmap">ReplaceHashtableWithMap</a>, <a href="pmd_rules_java_bestpractices.html#replacevectorwithlist">ReplaceVectorWithList</a></p>
</li>
<li>
<p>Migration14 (<code class="highlighter-rouge">rulesets/java/migrating_to_14.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#avoidassertasidentifier">AvoidAssertAsIdentifier</a></p>
</li>
<li>
<p>Migration15 (<code class="highlighter-rouge">rulesets/java/migrating_to_15.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#avoidenumasidentifier">AvoidEnumAsIdentifier</a>, <a href="pmd_rules_java_performance.html#byteinstantiation">ByteInstantiation</a>, <a href="pmd_rules_java_performance.html#integerinstantiation">IntegerInstantiation</a>, <a href="pmd_rules_java_performance.html#longinstantiation">LongInstantiation</a>, <a href="pmd_rules_java_performance.html#shortinstantiation">ShortInstantiation</a></p>
</li>
<li>
<p>Naming (<code class="highlighter-rouge">rulesets/java/naming.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_codestyle.html#abstractnaming">AbstractNaming</a>, <a href="pmd_rules_java_codestyle.html#avoiddollarsigns">AvoidDollarSigns</a>, <a href="pmd_rules_java_errorprone.html#avoidfieldnamematchingmethodname">AvoidFieldNameMatchingMethodName</a>, <a href="pmd_rules_java_errorprone.html#avoidfieldnamematchingtypename">AvoidFieldNameMatchingTypeName</a>, <a href="pmd_rules_java_codestyle.html#booleangetmethodname">BooleanGetMethodName</a>, <a href="pmd_rules_java_codestyle.html#classnamingconventions">ClassNamingConventions</a>, <a href="pmd_rules_java_codestyle.html#genericsnaming">GenericsNaming</a>, <a href="pmd_rules_java_codestyle.html#longvariable">LongVariable</a>, <a href="pmd_rules_java_codestyle.html#methodnamingconventions">MethodNamingConventions</a>, <a href="pmd_rules_java_errorprone.html#methodwithsamenameasenclosingclass">MethodWithSameNameAsEnclosingClass</a>, <a href="pmd_rules_java_codestyle.html#misleadingvariablename">MisleadingVariableName</a>, <a href="pmd_rules_java_codestyle.html#misleadingvariablename">MIsLeadingVariableName</a>, <a href="pmd_rules_java_codestyle.html#nopackage">NoPackage</a>, <a href="pmd_rules_java_codestyle.html#packagecase">PackageCase</a>, <a href="pmd_rules_java_codestyle.html#shortclassname">ShortClassName</a>, <a href="pmd_rules_java_codestyle.html#shortmethodname">ShortMethodName</a>, <a href="pmd_rules_java_codestyle.html#shortvariable">ShortVariable</a>, <a href="pmd_rules_java_codestyle.html#suspiciousconstantfieldname">SuspiciousConstantFieldName</a>, <a href="pmd_rules_java_errorprone.html#suspiciousequalsmethodname">SuspiciousEqualsMethodName</a>, <a href="pmd_rules_java_errorprone.html#suspicioushashcodemethodname">SuspiciousHashcodeMethodName</a>, <a href="pmd_rules_java_codestyle.html#variablenamingconventions">VariableNamingConventions</a></p>
</li>
<li>
<p>Optimization (<code class="highlighter-rouge">rulesets/java/optimizations.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_performance.html#addemptystring">AddEmptyString</a>, <a href="pmd_rules_java_performance.html#avoidarrayloops">AvoidArrayLoops</a>, <a href="pmd_rules_java_performance.html#avoidinstantiatingobjectsinloops">AvoidInstantiatingObjectsInLoops</a>, <a href="pmd_rules_java_codestyle.html#localvariablecouldbefinal">LocalVariableCouldBeFinal</a>, <a href="pmd_rules_java_codestyle.html#methodargumentcouldbefinal">MethodArgumentCouldBeFinal</a>, <a href="pmd_rules_java_codestyle.html#prematuredeclaration">PrematureDeclaration</a>, <a href="pmd_rules_java_performance.html#redundantfieldinitializer">RedundantFieldInitializer</a>, <a href="pmd_rules_java_performance.html#simplifystartswith">SimplifyStartsWith</a>, <a href="pmd_rules_java_performance.html#unnecessarywrapperobjectcreation">UnnecessaryWrapperObjectCreation</a>, <a href="pmd_rules_java_performance.html#usearraylistinsteadofvector">UseArrayListInsteadOfVector</a>, <a href="pmd_rules_java_performance.html#usearraysaslist">UseArraysAsList</a>, <a href="pmd_rules_java_performance.html#usestringbufferforstringappends">UseStringBufferForStringAppends</a></p>
</li>
<li>
<p>quickstart (<code class="highlighter-rouge">rulesets/java/quickstart.xml</code>):</p>
<p>Quickstart configuration of PMD. Includes the rules that are most likely to apply everywhere.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_design.html#abstractclasswithoutanymethod">AbstractClassWithoutAnyMethod</a>, <a href="pmd_rules_java_errorprone.html#assignmentinoperand">AssignmentInOperand</a>, <a href="pmd_rules_java_errorprone.html#assignmenttononfinalstatic">AssignmentToNonFinalStatic</a>, <a href="pmd_rules_java_errorprone.html#avoidaccessibilityalteration">AvoidAccessibilityAlteration</a>, <a href="pmd_rules_java_errorprone.html#avoidbranchingstatementaslastinloop">AvoidBranchingStatementAsLastInLoop</a>, <a href="pmd_rules_java_errorprone.html#avoidcatchingthrowable">AvoidCatchingThrowable</a>, <a href="pmd_rules_java_errorprone.html#avoiddecimalliteralsinbigdecimalconstructor">AvoidDecimalLiteralsInBigDecimalConstructor</a>, <a href="pmd_rules_java_codestyle.html#avoiddollarsigns">AvoidDollarSigns</a>, <a href="pmd_rules_java_errorprone.html#avoidinstanceofchecksincatchclause">AvoidInstanceofChecksInCatchClause</a>, <a href="pmd_rules_java_errorprone.html#avoidmultipleunaryoperators">AvoidMultipleUnaryOperators</a>, <a href="pmd_rules_java_codestyle.html#avoidprotectedfieldinfinalclass">AvoidProtectedFieldInFinalClass</a>, <a href="pmd_rules_java_codestyle.html#avoidprotectedmethodinfinalclassnotextending">AvoidProtectedMethodInFinalClassNotExtending</a>, <a href="pmd_rules_java_bestpractices.html#avoidstringbufferfield">AvoidStringBufferField</a>, <a href="pmd_rules_java_multithreading.html#avoidthreadgroup">AvoidThreadGroup</a>, <a href="pmd_rules_java_bestpractices.html#avoidusinghardcodedip">AvoidUsingHardCodedIP</a>, <a href="pmd_rules_java_errorprone.html#avoidusingoctalvalues">AvoidUsingOctalValues</a>, <a href="pmd_rules_java_multithreading.html#avoidusingvolatile">AvoidUsingVolatile</a>, <a href="pmd_rules_java_errorprone.html#badcomparison">BadComparison</a>, <a href="pmd_rules_java_performance.html#bigintegerinstantiation">BigIntegerInstantiation</a>, <a href="pmd_rules_java_performance.html#booleaninstantiation">BooleanInstantiation</a>, <a href="pmd_rules_java_errorprone.html#brokennullcheck">BrokenNullCheck</a>, <a href="pmd_rules_java_bestpractices.html#checkresultset">CheckResultSet</a>, <a href="pmd_rules_java_errorprone.html#checkskipresult">CheckSkipResult</a>, <a href="pmd_rules_java_errorprone.html#classcastexceptionwithtoarray">ClassCastExceptionWithToArray</a>, <a href="pmd_rules_java_codestyle.html#classnamingconventions">ClassNamingConventions</a>, <a href="pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal">ClassWithOnlyPrivateConstructorsShouldBeFinal</a>, <a href="pmd_rules_java_errorprone.html#clonemethodmustbepublic">CloneMethodMustBePublic</a>, <a href="pmd_rules_java_errorprone.html#clonemethodmustimplementcloneable">CloneMethodMustImplementCloneable</a>, <a href="pmd_rules_java_errorprone.html#clonemethodreturntypemustmatchclassname">CloneMethodReturnTypeMustMatchClassName</a>, <a href="pmd_rules_java_errorprone.html#clonethrowsclonenotsupportedexception">CloneThrowsCloneNotSupportedException</a>, <a href="pmd_rules_java_errorprone.html#closeresource">CloseResource</a>, <a href="pmd_rules_java_errorprone.html#compareobjectswithequals">CompareObjectsWithEquals</a>, <a href="pmd_rules_java_bestpractices.html#constantsininterface">ConstantsInInterface</a>, <a href="pmd_rules_java_codestyle.html#controlstatementbraces">ControlStatementBraces</a>, <a href="pmd_rules_java_bestpractices.html#defaultlabelnotlastinswitchstmt">DefaultLabelNotLastInSwitchStmt</a>, <a href="pmd_rules_java_errorprone.html#donotcallgarbagecollectionexplicitly">DoNotCallGarbageCollectionExplicitly</a>, <a href="pmd_rules_java_design.html#donotextendjavalangerror">DoNotExtendJavaLangError</a>, <a href="pmd_rules_java_errorprone.html#donotextendjavalangthrowable">DoNotExtendJavaLangThrowable</a>, <a href="pmd_rules_java_multithreading.html#dontcallthreadrun">DontCallThreadRun</a>, <a href="pmd_rules_java_codestyle.html#dontimportjavalang">DontImportJavaLang</a>, <a href="pmd_rules_java_errorprone.html#dontusefloattypeforloopindices">DontUseFloatTypeForLoopIndices</a>, <a href="pmd_rules_java_multithreading.html#doublecheckedlocking">DoubleCheckedLocking</a>, <a href="pmd_rules_java_codestyle.html#duplicateimports">DuplicateImports</a>, <a href="pmd_rules_java_errorprone.html#emptycatchblock">EmptyCatchBlock</a>, <a href="pmd_rules_java_errorprone.html#emptyfinalizer">EmptyFinalizer</a>, <a href="pmd_rules_java_errorprone.html#emptyfinallyblock">EmptyFinallyBlock</a>, <a href="pmd_rules_java_errorprone.html#emptyifstmt">EmptyIfStmt</a>, <a href="pmd_rules_java_errorprone.html#emptyinitializer">EmptyInitializer</a>, <a href="pmd_rules_java_errorprone.html#emptystatementblock">EmptyStatementBlock</a>, <a href="pmd_rules_java_errorprone.html#emptystatementnotinloop">EmptyStatementNotInLoop</a>, <a href="pmd_rules_java_errorprone.html#emptyswitchstatements">EmptySwitchStatements</a>, <a href="pmd_rules_java_errorprone.html#emptysynchronizedblock">EmptySynchronizedBlock</a>, <a href="pmd_rules_java_errorprone.html#emptytryblock">EmptyTryBlock</a>, <a href="pmd_rules_java_errorprone.html#emptywhilestmt">EmptyWhileStmt</a>, <a href="pmd_rules_java_errorprone.html#equalsnull">EqualsNull</a>, <a href="pmd_rules_java_codestyle.html#extendsobject">ExtendsObject</a>, <a href="pmd_rules_java_design.html#finalfieldcouldbestatic">FinalFieldCouldBeStatic</a>, <a href="pmd_rules_java_bestpractices.html#forloopcanbeforeach">ForLoopCanBeForeach</a>, <a href="pmd_rules_java_codestyle.html#forloopshouldbewhileloop">ForLoopShouldBeWhileLoop</a>, <a href="pmd_rules_java_codestyle.html#formalparameternamingconventions">FormalParameterNamingConventions</a>, <a href="pmd_rules_java_codestyle.html#genericsnaming">GenericsNaming</a>, <a href="pmd_rules_java_bestpractices.html#guardlogstatement">GuardLogStatement</a>, <a href="pmd_rules_java_errorprone.html#idempotentoperations">IdempotentOperations</a>, <a href="pmd_rules_java_codestyle.html#identicalcatchbranches">IdenticalCatchBranches</a>, <a href="pmd_rules_java_errorprone.html#importfromsamepackage">ImportFromSamePackage</a>, <a href="pmd_rules_java_errorprone.html#instantiationtogetclass">InstantiationToGetClass</a>, <a href="pmd_rules_java_errorprone.html#jumbledincrementer">JumbledIncrementer</a>, <a href="pmd_rules_java_codestyle.html#localvariablenamingconventions">LocalVariableNamingConventions</a>, <a href="pmd_rules_java_design.html#logicinversion">LogicInversion</a>, <a href="pmd_rules_java_bestpractices.html#loosecoupling">LooseCoupling</a>, <a href="pmd_rules_java_codestyle.html#methodnamingconventions">MethodNamingConventions</a>, <a href="pmd_rules_java_errorprone.html#misplacednullcheck">MisplacedNullCheck</a>, <a href="pmd_rules_java_errorprone.html#missingbreakinswitch">MissingBreakInSwitch</a>, <a href="pmd_rules_java_bestpractices.html#missingoverride">MissingOverride</a>, <a href="pmd_rules_java_errorprone.html#missingstaticmethodinnoninstantiatableclass">MissingStaticMethodInNonInstantiatableClass</a>, <a href="pmd_rules_java_errorprone.html#noncaselabelinswitchstatement">NonCaseLabelInSwitchStatement</a>, <a href="pmd_rules_java_errorprone.html#nonstaticinitializer">NonStaticInitializer</a>, <a href="pmd_rules_java_multithreading.html#nonthreadsafesingleton">NonThreadSafeSingleton</a>, <a href="pmd_rules_java_codestyle.html#nopackage">NoPackage</a>, <a href="pmd_rules_java_bestpractices.html#onedeclarationperline">OneDeclarationPerLine</a>, <a href="pmd_rules_java_performance.html#optimizabletoarraycall">OptimizableToArrayCall</a>, <a href="pmd_rules_java_errorprone.html#overridebothequalsandhashcode">OverrideBothEqualsAndHashcode</a>, <a href="pmd_rules_java_codestyle.html#packagecase">PackageCase</a>, <a href="pmd_rules_java_bestpractices.html#positionliteralsfirstincaseinsensitivecomparisons">PositionLiteralsFirstInCaseInsensitiveComparisons</a>, <a href="pmd_rules_java_bestpractices.html#positionliteralsfirstincomparisons">PositionLiteralsFirstInComparisons</a>, <a href="pmd_rules_java_bestpractices.html#preservestacktrace">PreserveStackTrace</a>, <a href="pmd_rules_java_errorprone.html#propercloneimplementation">ProperCloneImplementation</a>, <a href="pmd_rules_java_errorprone.html#properlogger">ProperLogger</a>, <a href="pmd_rules_java_errorprone.html#returnemptyarrayratherthannull">ReturnEmptyArrayRatherThanNull</a>, <a href="pmd_rules_java_errorprone.html#returnfromfinallyblock">ReturnFromFinallyBlock</a>, <a href="pmd_rules_java_design.html#simplifiedternary">SimplifiedTernary</a>, <a href="pmd_rules_java_design.html#simplifybooleanreturns">SimplifyBooleanReturns</a>, <a href="pmd_rules_java_design.html#simplifyconditional">SimplifyConditional</a>, <a href="pmd_rules_java_errorprone.html#singlemethodsingleton">SingleMethodSingleton</a>, <a href="pmd_rules_java_errorprone.html#singletonclassreturningnewinstance">SingletonClassReturningNewInstance</a>, <a href="pmd_rules_java_design.html#singularfield">SingularField</a>, <a href="pmd_rules_java_errorprone.html#suspiciousequalsmethodname">SuspiciousEqualsMethodName</a>, <a href="pmd_rules_java_errorprone.html#suspicioushashcodemethodname">SuspiciousHashcodeMethodName</a>, <a href="pmd_rules_java_errorprone.html#suspiciousoctalescape">SuspiciousOctalEscape</a>, <a href="pmd_rules_java_bestpractices.html#switchstmtsshouldhavedefault">SwitchStmtsShouldHaveDefault</a>, <a href="pmd_rules_java_documentation.html#uncommentedemptyconstructor">UncommentedEmptyConstructor</a>, <a href="pmd_rules_java_documentation.html#uncommentedemptymethodbody">UncommentedEmptyMethodBody</a>, <a href="pmd_rules_java_errorprone.html#unconditionalifstatement">UnconditionalIfStatement</a>, <a href="pmd_rules_java_codestyle.html#unnecessaryannotationvalueelement">UnnecessaryAnnotationValueElement</a>, <a href="pmd_rules_java_codestyle.html#unnecessaryconstructor">UnnecessaryConstructor</a>, <a href="pmd_rules_java_errorprone.html#unnecessaryconversiontemporary">UnnecessaryConversionTemporary</a>, <a href="pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname">UnnecessaryFullyQualifiedName</a>, <a href="pmd_rules_java_codestyle.html#unnecessarylocalbeforereturn">UnnecessaryLocalBeforeReturn</a>, <a href="pmd_rules_java_codestyle.html#unnecessarymodifier">UnnecessaryModifier</a>, <a href="pmd_rules_java_codestyle.html#unnecessaryreturn">UnnecessaryReturn</a>, <a href="pmd_rules_java_multithreading.html#unsynchronizedstaticdateformatter">UnsynchronizedStaticDateFormatter</a>, <a href="pmd_rules_java_bestpractices.html#unusedformalparameter">UnusedFormalParameter</a>, <a href="pmd_rules_java_bestpractices.html#unusedimports">UnusedImports</a>, <a href="pmd_rules_java_bestpractices.html#unusedlocalvariable">UnusedLocalVariable</a>, <a href="pmd_rules_java_errorprone.html#unusednullcheckinequals">UnusedNullCheckInEquals</a>, <a href="pmd_rules_java_bestpractices.html#unusedprivatefield">UnusedPrivateField</a>, <a href="pmd_rules_java_bestpractices.html#unusedprivatemethod">UnusedPrivateMethod</a>, <a href="pmd_rules_java_bestpractices.html#useassertequalsinsteadofasserttrue">UseAssertEqualsInsteadOfAssertTrue</a>, <a href="pmd_rules_java_bestpractices.html#useassertnullinsteadofasserttrue">UseAssertNullInsteadOfAssertTrue</a>, <a href="pmd_rules_java_bestpractices.html#useassertsameinsteadofasserttrue">UseAssertSameInsteadOfAssertTrue</a>, <a href="pmd_rules_java_bestpractices.html#useasserttrueinsteadofassertequals">UseAssertTrueInsteadOfAssertEquals</a>, <a href="pmd_rules_java_bestpractices.html#usecollectionisempty">UseCollectionIsEmpty</a>, <a href="pmd_rules_java_errorprone.html#useequalstocomparestrings">UseEqualsToCompareStrings</a>, <a href="pmd_rules_java_errorprone.html#uselessoperationonimmutable">UselessOperationOnImmutable</a>, <a href="pmd_rules_java_design.html#uselessoverridingmethod">UselessOverridingMethod</a>, <a href="pmd_rules_java_codestyle.html#uselessparentheses">UselessParentheses</a>, <a href="pmd_rules_java_codestyle.html#uselessqualifiedthis">UselessQualifiedThis</a>, <a href="pmd_rules_java_errorprone.html#uselocalewithcaseconversions">UseLocaleWithCaseConversions</a>, <a href="pmd_rules_java_multithreading.html#usenotifyallinsteadofnotify">UseNotifyAllInsteadOfNotify</a>, <a href="pmd_rules_java_design.html#useutilityclass">UseUtilityClass</a></p>
</li>
<li>
<p>Security Code Guidelines (<code class="highlighter-rouge">rulesets/java/sunsecure.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_bestpractices.html#arrayisstoreddirectly">ArrayIsStoredDirectly</a>, <a href="pmd_rules_java_bestpractices.html#methodreturnsinternalarray">MethodReturnsInternalArray</a></p>
</li>
<li>
<p>Strict Exceptions (<code class="highlighter-rouge">rulesets/java/strictexception.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_design.html#avoidcatchinggenericexception">AvoidCatchingGenericException</a>, <a href="pmd_rules_java_errorprone.html#avoidcatchingnpe">AvoidCatchingNPE</a>, <a href="pmd_rules_java_errorprone.html#avoidcatchingthrowable">AvoidCatchingThrowable</a>, <a href="pmd_rules_java_errorprone.html#avoidlosingexceptioninformation">AvoidLosingExceptionInformation</a>, <a href="pmd_rules_java_design.html#avoidrethrowingexception">AvoidRethrowingException</a>, <a href="pmd_rules_java_design.html#avoidthrowingnewinstanceofsameexception">AvoidThrowingNewInstanceOfSameException</a>, <a href="pmd_rules_java_design.html#avoidthrowingnullpointerexception">AvoidThrowingNullPointerException</a>, <a href="pmd_rules_java_design.html#avoidthrowingrawexceptiontypes">AvoidThrowingRawExceptionTypes</a>, <a href="pmd_rules_java_design.html#donotextendjavalangerror">DoNotExtendJavaLangError</a>, <a href="pmd_rules_java_errorprone.html#donotthrowexceptioninfinally">DoNotThrowExceptionInFinally</a>, <a href="pmd_rules_java_design.html#exceptionasflowcontrol">ExceptionAsFlowControl</a>, <a href="pmd_rules_java_design.html#signaturedeclarethrowsexception">SignatureDeclareThrowsException</a></p>
</li>
<li>
<p>String and StringBuffer (<code class="highlighter-rouge">rulesets/java/strings.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_performance.html#appendcharacterwithchar">AppendCharacterWithChar</a>, <a href="pmd_rules_java_errorprone.html#avoidduplicateliterals">AvoidDuplicateLiterals</a>, <a href="pmd_rules_java_bestpractices.html#avoidstringbufferfield">AvoidStringBufferField</a>, <a href="pmd_rules_java_performance.html#consecutiveappendsshouldreuse">ConsecutiveAppendsShouldReuse</a>, <a href="pmd_rules_java_performance.html#consecutiveliteralappends">ConsecutiveLiteralAppends</a>, <a href="pmd_rules_java_performance.html#inefficientemptystringcheck">InefficientEmptyStringCheck</a>, <a href="pmd_rules_java_performance.html#inefficientstringbuffering">InefficientStringBuffering</a>, <a href="pmd_rules_java_performance.html#insufficientstringbufferdeclaration">InsufficientStringBufferDeclaration</a>, <a href="pmd_rules_java_errorprone.html#stringbufferinstantiationwithchar">StringBufferInstantiationWithChar</a>, <a href="pmd_rules_java_performance.html#stringinstantiation">StringInstantiation</a>, <a href="pmd_rules_java_performance.html#stringtostring">StringToString</a>, <a href="pmd_rules_java_errorprone.html#unnecessarycasechange">UnnecessaryCaseChange</a>, <a href="pmd_rules_java_errorprone.html#useequalstocomparestrings">UseEqualsToCompareStrings</a>, <a href="pmd_rules_java_performance.html#useindexofchar">UseIndexOfChar</a>, <a href="pmd_rules_java_performance.html#uselessstringvalueof">UselessStringValueOf</a>, <a href="pmd_rules_java_performance.html#usestringbufferlength">UseStringBufferLength</a></p>
</li>
<li>
<p>Type Resolution (<code class="highlighter-rouge">rulesets/java/typeresolution.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#clonemethodmustimplementcloneable">CloneMethodMustImplementCloneable</a>, <a href="pmd_rules_java_bestpractices.html#loosecoupling">LooseCoupling</a>, <a href="pmd_rules_java_design.html#signaturedeclarethrowsexception">SignatureDeclareThrowsException</a>, <a href="pmd_rules_java_bestpractices.html#unusedimports">UnusedImports</a></p>
</li>
<li>
<p>Unnecessary (<code class="highlighter-rouge">rulesets/java/unnecessary.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_errorprone.html#unnecessaryconversiontemporary">UnnecessaryConversionTemporary</a>, <a href="pmd_rules_java_codestyle.html#unnecessarymodifier">UnnecessaryFinalModifier</a>, <a href="pmd_rules_java_codestyle.html#unnecessarymodifier">UnnecessaryModifier</a>, <a href="pmd_rules_java_codestyle.html#unnecessaryreturn">UnnecessaryReturn</a>, <a href="pmd_rules_java_errorprone.html#unusednullcheckinequals">UnusedNullCheckInEquals</a>, <a href="pmd_rules_java_errorprone.html#uselessoperationonimmutable">UselessOperationOnImmutable</a>, <a href="pmd_rules_java_design.html#uselessoverridingmethod">UselessOverridingMethod</a>, <a href="pmd_rules_java_codestyle.html#uselessparentheses">UselessParentheses</a>, <a href="pmd_rules_java_codestyle.html#uselessqualifiedthis">UselessQualifiedThis</a></p>
</li>
<li>
<p>Unused Code (<code class="highlighter-rouge">rulesets/java/unusedcode.xml</code>):</p>
<p><span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This ruleset is for backwards compatibility.</p>
<p>It contains the following rules:</p>
<p><a href="pmd_rules_java_bestpractices.html#unusedformalparameter">UnusedFormalParameter</a>, <a href="pmd_rules_java_bestpractices.html#unusedlocalvariable">UnusedLocalVariable</a>, <a href="pmd_rules_java_bestpractices.html#unusedprivatefield">UnusedPrivateField</a>, <a href="pmd_rules_java_bestpractices.html#unusedprivatemethod">UnusedPrivateMethod</a></p>
</li>
</ul>
<div class="tags">
<b>Tags: </b>
<a href="tag_rule_references.html" class="btn btn-default navbar-btn cursorNorm" role="button">rule_references</a>
</div>
</div>
<hr class="shaded"/>
<footer>
<div class="row">
<div class="col-lg-12 footer">
&copy;2018 PMD Open Source Project. All rights reserved. <br />
Site last generated: Nov 11, 2018 <br />
<p><img src="images/pmd-logo-small.png" alt="Company logo"/></p>
</div>
</div>
</footer>
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</div>
</div>
</body>
</html>