diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7de37c7b02..106a714452 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,10 +29,11 @@ When filing a bug report, please provide as much information as possible, so tha ## Documentation -There is some documentation available under . Feel free to create a bug report if -documentation is missing, incomplete or outdated. +There is some documentation available under . Feel free to create a bug report if +documentation is missing, incomplete or outdated. See [Bug reports](#bug-reports). -The documentation is generated as a maven site, the source is available at: +The documentation is generated as a Jekyll site, the source is available at: . You can find build instructions there. +For more on contributing documentation check ## Questions diff --git a/docs/pages/pmd/devdocs/writing_documentation.md b/docs/pages/pmd/devdocs/writing_documentation.md index 2d7f25bc59..39edce11a4 100644 --- a/docs/pages/pmd/devdocs/writing_documentation.md +++ b/docs/pages/pmd/devdocs/writing_documentation.md @@ -17,13 +17,48 @@ The pages are in general in [Github Flavored Markdown](https://kramdown.gettalon ## Structure -All documentation is stored in the folder `docs/`. This is the folder, that github and the travis-ci scripts -use to render the site. +The documentation sources can be found in two places based on how they are generated: +- the ones that are manually written (like the one you are reading); +- and the ones that are generated automatically from the category files. All the rule documentation +pages are generated that way. -New pages are stored in the different subfolders under `pages`. The folder structure resembles the sidebar structure. +### Handwritten documentation + +All handwritten documentation is stored in the subfolders under `docs/pages`. The folder structure resembles the sidebar structure. Since all pages use a simple *permalink*, in the rendered html pages, all pages are flattened in one directory. This makes it easy to view the documentation also offline. +### Rule documentation + +The categories for a language `%lang%` are located in +`pmd-%lang%/src/main/resources/category/%lang% `. So for Java the categories +can be found under [pmd-java/src/main/resources/category/java](https://github.com/pmd/pmd/tree/master/pmd-java/src/main/resources/category/java). +The XML category files in this directory are transformed during build into markdown pages +describing the rules they contain. These pages are placed under `docs/` like the handwritten +documentation, and are then rendered with Jekyll like the rest of them. The rule documentation +generator is the separate submodule `pmd-doc`. + +Modifying the documentation of a rule should thus not be done on the markdown page, +but directly on the XML `rule` tag corresponding to the rule, in the relevant +category file. + +The XML documentation of rules can contain GitHub flavoured markdown. +Just wrap the markdown inside CDATA section in the xml. CDATA sections preserve +all formatting inside the delimiters, and allow to write code samples without + escaping special xml characters. For example: +``` + + + + + ... + +``` + ## Building There are two ways, to execute jekyll: diff --git a/docs/pages/pmd/rules/java.md b/docs/pages/pmd/rules/java.md index 7fe44c9f4e..573bb7f022 100644 --- a/docs/pages/pmd/rules/java.md +++ b/docs/pages/pmd/rules/java.md @@ -119,7 +119,7 @@ folder: pmd/rules * [AvoidDeeplyNestedIfStmts](pmd_rules_java_design.html#avoiddeeplynestedifstmts): Avoid creating deeply nested if-then statements since they are harder to read and error-prone to ... * [AvoidRethrowingException](pmd_rules_java_design.html#avoidrethrowingexception): Catch blocks that merely rethrow a caught exception only add to code size and runtime complexity. * [AvoidThrowingNewInstanceOfSameException](pmd_rules_java_design.html#avoidthrowingnewinstanceofsameexception): Catch blocks that merely rethrow a caught exception wrapped inside a new instance of the same typ... -* [AvoidThrowingNullPointerException](pmd_rules_java_design.html#avoidthrowingnullpointerexception): Avoid throwing NullPointerExceptions. These are confusing because most people will assume that th... +* [AvoidThrowingNullPointerException](pmd_rules_java_design.html#avoidthrowingnullpointerexception): Avoid throwing NullPointerExceptions manually. These are confusing because most people will assum... * [AvoidThrowingRawExceptionTypes](pmd_rules_java_design.html#avoidthrowingrawexceptiontypes): Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable,Excep... * [ClassWithOnlyPrivateConstructorsShouldBeFinal](pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal): A class with only private constructors should be final, unless the private constructoris invoked ... * [CollapsibleIfStatements](pmd_rules_java_design.html#collapsibleifstatements): Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with... diff --git a/docs/pages/pmd/rules/java/bestpractices.md b/docs/pages/pmd/rules/java/bestpractices.md index 3ad10ef4df..11cc56bae1 100644 --- a/docs/pages/pmd/rules/java/bestpractices.md +++ b/docs/pages/pmd/rules/java/bestpractices.md @@ -794,9 +794,6 @@ public class SecureSystem { Annotating overridden methods with @Override ensures at compile time that the method really overrides one, which helps refactoring and clarifies intent. -This rule is limited to resolving methods inherited from non-parameterized -or raw supertypes. - **This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.bestpractices.MissingOverrideRule](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java) **Example(s):** diff --git a/docs/pages/pmd/rules/java/design.md b/docs/pages/pmd/rules/java/design.md index 9ca102acba..3a8dc15d8c 100644 --- a/docs/pages/pmd/rules/java/design.md +++ b/docs/pages/pmd/rules/java/design.md @@ -193,9 +193,33 @@ public void bar() { **Priority:** High (1) -Avoid throwing NullPointerExceptions. These are confusing because most people will assume that the -virtual machine threw it. Consider using an IllegalArgumentException instead; this will be -clearly seen as a programmer-initiated exception. +Avoid throwing NullPointerExceptions manually. These are confusing because most people will assume that the +virtual machine threw it. To avoid a method being called with a null parameter, you may consider +using an IllegalArgumentException instead, making it clearly seen as a programmer-initiated exception. +However, there are better ways to handle this: + +>*Effective Java, 3rd Edition, Item 72: Favor the use of standard exceptions* +> +>Arguably, every erroneous method invocation boils down to an illegal argument or state, +but other exceptions are standardly used for certain kinds of illegal arguments and states. +If a caller passes null in some parameter for which null values are prohibited, convention dictates that +NullPointerException be thrown rather than IllegalArgumentException. + +To implement that, you are encouraged to use `java.util.Objects.requireNonNull()` +(introduced in Java 1.7). This method is designed primarily for doing parameter +validation in methods and constructors with multiple parameters. + +Your parameter validation could thus look like the following: +``` +public class Foo { + private String exampleValue; + + void setExampleValue(String exampleValue) { + // check, throw and assignment in a single standard call + this.exampleValue = Objects.requireNonNull(exampleValue, "exampleValue must not be null!"); + } + } +``` ``` //AllocationExpression/ClassOrInterfaceType[@Image='NullPointerException'] diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index fba50008f4..280b91ed9e 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -79,9 +79,13 @@ On both scenarios, disabling the cache takes precedence over setting a cache loc * java-codestyle * [#983](https://github.com/pmd/pmd/issues/983): \[java] Detect annotations with single value element * java-design + * [#832](https://github.com/pmd/pmd/issues/832): \[java] AvoidThrowingNullPointerException documentation suggestion * [#837](https://github.com/pmd/pmd/issues/837): \[java] CFGs of declared but not called lambdas are treated as parts of an enclosing method's CFG * [#839](https://github.com/pmd/pmd/issues/839): \[java] SignatureDeclareThrowsException's IgnoreJUnitCompletely property not honored for constructors * [#968](https://github.com/pmd/pmd/issues/968): \[java] UseUtilityClassRule reports false positive with lombok NoArgsConstructor +* documentation + * [#978](https://github.com/pmd/pmd/issues/978): \[core] Broken link in CONTRIBUTING.md + * [#992](https://github.com/pmd/pmd/issues/992): \[core] Include info about rule doc generation in "Writing Documentation" md page ### API Changes @@ -106,4 +110,7 @@ On both scenarios, disabling the cache takes precedence over setting a cache loc * [#969](https://github.com/pmd/pmd/pull/969): \[java] Issue 968 Add logic to handle lombok private constructors with utility classes - [Kirk Clemens](https://github.com/clem0110) * [#970](https://github.com/pmd/pmd/pull/970): \[java] Fixed inefficient use of keySet iterator instead of entrySet iterator - [Andrey Mochalov](https://github.com/epidemia) * [#984](https://github.com/pmd/pmd/pull/984): \[java] issue983 Add new UnnecessaryAnnotationValueElement rule - [Kirk Clemens](https://github.com/clem0110) +* [#989](https://github.com/pmd/pmd/pull/989): \[core] Update Contribute.md to close Issue #978 - [Bolarinwa Saheed Olayemi](https://github.com/refactormyself) +* [#990](https://github.com/pmd/pmd/pull/990): \[java] Updated Doc on AvoidThrowingNullPointerException to close Issue #832 - [Bolarinwa Saheed Olayemi](https://github.com/refactormyself) +* [#993](https://github.com/pmd/pmd/pull/993): \[core] Update writing_documentation.md to fix Issue #992 - [Bolarinwa Saheed Olayemi](https://github.com/refactormyself) diff --git a/pmd-apex-jorje/pom.xml b/pmd-apex-jorje/pom.xml index 17ad3707d7..580954e273 100644 --- a/pmd-apex-jorje/pom.xml +++ b/pmd-apex-jorje/pom.xml @@ -12,8 +12,10 @@ - ${basedir}/../pmd-core 8 + + 1.${java.version} + 1.${java.version} 2017-11-17 diff --git a/pmd-apex/pom.xml b/pmd-apex/pom.xml index b8518a49ad..23c604f69e 100644 --- a/pmd-apex/pom.xml +++ b/pmd-apex/pom.xml @@ -11,9 +11,10 @@ - ${basedir}/../pmd-core - 8 + + 1.${java.version} + 1.${java.version} diff --git a/pmd-core/pom.xml b/pmd-core/pom.xml index 75b7873d17..505242a03a 100644 --- a/pmd-core/pom.xml +++ b/pmd-core/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir} - - diff --git a/pmd-core/src/main/resources/rulesets/internal/dogfood-goal.xml b/pmd-core/src/main/resources/rulesets/internal/dogfood-goal.xml deleted file mode 100644 index ff49b78093..0000000000 --- a/pmd-core/src/main/resources/rulesets/internal/dogfood-goal.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - Dogfood goal, delete this when we reach it. - - - .*net/sourceforge/pmd/lang/ast/JavaCharStream.java - .*net/sourceforge/pmd/lang/ast/SimpleCharStream.java - .*net/sourceforge/pmd/lang/ast/TokenMgrError.java - .*lang/(java|jsp|cpp)/ast/.*Parser.java - .*lang/(java|jsp|cpp)/ast/.*ParserConstants.java - .*lang/(java|jsp|cpp)/ast/.*ParserTokenManager.java - .*lang/(java|jsp|cpp)/ast/.*ParserTreeConstants.java - .*lang/(java|jsp|cpp)/ast/.*ParserVisitor.java - .*lang/(java|jsp|cpp)/ast/JJT.*ParserState.java - .*lang/(java|jsp|cpp)/ast/ParseException.java - .*lang/(java|jsp|cpp)/ast/Token.java - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pmd-core/src/main/resources/rulesets/internal/dogfood.xml b/pmd-core/src/main/resources/rulesets/internal/dogfood.xml deleted file mode 100644 index 6c0db0f1bd..0000000000 --- a/pmd-core/src/main/resources/rulesets/internal/dogfood.xml +++ /dev/null @@ -1,212 +0,0 @@ - - - Rules to check PMD itself. This RuleSet is written to include all Rules, - and exclude those which we know are explicitly decided as not applicable to PMD itself. - This is the most encompassing form of RuleSet. - - - .*net/sourceforge/pmd/lang/ast/JavaCharStream.java - .*net/sourceforge/pmd/lang/ast/SimpleCharStream.java - .*net/sourceforge/pmd/lang/ast/TokenMgrError.java - .*lang/(java|jsp|cpp)/ast/.*Parser.java - .*lang/(java|jsp|cpp)/ast/.*ParserConstants.java - .*lang/(java|jsp|cpp)/ast/.*ParserTokenManager.java - .*lang/(java|jsp|cpp)/ast/.*ParserTreeConstants.java - .*lang/(java|jsp|cpp)/ast/.*ParserVisitor.java - .*lang/(java|jsp|cpp)/ast/JJT.*ParserState.java - .*lang/(java|jsp|cpp)/ast/ParseException.java - .*lang/(java|jsp|cpp)/ast/Token.java - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pmd-core/src/main/resources/rulesets/internal/pmdspecific.xml b/pmd-core/src/main/resources/rulesets/internal/pmdspecific.xml deleted file mode 100644 index fa8730ff4c..0000000000 --- a/pmd-core/src/main/resources/rulesets/internal/pmdspecific.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - These rules check for problems that are specific to the PMD codebase and may not be applicable to other projects. - - - replace o.getClass().equals(MyClass.class) with o instanceof MyClass. Make sure MyClass doesn't have descendants - 3 - - - - - - - - - - - replace MyClass.class.equals(o.getClass()) with o instanceof MyClass. Make sure MyClass doesn't have descendants - 3 - - - - - - - - - - diff --git a/pmd-core/src/main/resources/rulesets/internal/regress-dogfood-goal.xml b/pmd-core/src/main/resources/rulesets/internal/regress-dogfood-goal.xml deleted file mode 100644 index c7d472daff..0000000000 --- a/pmd-core/src/main/resources/rulesets/internal/regress-dogfood-goal.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - Rules to check PMD itself. - - .*/xml/.*.java - - - - - - diff --git a/pmd-core/src/main/resources/rulesets/internal/regress-dogfood.xml b/pmd-core/src/main/resources/rulesets/internal/regress-dogfood.xml deleted file mode 100644 index 1b1f8cee07..0000000000 --- a/pmd-core/src/main/resources/rulesets/internal/regress-dogfood.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - Rules to check PMD itself. - - .*/xml/.*.java - - - - - - - - - diff --git a/pmd-cpp/pom.xml b/pmd-cpp/pom.xml index c2fd4f8d77..8811a8e84a 100644 --- a/pmd-cpp/pom.xml +++ b/pmd-cpp/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-cs/pom.xml b/pmd-cs/pom.xml index ba0fd2e572..8c037c8e3d 100644 --- a/pmd-cs/pom.xml +++ b/pmd-cs/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index 9042916d2e..aa50922ef7 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -11,10 +11,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-doc/pom.xml b/pmd-doc/pom.xml index fad5dee9a8..159a455d75 100644 --- a/pmd-doc/pom.xml +++ b/pmd-doc/pom.xml @@ -13,7 +13,9 @@ 8 - ${basedir}/../pmd-core + + 1.${java.version} + 1.${java.version} diff --git a/pmd-fortran/pom.xml b/pmd-fortran/pom.xml index 5f6e651ed0..5419b88c7a 100644 --- a/pmd-fortran/pom.xml +++ b/pmd-fortran/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-go/pom.xml b/pmd-go/pom.xml index 1098fc9c60..6cf37ecdd2 100644 --- a/pmd-go/pom.xml +++ b/pmd-go/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-groovy/pom.xml b/pmd-groovy/pom.xml index 0a5725a2fb..95ce78c1fd 100644 --- a/pmd-groovy/pom.xml +++ b/pmd-groovy/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-java/pom.xml b/pmd-java/pom.xml index 129ef1b2e3..b68ef04974 100644 --- a/pmd-java/pom.xml +++ b/pmd-java/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeDeclaration.java index ace29e5217..124c8e18d2 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeDeclaration.java @@ -5,6 +5,7 @@ package net.sourceforge.pmd.lang.java.ast; import java.util.List; +import java.util.Locale; import net.sourceforge.pmd.lang.java.qname.JavaTypeQualifiedName; @@ -46,7 +47,12 @@ public interface ASTAnyTypeDeclaration extends TypeNode, JavaQualifiableNode, Ac * The kind of type this node declares. */ enum TypeKind { - CLASS, INTERFACE, ENUM, ANNOTATION + CLASS, INTERFACE, ENUM, ANNOTATION; + + + public String getPrintableName() { + return name().toLowerCase(Locale.ROOT); + } } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/MethodLikeNode.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/MethodLikeNode.java index b5a02c9e23..0d77e9c59a 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/MethodLikeNode.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/MethodLikeNode.java @@ -4,6 +4,8 @@ package net.sourceforge.pmd.lang.java.ast; +import java.util.Locale; + import net.sourceforge.pmd.lang.java.qname.JavaOperationQualifiedName; @@ -34,7 +36,11 @@ public interface MethodLikeNode extends AccessNode, JavaQualifiableNode, JavaNod enum MethodLikeKind { METHOD, CONSTRUCTOR, - LAMBDA + LAMBDA; + + public String getPrintableName() { + return name().toLowerCase(Locale.ROOT); + } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CyclomaticComplexityRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CyclomaticComplexityRule.java index b0ac7128a4..339ac0aec3 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CyclomaticComplexityRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CyclomaticComplexityRule.java @@ -6,14 +6,12 @@ package net.sourceforge.pmd.lang.java.rule.design; import java.util.Collections; import java.util.HashMap; -import java.util.Locale; import java.util.Map; import java.util.logging.Logger; import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; import net.sourceforge.pmd.lang.java.ast.MethodLikeNode; -import net.sourceforge.pmd.lang.java.ast.MethodLikeNode.MethodLikeKind; import net.sourceforge.pmd.lang.java.metrics.JavaMetrics; import net.sourceforge.pmd.lang.java.metrics.api.JavaClassMetricKey; import net.sourceforge.pmd.lang.java.metrics.api.JavaOperationMetricKey; @@ -126,7 +124,7 @@ public class CyclomaticComplexityRule extends AbstractJavaMetricsRule { if (classWmc >= classReportLevel) { int classHighest = (int) JavaMetrics.get(JavaOperationMetricKey.CYCLO, node, cycloOptions, ResultOption.HIGHEST); - String[] messageParams = {node.getTypeKind().name().toLowerCase(Locale.ROOT), + String[] messageParams = {node.getTypeKind().getPrintableName(), node.getImage(), " total", classWmc + " (highest " + classHighest + ")", }; @@ -143,13 +141,8 @@ public class CyclomaticComplexityRule extends AbstractJavaMetricsRule { int cyclo = (int) JavaMetrics.get(JavaOperationMetricKey.CYCLO, node, cycloOptions); if (cyclo >= methodReportLevel) { - String nodeType = node.getKind() == MethodLikeKind.METHOD - ? "method" - : node.getKind() == MethodLikeKind.CONSTRUCTOR - ? "constructor" - : "lambda"; - addViolation(data, node, new String[]{nodeType, + addViolation(data, node, new String[]{node.getKind().getPrintableName(), node.getQualifiedName().getOperation(), "", "" + cyclo, }); diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index ce46fbb14c..b91be4f671 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -745,9 +745,6 @@ public class SecureSystem { Annotating overridden methods with @Override ensures at compile time that the method really overrides one, which helps refactoring and clarifies intent. - - This rule is limited to resolving methods inherited from non-parameterized - or raw supertypes. 3 diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index aa834bb747..8b8415bede 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -198,9 +198,35 @@ public void bar() { class="net.sourceforge.pmd.lang.rule.XPathRule" externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_design.html#avoidthrowingnullpointerexception"> -Avoid throwing NullPointerExceptions. These are confusing because most people will assume that the -virtual machine threw it. Consider using an IllegalArgumentException instead; this will be -clearly seen as a programmer-initiated exception. +*Effective Java, 3rd Edition, Item 72: Favor the use of standard exceptions* +> +>Arguably, every erroneous method invocation boils down to an illegal argument or state, +but other exceptions are standardly used for certain kinds of illegal arguments and states. +If a caller passes null in some parameter for which null values are prohibited, convention dictates that +NullPointerException be thrown rather than IllegalArgumentException. + +To implement that, you are encouraged to use `java.util.Objects.requireNonNull()` +(introduced in Java 1.7). This method is designed primarily for doing parameter +validation in methods and constructors with multiple parameters. + +Your parameter validation could thus look like the following: +``` +public class Foo { + private String exampleValue; + + void setExampleValue(String exampleValue) { + // check, throw and assignment in a single standard call + this.exampleValue = Objects.requireNonNull(exampleValue, "exampleValue must not be null!"); + } + } +``` +]]> 1 diff --git a/pmd-java8/pom.xml b/pmd-java8/pom.xml index d5087c2e89..e1802ee341 100644 --- a/pmd-java8/pom.xml +++ b/pmd-java8/pom.xml @@ -11,8 +11,10 @@ - ${basedir}/../pmd-core 8 + + 1.${java.version} + 1.${java.version} diff --git a/pmd-javascript/pom.xml b/pmd-javascript/pom.xml index e62be79704..091c942888 100644 --- a/pmd-javascript/pom.xml +++ b/pmd-javascript/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-jsp/pom.xml b/pmd-jsp/pom.xml index c8481665f9..48ba40b96c 100644 --- a/pmd-jsp/pom.xml +++ b/pmd-jsp/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-matlab/pom.xml b/pmd-matlab/pom.xml index b8c0d43997..b3cd24d9ea 100644 --- a/pmd-matlab/pom.xml +++ b/pmd-matlab/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-objectivec/pom.xml b/pmd-objectivec/pom.xml index 75278f5c44..a43832e926 100644 --- a/pmd-objectivec/pom.xml +++ b/pmd-objectivec/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-perl/pom.xml b/pmd-perl/pom.xml index 9c0f3d28ae..bb234a49ac 100644 --- a/pmd-perl/pom.xml +++ b/pmd-perl/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-php/pom.xml b/pmd-php/pom.xml index 8df04da833..ee400a888d 100644 --- a/pmd-php/pom.xml +++ b/pmd-php/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-plsql/pom.xml b/pmd-plsql/pom.xml index 255b9a76a2..8157805586 100644 --- a/pmd-plsql/pom.xml +++ b/pmd-plsql/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-python/pom.xml b/pmd-python/pom.xml index fd18750971..0bc6fd6e7a 100644 --- a/pmd-python/pom.xml +++ b/pmd-python/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-ruby/pom.xml b/pmd-ruby/pom.xml index d3c2f22a4f..d51a55c369 100644 --- a/pmd-ruby/pom.xml +++ b/pmd-ruby/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - net.sourceforge.pmd diff --git a/pmd-scala/pom.xml b/pmd-scala/pom.xml index 972f1e3473..2c8e47a538 100644 --- a/pmd-scala/pom.xml +++ b/pmd-scala/pom.xml @@ -11,7 +11,6 @@ - ${basedir}/../pmd-core 2.12.4 diff --git a/pmd-swift/pom.xml b/pmd-swift/pom.xml index dfd2cc1d82..d28538dbce 100644 --- a/pmd-swift/pom.xml +++ b/pmd-swift/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-test/pom.xml b/pmd-test/pom.xml index 4d243ee46b..26d29d5be8 100644 --- a/pmd-test/pom.xml +++ b/pmd-test/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - junit diff --git a/pmd-ui/pom.xml b/pmd-ui/pom.xml index 94778d24e2..d0118358eb 100644 --- a/pmd-ui/pom.xml +++ b/pmd-ui/pom.xml @@ -11,8 +11,10 @@ - ${basedir}/../pmd-core 8 + + 1.${java.version} + 1.${java.version} diff --git a/pmd-visualforce/pom.xml b/pmd-visualforce/pom.xml index 9816882ebd..80ddf2da89 100644 --- a/pmd-visualforce/pom.xml +++ b/pmd-visualforce/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-vm/pom.xml b/pmd-vm/pom.xml index 13567a3b59..914a57f7a8 100644 --- a/pmd-vm/pom.xml +++ b/pmd-vm/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml index a702f9eff6..03d2192df0 100644 --- a/pmd-xml/pom.xml +++ b/pmd-xml/pom.xml @@ -10,10 +10,6 @@ 6.2.0-SNAPSHOT - - ${basedir}/../pmd-core - - diff --git a/pom.xml b/pom.xml index 9bcfa28c5c..31cab104a2 100644 --- a/pom.xml +++ b/pom.xml @@ -256,6 +256,9 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code 7 + + 1.${java.version} + 1.${java.version} 5.0 2.20.1 @@ -271,9 +274,7 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code -Xmx512m -Dfile.encoding=${project.build.sourceEncoding} - ${basedir}/pmd-core - ${config.basedir}/src/main/resources/rulesets/internal/dogfood.xml - 1.1.0-SNAPSHOT + 1.1.0 @@ -418,6 +419,49 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code org.apache.maven.plugins maven-pmd-plugin ${pmd.plugin.version} + + + verify + + check + cpd + + + + + true + 100 + 1.${java.version} + + /net/sourceforge/pmd/pmd-dogfood-config.xml + + + target/generated-sources/javacc + target/generated-sources/antlr4 + + false + true + true + + + + + net.sourceforge.pmd + pmd-core + 6.1.0 + + + net.sourceforge.pmd + pmd-java + 6.1.0 + + + + net.sourceforge.pmd + pmd-build-tools-config + ${pmd.build-tools.version} + + org.codehaus.mojo @@ -511,48 +555,7 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code org.apache.maven.plugins maven-pmd-plugin - - - verify - - check - cpd - - - - - 100 - 1.${java.version} - - /net/sourceforge/pmd/pmd-dogfood-config.xml - - - target/generated-sources/javacc - target/generated-sources/antlr4 - - false - true - true - - - - - net.sourceforge.pmd - pmd-core - 6.1.0 - - - net.sourceforge.pmd - pmd-java - 6.1.0 - - - - net.sourceforge.pmd - pmd-build-tools-config - 1.1.0-SNAPSHOT - - + org.apache.maven.plugins @@ -654,17 +657,7 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code org.apache.maven.plugins maven-pmd-plugin ${pmd.plugin.version} - - true - 100 - 1.${java.version} - - ${pmd.dogfood.ruleset} - - - target/generated-sources/javacc - - + @@ -933,20 +926,6 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code - - jdk8-modules - - [1.8, - - - pmd-apex-jorje - pmd-apex - pmd-java8 - pmd-ui - pmd-doc - - - doclint @@ -1014,5 +993,12 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code pmd-visualforce pmd-vm pmd-xml + + + pmd-apex-jorje + pmd-apex + pmd-java8 + pmd-ui + pmd-doc