2235 lines
162 KiB
HTML
2235 lines
162 KiB
HTML
<!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"> <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-toc-wrapper">
|
||
<div class="container">
|
||
<div class="col-lg-12"> </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.50.0-SNAPSHOT</li>
|
||
<div class="sidebarTitleDate">Release date: 30-September-2022</div>
|
||
|
||
|
||
|
||
|
||
|
||
<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_next_major_development.html">PMD 7.0.0 development</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><a href="pmd_userdocs_report_formats.html">PMD Report formats</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="subfolders">
|
||
<a href="#">CPD reference</a>
|
||
<ul>
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_cpd.html">Copy-paste detection</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_cpd_report_formats.html">CPD Report formats</a></li>
|
||
|
||
|
||
|
||
</ul>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="subfolders">
|
||
<a href="#">Extending PMD</a>
|
||
<ul>
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_extending_writing_rules_intro.html">Introduction to writing rules</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_extending_your_first_rule.html">Your first rule</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_extending_writing_xpath_rules.html">XPath rules</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_extending_writing_java_rules.html">Java rules</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_extending_designer_reference.html">Rule designer reference</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 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_gradle.html">Gradle</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_tools_ant.html">Ant</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_userdocs_tools_java_api.html">PMD Java API</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_documentation.html">Documentation</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="#">HTML Rules</a>
|
||
<ul>
|
||
|
||
|
||
|
||
<li><a href="pmd_rules_html.html">Index</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_rules_html_bestpractices.html">Best Practices</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="#">Modelica Rules</a>
|
||
<ul>
|
||
|
||
|
||
|
||
<li><a href="pmd_rules_modelica.html">Index</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_rules_modelica_bestpractices.html">Best Practices</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 class="subfolders">
|
||
<a href="#">Java Support</a>
|
||
<ul>
|
||
|
||
|
||
|
||
<li><a href="pmd_languages_java.html">Java Versions</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_java_metrics_index.html">Java Code Metrics</a></li>
|
||
|
||
|
||
|
||
</ul>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_apex_metrics_index.html">Apex code metrics</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_languages_plsql.html">PLSQL</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_languages_visualforce.html">Visualforce</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_languages_xml.html">XML and XML dialects</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_languages_html.html">HTML</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_languages_gherkin.html">Gherkin</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><a href="pmd_devdocs_rule_deprecation_policy.html">Rule Deprecation Policy</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="subfolders">
|
||
<a href="#">Major contributions</a>
|
||
<ul>
|
||
|
||
|
||
|
||
<li><a href="pmd_devdocs_major_rule_guidelines.html">Rule Guidelines</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<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>
|
||
|
||
|
||
|
||
<li class="subfolders">
|
||
<a href="#">Experimental features</a>
|
||
<ul>
|
||
|
||
|
||
|
||
<li><a href="pmd_devdocs_experimental_ast_dump.html">Creating (XML) dump of the AST</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_infrastructure.html">Infrastructure</a></li>
|
||
|
||
|
||
|
||
|
||
|
||
<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>
|
||
|
||
|
||
|
||
|
||
|
||
<li><a href="pmd_projectdocs_committers_main_landing_page.html">Main Landing page</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">
|
||
<header>
|
||
<div class="row">
|
||
<div class="col-lg-12">
|
||
<a href="./" role="button"
|
||
><i class="fa fa-home fa-lg"></i
|
||
></a>
|
||
» Java Rules
|
||
</div>
|
||
</div>
|
||
|
||
<hr />
|
||
</header>
|
||
|
||
|
||
<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>
|
||
|
||
<div id="inline-toc"><!-- empty, move TOC here when screen size too small --></div>
|
||
|
||
<!-- DO NOT EDIT THIS FILE. This file is generated. -->
|
||
<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 suggests an incomplet…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#accessorclassgeneration">AccessorClassGeneration</a>: Instantiation by way of private constructors from outside of the constructor’s class often causes…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#accessormethodgeneration">AccessorMethodGeneration</a>: When accessing private fields / methods from another class, the Java compiler will generate acces…</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 …</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#avoidmessagedigestfield">AvoidMessageDigestField</a>: Declaring a MessageDigest instance as a field make this instance directly available to multiple t…</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#avoidreassigningcatchvariables">AvoidReassigningCatchVariables</a>: Reassigning exception variables caught in a catch statement should be avoided because of: 1) If i…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#avoidreassigningloopvariables">AvoidReassigningLoopVariables</a>: Reassigning loop variables can lead to hard-to-find bugs. Prevent or limit how these variables ca…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#avoidreassigningparameters">AvoidReassigningParameters</a>: Reassigning values to incoming parameters of a method or constructor is not recommended, as this …</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 leaks if…</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. Externali…</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#doublebraceinitialization">DoubleBraceInitialization</a>: Double brace initialisation is a pattern to initialise eg collections concisely. But it implicitl…</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 over …</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#forloopvariablecount">ForLoopVariableCount</a>: Having a lot of control variables in a ‘for’ loop makes it harder to see what range of values the…</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, or otherwise sk…</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 indicated thr…</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#junit5testshouldbepackageprivate">JUnit5TestShouldBePackagePrivate</a>: Reports JUnit 5 test classes and methods that are not package-private. Contrary to JUnit 4 tests,…</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#literalsfirstincomparisons">LiteralsFirstInComparisons</a>: Position literals first in all String comparisons, if the second argument is null then NullPointe…</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 …</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, it ca…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#positionliteralsfirstincaseinsensitivecomparisons">PositionLiteralsFirstInCaseInsensitiveComparisons</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> 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>: <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> 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 the new e…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#primitivewrapperinstantiation">PrimitiveWrapperInstantiation</a>: Reports usages of primitive wrapper constructors. They are deprecated since Java 9 an…</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#simplifiabletestassertion">SimplifiableTestAssertion</a>: Reports test assertions that may be simplified using a more specific assertion method…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#switchstmtsshouldhavedefault">SwitchStmtsShouldHaveDefault</a>: Switch statements should be exhaustive, to make their control flow easier to follow. …</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#systemprintln">SystemPrintln</a>: References to System.(out|err).print are usually intended for debugging purposes and can remain …</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#unusedassignment">UnusedAssignment</a>: Reports assignments to variables that are never used before the variable is overwritten, …</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#unusedformalparameter">UnusedFormalParameter</a>: Reports parameters of methods and constructors that are not referenced them in the method body. P…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#unusedimports">UnusedImports</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> Reports import statements that are not used within the file. This also reports duplicate imports,…</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. Variables whose name sta…</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>: <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 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>: <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 detects JUnit assertions in object references equality. These assertions should be made…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#useassertsameinsteadofasserttrue">UseAssertSameInsteadOfAssertTrue</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 detects JUnit assertions in object references equality. These assertions should be made…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#useasserttrueinsteadofassertequals">UseAssertTrueInsteadOfAssertEquals</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> 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#usestandardcharsets">UseStandardCharsets</a>: Starting with Java 7, StandardCharsets provides constants for common Charset objects, such as UTF…</li>
|
||
<li><a href="pmd_rules_java_bestpractices.html#usetrywithresources">UseTryWithResources</a>: Java 7 introduced the try-with-resources statement. This statement ensures that each resource is …</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>
|
||
<li><a href="pmd_rules_java_bestpractices.html#whileloopwithliteralboolean">WhileLoopWithLiteralBoolean</a>: ‘do {} while (true);’ requires reading the end of the statement before it is apparent that it loo…</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’. This rule is deprecated and will be removed with …</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>: <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 final local variables, turn them into fields. Note that this is a controversial rule …</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 should o…</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 but another cons…</li>
|
||
<li><a href="pmd_rules_java_codestyle.html#classnamingconventions">ClassNamingConventions</a>: Configurable naming conventions for type declarations. This rule reports type declara…</li>
|
||
<li><a href="pmd_rules_java_codestyle.html#commentdefaultaccessmodifier">CommentDefaultAccessModifier</a>: To avoid mistakes if we want that an Annotation, Class, Enum, Method, Constructor or Field have a…</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>: <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> Use explicit scoping instead of accidental usage of default package private level. The rule allow…</li>
|
||
<li><a href="pmd_rules_java_codestyle.html#dontimportjavalang">DontImportJavaLang</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 importing anything from the package ‘java.lang’. These classes are automatically imported …</li>
|
||
<li><a href="pmd_rules_java_codestyle.html#duplicateimports">DuplicateImports</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> Duplicate or overlapping import statements should be avoided. This rule is deprecated since PMD 6…</li>
|
||
<li><a href="pmd_rules_java_codestyle.html#emptycontrolstatement">EmptyControlStatement</a>: Reports control statements whose body is empty, as well as empty initializers. The ch…</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#finalparameterinabstractmethod">FinalParameterInAbstractMethod</a>: Declaring a method parameter as final for an interface method is useless because the implementati…</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 ru…</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 dec…</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, interface, enum or annotation 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 - Sun’s 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 it’s the only element.</li>
|
||
<li><a href="pmd_rules_java_codestyle.html#unnecessarycast">UnnecessaryCast</a>: This rule detects when a cast is unnecessary while accessing collection elements. This rule is mo…</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 name …</li>
|
||
<li><a href="pmd_rules_java_codestyle.html#unnecessaryimport">UnnecessaryImport</a>: Reports import statements that can be removed. They are either unused, duplicated, or…</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#unnecessarysemicolon">UnnecessarySemicolon</a>: Reports unnecessary semicolons (so called "empty statements" and "empty declarations"). …</li>
|
||
<li><a href="pmd_rules_java_codestyle.html#usediamondoperator">UseDiamondOperator</a>: Use the diamond operator to let the type be inferred automatically. With the Diamond operator it …</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#useshortarrayinitializer">UseShortArrayInitializer</a>: When declaring and initializing array fields or variables, it is not necessary to explicitly crea…</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, it checks for fin…</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 container t…</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, Exce…</li>
|
||
<li><a href="pmd_rules_java_design.html#avoiduncheckedexceptionsinsignatures">AvoidUncheckedExceptionsInSignatures</a>: A method or constructor should not explicitly declare unchecked exceptions in its ‘throws’ clause…</li>
|
||
<li><a href="pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal">ClassWithOnlyPrivateConstructorsShouldBeFinal</a>: A class with only private constructors should be final, unless the private constructor is invoked…</li>
|
||
<li><a href="pmd_rules_java_design.html#cognitivecomplexity">CognitiveComplexity</a>: Methods that are highly complex are difficult to read and more costly to maintain. If you include…</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, and without complex funct…</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 its n…</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 object initialization ends either in the…</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#mutablestaticstate">MutableStaticState</a>: Non-private static fields should be made constants (or immutable references) by declaring them fi…</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. Wh…</li>
|
||
<li><a href="pmd_rules_java_design.html#signaturedeclarethrowsexception">SignatureDeclareThrowsException</a>: A method/constructor shouldn’t explicitly throw the generic java.lang.Exception, since it is uncl…</li>
|
||
<li><a href="pmd_rules_java_design.html#simplifiedternary">SimplifiedTernary</a>: Look for ternary operators with the form ‘condition ? literalBoolean : foo’ or ‘condition ? foo :…</li>
|
||
<li><a href="pmd_rules_java_design.html#simplifybooleanassertion">SimplifyBooleanAssertion</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 negation in an assertTrue or assertFalse test. For example, rephrase: assertTrue(!expr)…</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 of the 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 containing object to pr…</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 statement is o…</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 its …</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 d…</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 don’t want to offend anyone.</li>
|
||
<li><a href="pmd_rules_java_documentation.html#commentrequired">CommentRequired</a>: Denotes whether javadoc (formal) 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 not contain statements, bu…</li>
|
||
<li><a href="pmd_rules_java_documentation.html#uncommentedemptymethodbody">UncommentedEmptyMethodBody</a>: Uncommented Empty Method Body finds instances where a method body does not contain statements, bu…</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()’, ‘getDeclaredMethods()’, and ‘getDeclaredFields()’ al…</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 …</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 type 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 variables …</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 information …</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 intende…</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 be i…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#badcomparison">BadComparison</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> The rule has been renamed. Use instead <a href="pmd_rules_java_errorprone.html#comparisonwithnan">ComparisonWithNaN</a>.</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 of t…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#clonemethodmustbepublic">CloneMethodMustBePublic</a>: The java Manual says "By convention, classes that implement this interface should override Object…</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>: <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> The method clone() should throw a CloneNotSupportedException. This rule is deprecated since PMD 6…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#closeresource">CloseResource</a>: Ensure that resources (like ‘java.sql.Connection’, ‘java.sql.Statement’, and ‘java.sql.ResultSet’…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#compareobjectswithequals">CompareObjectsWithEquals</a>: Use ‘equals()’ to compare object references; avoid comparing them with ‘==’. Since comparing obje…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#comparisonwithnan">ComparisonWithNaN</a>: Reports comparisons with double and float ‘NaN’ (Not-a-Number) values. These are [spe…</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>: <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> The dataflow analysis tracks local definitions, undefinitions and references to variables on diff…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#detachedtestcase">DetachedTestCase</a>: The method appears to be a test case since it has public or default visibility, non-static access…</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>: <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> The rule has been renamed. Use instead <a href="pmd_rules_java_errorprone.html#donotterminatevm">DoNotTerminateVM</a>.</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#donotterminatevm">DoNotTerminateVM</a>: Web applications should not call ‘System.exit()’, since only the web container or the application…</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>: Don’t use floating point for loop indices. If you must use floating point, use double unless you’…</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 circ…</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>: <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> Empty finally blocks serve no purpose and should be removed. This rule is deprecated since PMD 6….</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#emptyifstmt">EmptyIfStmt</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> Empty If Statement finds instances where a condition is checked but nothing is done about it. Thi…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#emptyinitializer">EmptyInitializer</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> Empty initializers serve no purpose and should be removed. This rule is deprecated since PMD 6.46…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#emptystatementblock">EmptyStatementBlock</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> Empty block statements serve no purpose and should be removed. This rule is deprecated since PMD …</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>: <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> Empty switch statements serve no purpose and should be removed.# This rule is deprecated since PM…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#emptysynchronizedblock">EmptySynchronizedBlock</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> Empty synchronized blocks serve no purpose and should be removed. This rule is deprecated since P…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#emptytryblock">EmptyTryBlock</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 empty try blocks - what’s the point? This rule is deprecated since PMD 6.46.0. Use the rule…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#emptywhilestmt">EmptyWhileStmt</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> Empty While Statement finds all instances where a while statement does nothing. If it is a timing…</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#implicitswitchfallthrough">ImplicitSwitchFallThrough</a>: Switch statements without break or return statements for each case option may indicate problemati…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#importfromsamepackage">ImportFromSamePackage</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> There is no need to import a type that lives in the same package. This rule is deprecated since P…</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#invalidlogmessageformat">InvalidLogMessageFormat</a>: Check for messages in slf4j and log4j2 (since 6.19.0) loggers with non matching number of argumen…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#invalidslf4jmessageformat">InvalidSlf4jMessageFormat</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> The rule has been renamed. Use instead <a href="pmd_rules_java_errorprone.html#invalidlogmessageformat">InvalidLogMessageFormat</a>.</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>: In JUnit 3, the setUp method is used to set up all data entities required in running tests. …</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>: <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> In most cases, the Logger reference can be declared as static and final. This rule is deprecated …</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. …</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#missingbreakinswitch">MissingBreakInSwitch</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> The rule has been renamed. Use instead <a href="pmd_rules_java_errorprone.html#implicitswitchfallthrough">ImplicitSwitchFallThrough</a>.</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#missingserialversionuid">MissingSerialVersionUID</a>: Serializable classes should provide a serialVersionUID field. The serialVersionUID field is also …</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 us…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#morethanonelogger">MoreThanOneLogger</a>: Normally only one logger is used in each class. This rule supports slf4j, log4j, Java Util Loggin…</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 lega…</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 to in…</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>: <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> For any method that returns an array, it is a better to return an empty array rather than a null …</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#returnemptycollectionratherthannull">ReturnEmptyCollectionRatherThanNull</a>: For any method that returns an collection (such as an array, Collection or Map), it is better to …</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 methods is t…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#singletonclassreturningnewinstance">SingletonClassReturningNewInstance</a>: A singleton class should only ever have one instance. Failure to check whether an ins…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#staticejbfieldshouldbefinal">StaticEJBFieldShouldBeFinal</a>: According to the J2EE specification, an EJB should not have any static fields with write access. …</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#stringbufferinstantiationwithchar">StringBufferInstantiationWithChar</a>: Individual character values provided as initialization arguments will be converted into integers….</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#suspiciousequalsmethodname">SuspiciousEqualsMethodName</a>: The method name and parameter number are suspiciously close to ‘Object.equals’, which can denote …</li>
|
||
<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 specifica…</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) won’t change the object it…</li>
|
||
<li><a href="pmd_rules_java_errorprone.html#uselocalewithcaseconversions">UseLocaleWithCaseConversions</a>: When doing ‘String::toLowerCase()/toUpperCase()’ conversions, use an explicit locale argument to …</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 environment i…</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. Threads are resources, that should …</li>
|
||
<li><a href="pmd_rules_java_multithreading.html#dontcallthreadrun">DontCallThreadRun</a>: Explicitly calling Thread.run() method will execute in the caller’s 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. Eliminate static singletons if possib…</li>
|
||
<li><a href="pmd_rules_java_multithreading.html#unsynchronizedstaticdateformatter">UnsynchronizedStaticDateFormatter</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> SimpleDateFormat instances are not synchronized. Sun recommends using separate format instances f…</li>
|
||
<li><a href="pmd_rules_java_multithreading.html#unsynchronizedstaticformatter">UnsynchronizedStaticFormatter</a>: Instances of ‘java.text.Format’ are generally not synchronized. Sun recommends using separate for…</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 can p…</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#avoidcalendardatecreation">AvoidCalendarDateCreation</a>: Problem: A Calendar is a heavyweight object and expensive to create. Solution: Use ‘new Date()’, …</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>: <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> Note: this rule is deprecated, as its rationale does not hold. Java uses the ‘short’ type to redu…</li>
|
||
<li><a href="pmd_rules_java_performance.html#bigintegerinstantiation">BigIntegerInstantiation</a>: Don’t create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and for J…</li>
|
||
<li><a href="pmd_rules_java_performance.html#booleaninstantiation">BooleanInstantiation</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 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>: <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> Calling new Byte() causes memory allocation that can be avoided by the static Byte.valueOf(). It …</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. Sin…</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 inefficient wa…</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>: <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> 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>: <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> Calling new Long() causes memory allocation that can be avoided by the static Long.valueOf(). It …</li>
|
||
<li><a href="pmd_rules_java_performance.html#optimizabletoarraycall">OptimizableToArrayCall</a>: Calls to a collection’s ‘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>: <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> Calling new Short() causes memory allocation that can be avoided by the static Short.valueOf(). I…</li>
|
||
<li><a href="pmd_rules_java_performance.html#simplifystartswith">SimplifyStartsWith</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> Note: this rule is deprecated for removal, as the optimization is insignificant. Calls to ‘string…</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>: <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> 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 …</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#useiostreamswithapachecommonsfileitem">UseIOStreamsWithApacheCommonsFileItem</a>: Problem: Use of [FileItem.get()](https://commons.apache.org/proper/commons-fileupload/apidocs/org…</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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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#comparisonwithnan">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#implicitswitchfallthrough">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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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#donotterminatevm">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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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_bestpractices.html#avoidmessagedigestfield">AvoidMessageDigestField</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_performance.html#bigintegerinstantiation">BigIntegerInstantiation</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#closeresource">CloseResource</a>, <a href="pmd_rules_java_errorprone.html#compareobjectswithequals">CompareObjectsWithEquals</a>, <a href="pmd_rules_java_errorprone.html#comparisonwithnan">ComparisonWithNaN</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_errorprone.html#dontusefloattypeforloopindices">DontUseFloatTypeForLoopIndices</a>, <a href="pmd_rules_java_bestpractices.html#doublebraceinitialization">DoubleBraceInitialization</a>, <a href="pmd_rules_java_multithreading.html#doublecheckedlocking">DoubleCheckedLocking</a>, <a href="pmd_rules_java_errorprone.html#emptycatchblock">EmptyCatchBlock</a>, <a href="pmd_rules_java_codestyle.html#emptycontrolstatement">EmptyControlStatement</a>, <a href="pmd_rules_java_errorprone.html#emptyfinalizer">EmptyFinalizer</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_codestyle.html#finalparameterinabstractmethod">FinalParameterInAbstractMethod</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#implicitswitchfallthrough">ImplicitSwitchFallThrough</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_bestpractices.html#literalsfirstincomparisons">LiteralsFirstInComparisons</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_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#preservestacktrace">PreserveStackTrace</a>, <a href="pmd_rules_java_bestpractices.html#primitivewrapperinstantiation">PrimitiveWrapperInstantiation</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#returnemptycollectionratherthannull">ReturnEmptyCollectionRatherThanNull</a>, <a href="pmd_rules_java_errorprone.html#returnfromfinallyblock">ReturnFromFinallyBlock</a>, <a href="pmd_rules_java_bestpractices.html#simplifiabletestassertion">SimplifiableTestAssertion</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#unnecessaryimport">UnnecessaryImport</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_codestyle.html#unnecessarysemicolon">UnnecessarySemicolon</a>, <a href="pmd_rules_java_multithreading.html#unsynchronizedstaticformatter">UnsynchronizedStaticFormatter</a>, <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_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#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_bestpractices.html#usestandardcharsets">UseStandardCharsets</a>, <a href="pmd_rules_java_design.html#useutilityclass">UseUtilityClass</a></p>
|
||
</li>
|
||
<li>
|
||
<p>Security Code Guidelines (<code class="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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="language-plaintext 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>
|
||
|
||
|
||
<footer>
|
||
|
||
<hr />
|
||
<div class="row">
|
||
<div class="col-lg-12 footer">
|
||
©2022 PMD Open Source Project. All rights
|
||
reserved. <br />
|
||
Site last generated: Sep 24, 2022 <br />
|
||
<p>
|
||
<img src="images/pmd-logo-small.png" alt="Company
|
||
logo"/>
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
|
||
</div>
|
||
|
||
<!-- /.row -->
|
||
</div>
|
||
<!-- /.container -->
|
||
</div>
|
||
|
||
|
||
<!-- Sticky TOC column -->
|
||
<div class="toc-col">
|
||
<div id="toc"></div>
|
||
</div>
|
||
|
||
<!-- /.toc-container-wrapper -->
|
||
</div>
|
||
</div>
|
||
</body>
|
||
|
||
</html>
|