From 770fc5763e182ee24ee48026bb80b6e28766dcf9 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 4 Apr 2015 10:50:36 +0200 Subject: [PATCH 01/21] Update project info reports, display modules after the main pages --- pom.xml | 8 +++++++- src/site/site.xml | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 41eed8c28e..faacd670e7 100644 --- a/pom.xml +++ b/pom.xml @@ -570,12 +570,18 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.7 + 2.8 summary dependencies + dependency-convergence + dependency-info + dependency-management + modules + plugin-management + plugins project-team mailing-list cim diff --git a/src/site/site.xml b/src/site/site.xml index 29a7975152..255da66895 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -65,8 +65,6 @@ - - @@ -111,6 +109,7 @@ + From 857ae074e19d9344a18f874226ff545d015b711f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 30 Apr 2015 20:07:54 +0200 Subject: [PATCH 02/21] #1342 UseConcurrentHashMap false positive (with documentation example) --- .../resources/rulesets/java/controversial.xml | 3 ++- .../controversial/xml/UseConcurrentHashMap.xml | 16 ++++++++++++++++ src/site/markdown/overview/changelog.md | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/rulesets/java/controversial.xml b/pmd-java/src/main/resources/rulesets/java/controversial.xml index e356e917d9..18832bf38f 100644 --- a/pmd-java/src/main/resources/rulesets/java/controversial.xml +++ b/pmd-java/src/main/resources/rulesets/java/controversial.xml @@ -851,7 +851,8 @@ perform efficient map reads without blocking other threads. diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/UseConcurrentHashMap.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/UseConcurrentHashMap.xml index 3577620767..996e43b4da 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/UseConcurrentHashMap.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/UseConcurrentHashMap.xml @@ -27,6 +27,22 @@ public class Foo { public void m() { final Map myMap = myObject.methodThatReturnMap(); } +} + ]]> + + + #1342 UseConcurrentHashMap false positive (with documentation example) + 1 + 3 + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 34bb526f71..385af1f69e 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -12,4 +12,6 @@ **Bugfixes:** +* [#1342](https://sourceforge.net/p/pmd/bugs/1342/): UseConcurrentHashMap false positive (with documentation example) + **API Changes:** From a0d116ca6d205a1ef65bbf02c50ceec84277a2f7 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 May 2015 18:27:18 +0200 Subject: [PATCH 03/21] #1335 GuardLogStatementJavaUtil should not apply to SLF4J Logger --- .../logging/GuardLogStatementJavaUtilRule.java | 16 ++++++++++++++++ .../xml/GuardLogStatementJavaUtil.xml | 16 ++++++++++++++++ src/site/markdown/overview/changelog.md | 1 + 3 files changed, 33 insertions(+) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/logging/GuardLogStatementJavaUtilRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/logging/GuardLogStatementJavaUtilRule.java index 465d7eebf3..64acd91471 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/logging/GuardLogStatementJavaUtilRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/logging/GuardLogStatementJavaUtilRule.java @@ -3,9 +3,11 @@ */ package net.sourceforge.pmd.lang.java.rule.logging; +import java.util.List; import java.util.logging.Level; import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; +import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration; public class GuardLogStatementJavaUtilRule extends GuardLogStatementRule { @@ -24,6 +26,10 @@ public class GuardLogStatementJavaUtilRule extends GuardLogStatementRule { @Override public Object visit(ASTCompilationUnit unit, Object data) { + if (isSlf4jImported(unit)) { + return data; + } + String[] logLevels = getProperty(LOG_LEVELS); String[] guardMethods = getProperty(GUARD_METHODS); @@ -37,6 +43,16 @@ public class GuardLogStatementJavaUtilRule extends GuardLogStatementRule { return super.visit(unit,data); } + private boolean isSlf4jImported(ASTCompilationUnit unit) { + List imports = unit.findChildrenOfType(ASTImportDeclaration.class); + for (ASTImportDeclaration i : imports) { + if (i.getImportedName().startsWith("org.slf4j")) { + return true; + } + } + return false; + } + private void configureGuards(String[] logLevels, String[] guardMethods) { String[] methods = guardMethods; if (methods.length != logLevels.length) { diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjava/xml/GuardLogStatementJavaUtil.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjava/xml/GuardLogStatementJavaUtil.xml index b8fef9ab0a..0d961fe329 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjava/xml/GuardLogStatementJavaUtil.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjava/xml/GuardLogStatementJavaUtil.xml @@ -64,6 +64,22 @@ public class Foo { LOGGER.log(Level.FINE, "This is a severe message" + " and concat"); // no violation } } +} + ]]> + + + #1335 GuardLogStatementJavaUtil should not apply to SLF4J Logger + 0 + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 385af1f69e..63f13373e4 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -12,6 +12,7 @@ **Bugfixes:** +* [#1335](https://sourceforge.net/p/pmd/bugs/1335/): GuardLogStatementJavaUtil should not apply to SLF4J Logger * [#1342](https://sourceforge.net/p/pmd/bugs/1342/): UseConcurrentHashMap false positive (with documentation example) **API Changes:** From e2a7356ccb29f4eb63a9bc408aee5894d8661827 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 May 2015 18:33:16 +0200 Subject: [PATCH 04/21] verify #1341 pmd:GuardDebugLogging violates LOGGER.debug with format "{}" It's a duplicate of #1224 --- .../loggingjakartacommons/xml/GuardDebugLogging.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjakartacommons/xml/GuardDebugLogging.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjakartacommons/xml/GuardDebugLogging.xml index 16901b1f28..c487071648 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjakartacommons/xml/GuardDebugLogging.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjakartacommons/xml/GuardDebugLogging.xml @@ -119,6 +119,18 @@ public class Test { __log.debug("bla" + "",e ); } } +} + ]]> + + + #1341 pmd:GuardDebugLogging violates LOGGER.debug with format "{}" + 0 + From 3d73198ba99febc6ec5df665172cb88a6bce90df Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 1 May 2015 18:41:21 +0200 Subject: [PATCH 05/21] verify #1340 UseStringBufferForStringAppends False Positive with ternary operator --- .../xml/UseStringBufferForStringAppends.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/optimizations/xml/UseStringBufferForStringAppends.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/optimizations/xml/UseStringBufferForStringAppends.xml index 456b05cd6e..eb055a35a0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/optimizations/xml/UseStringBufferForStringAppends.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/optimizations/xml/UseStringBufferForStringAppends.xml @@ -134,4 +134,17 @@ public class Foo { } ]]> + + #1340 UseStringBufferForStringAppends False Positive with ternary operator + 0 + + From 12bbb65ebd29b99b7f323c29e0538fa4146271ba Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 9 May 2015 18:12:38 +0200 Subject: [PATCH 06/21] Update fluido skin version to 1.4 --- src/site/site.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/site.xml b/src/site/site.xml index 255da66895..54fdc53c9b 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -8,7 +8,7 @@ org.apache.maven.skins maven-fluido-skin - 1.3.1 + 1.4 From 171fdb877fa5cfc3225a2b8bbc830bf0ce34041f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 9 May 2015 18:25:12 +0200 Subject: [PATCH 07/21] #1345 UseCollectionIsEmpty throws NullPointerException --- .../rule/AbstractInefficientZeroCheck.java | 29 ++++++++++++++++--- .../rule/design/xml/UseCollectionIsEmpty.xml | 23 +++++++++++++++ src/site/markdown/overview/changelog.md | 1 + 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractInefficientZeroCheck.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractInefficientZeroCheck.java index 819139ac85..157a12dc90 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractInefficientZeroCheck.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractInefficientZeroCheck.java @@ -104,14 +104,32 @@ public abstract class AbstractInefficientZeroCheck extends AbstractJavaRule { private boolean isCompare(Node equality) { if (isLiteralLeftHand(equality)) { return checkComparison(inverse.get(equality.getImage()), equality, 0); - } else { + } else if (isLiteralRightHand(equality)) { return checkComparison(equality.getImage(), equality, 1); } + return false; } private boolean isLiteralLeftHand(Node equality) { - return equality.jjtGetChild(0).jjtGetChild(0).jjtGetNumChildren() > 0 - && equality.jjtGetChild(0).jjtGetChild(0).jjtGetChild(0) instanceof ASTLiteral; + return isLiteral(equality, 0); + } + + private boolean isLiteralRightHand(Node equality) { + return isLiteral(equality, 1); + } + + private boolean isLiteral(Node equality, int child) { + Node target = equality.jjtGetChild(child); + target = getFirstChildOrThis(target); + target = getFirstChildOrThis(target); + return target instanceof ASTLiteral; + } + + private Node getFirstChildOrThis(Node node) { + if (node.jjtGetNumChildren() > 0) { + return node.jjtGetChild(0); + } + return node; } /** @@ -126,7 +144,10 @@ public abstract class AbstractInefficientZeroCheck extends AbstractJavaRule { * @see #getComparisonTargets() */ private boolean checkComparison(String operator, Node equality, int i) { - Node target = equality.jjtGetChild(i).jjtGetChild(0).jjtGetChild(0); + Node target = equality + .jjtGetChild(i) + .jjtGetChild(0) + .jjtGetChild(0); return target instanceof ASTLiteral && getComparisonTargets().get(operator).contains(target.getImage()); } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/UseCollectionIsEmpty.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/UseCollectionIsEmpty.xml index 774870f61d..44af72204d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/UseCollectionIsEmpty.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/UseCollectionIsEmpty.xml @@ -291,6 +291,29 @@ public class PMDIsEmptyFalsePositive { // do something } } +} + ]]> + + + #1345 UseCollectionIsEmpty throws NullPointerException + 0 + list) { + if (list.size() < this.getSize()) { + throw new IllegalArgumentException(); + } + } } ]]> diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 63f13373e4..94599d2433 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -14,5 +14,6 @@ * [#1335](https://sourceforge.net/p/pmd/bugs/1335/): GuardLogStatementJavaUtil should not apply to SLF4J Logger * [#1342](https://sourceforge.net/p/pmd/bugs/1342/): UseConcurrentHashMap false positive (with documentation example) +* [#1345](https://sourceforge.net/p/pmd/bugs/1345/): UseCollectionIsEmpty throws NullPointerException **API Changes:** From bc41b00206a709c2462c1d3844509afb45e12e7b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 9 May 2015 18:31:48 +0200 Subject: [PATCH 08/21] verify #1346 VariableNamingConventions do not work for method parameters --- .../rule/naming/xml/VariableNamingConventions.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/VariableNamingConventions.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/VariableNamingConventions.xml index 75e2a0c9c2..8c07494b41 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/VariableNamingConventions.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/VariableNamingConventions.xml @@ -330,6 +330,21 @@ public class X { public class X { private native void stream_dip_set_data(long stream, long dip_x, long dip_z); +} + ]]> + + + #1346 VariableNamingConventions do not work for method parameters + 1 + 3 + true + false + From 7d630f6cb33e81d3e5193c5af5b8081553074c93 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 9 May 2015 18:37:02 +0200 Subject: [PATCH 09/21] verify #1347 False positive for GuardLogStatementJavaUtil --- .../xml/GuardLogStatementJavaUtil.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjava/xml/GuardLogStatementJavaUtil.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjava/xml/GuardLogStatementJavaUtil.xml index 0d961fe329..676e9b33f9 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjava/xml/GuardLogStatementJavaUtil.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/loggingjava/xml/GuardLogStatementJavaUtil.xml @@ -51,6 +51,7 @@ public class Foo { #1227 GuardLogStatementJavaUtil doesn't catch log(Level.FINE, "msg" + " msg") calls 1 + 8 + + + #1347 False positive for GuardLogStatementJavaUtil + 0 + From b5e7cbbaf3eb473be6f79dadb470a806137fa955 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 9 May 2015 18:41:42 +0200 Subject: [PATCH 10/21] verify #1349 VariableNamingConventions : underscore in final but at first position ? --- .../java/rule/naming/xml/VariableNamingConventions.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/VariableNamingConventions.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/VariableNamingConventions.xml index 8c07494b41..96733c3741 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/VariableNamingConventions.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/VariableNamingConventions.xml @@ -345,6 +345,16 @@ public class X { public void setHorsTout(long hors_tout) { this.horsTout = hors_tout; } +} + ]]> + + + #1349 VariableNamingConventions : underscore in final but at first position ? + 0 + From cae16d39d7bb8c1d3d2a0af0c735a9c093469c22 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 13 May 2015 21:33:30 +0200 Subject: [PATCH 11/21] #1353 False positive "Only One Return" with lambda --- .../rule/controversial/OnlyOneReturnRule.java | 22 +++++++++++++++- .../rule/controversial/xml/OnlyOneReturn.xml | 25 +++++++++++++++++++ src/site/markdown/overview/changelog.md | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/controversial/OnlyOneReturnRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/controversial/OnlyOneReturnRule.java index d735e07f50..a8657e8302 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/controversial/OnlyOneReturnRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/controversial/OnlyOneReturnRule.java @@ -9,6 +9,7 @@ import java.util.List; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; +import net.sourceforge.pmd.lang.java.ast.ASTLambdaExpression; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTReturnStatement; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; @@ -31,9 +32,11 @@ public class OnlyOneReturnRule extends AbstractJavaRule { List returnNodes = new ArrayList(); node.findDescendantsOfType(ASTReturnStatement.class, returnNodes, false); + returnNodes = filterLambdaExpressions(returnNodes); + if (returnNodes.size() > 1) { for (Iterator i = returnNodes.iterator(); i.hasNext();) { - Node problem = i.next(); + Node problem = i.next(); // skip the last one, it's OK if (!i.hasNext()) { continue; @@ -44,4 +47,21 @@ public class OnlyOneReturnRule extends AbstractJavaRule { return data; } + /** + * Checks whether the return statement is inside a lambda expression, and if + * so, this return statement is removed. + * + * @param returnNodes + * all the return statements inside the method + * @return all return statements, that are NOT within a lambda expression. + */ + private List filterLambdaExpressions(List returnNodes) { + List filtered = new ArrayList(); + for (ASTReturnStatement ret : returnNodes) { + if (ret.getFirstParentOfType(ASTLambdaExpression.class) == null) { + filtered.add(ret); + } + } + return filtered; + } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/OnlyOneReturn.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/OnlyOneReturn.xml index 578e1a5f5b..acffe6a849 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/OnlyOneReturn.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/controversial/xml/OnlyOneReturn.xml @@ -94,4 +94,29 @@ public class Foo { } ]]> + + #1353 False positive "Only One Return" with lambda + 0 + search(final String indexName, final SearchRequest searchRequest) { + final SearchHit[] empty = new SearchHit[0]; + final Optional searchDefinition = settingsService.getSearchDefinition(indexName); + return searchDefinition.>map( + i -> { + final List> res = i.getSearchMapping().stream() + .peek(m -> LOGGER.debug("Treating backend \"{}\"", m.getProviderRef())) + .map(m -> invokeAdapter(getProviderSearchService(m.getProviderRef()), m, searchRequest)) + .collect(Collectors.toList()); + return TryCollections.pull(res).map(l -> sortReturning(l.stream().collect(ArrayCollectors.arrayMerging( + SearchServiceImpl::toSearchHit, + SearchHit::getInternalId, + Function.identity(), + SearchServiceImpl::merge)).orElse(Collections.emptyList()), SearchServiceImpl.searchHitComparator())) + .map(list -> list.toArray(empty)); + }).orElse(Try.success(empty)); + } +} + ]]> + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 94599d2433..f891c77160 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -15,5 +15,6 @@ * [#1335](https://sourceforge.net/p/pmd/bugs/1335/): GuardLogStatementJavaUtil should not apply to SLF4J Logger * [#1342](https://sourceforge.net/p/pmd/bugs/1342/): UseConcurrentHashMap false positive (with documentation example) * [#1345](https://sourceforge.net/p/pmd/bugs/1345/): UseCollectionIsEmpty throws NullPointerException +* [#1353](https://sourceforge.net/p/pmd/bugs/1353/): False positive "Only One Return" with lambda **API Changes:** From 3c316c20187ab76fa7536105969ee62b463d75e1 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 15 May 2015 15:33:40 +0200 Subject: [PATCH 12/21] #1343 MethodNamingConventions for overrided methods --- .../naming/MethodNamingConventionsRule.java | 20 +++++++++++++++++++ .../naming/xml/MethodNamingConventions.xml | 11 ++++++++++ src/site/markdown/overview/changelog.md | 1 + 3 files changed, 32 insertions(+) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/naming/MethodNamingConventionsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/naming/MethodNamingConventionsRule.java index 5f7068f20e..bc773f624d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/naming/MethodNamingConventionsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/naming/MethodNamingConventionsRule.java @@ -3,9 +3,14 @@ */ package net.sourceforge.pmd.lang.java.rule.naming; +import java.util.List; + +import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBodyDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; +import net.sourceforge.pmd.lang.java.ast.ASTMarkerAnnotation; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclarator; +import net.sourceforge.pmd.lang.java.ast.ASTName; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; import net.sourceforge.pmd.lang.rule.properties.BooleanProperty; @@ -30,6 +35,10 @@ public class MethodNamingConventionsRule extends AbstractJavaRule { return data; } + if (isOverriddenMethod(node)) { + return data; + } + String methodName = node.getImage(); if (Character.isUpperCase(methodName.charAt(0))) { @@ -41,4 +50,15 @@ public class MethodNamingConventionsRule extends AbstractJavaRule { return data; } + private boolean isOverriddenMethod(ASTMethodDeclarator node) { + ASTClassOrInterfaceBodyDeclaration declaration = node.getFirstParentOfType(ASTClassOrInterfaceBodyDeclaration.class); + List annotations = declaration.findDescendantsOfType(ASTMarkerAnnotation.class); + for (ASTMarkerAnnotation ann : annotations) { + ASTName name = ann.getFirstChildOfType(ASTName.class); + if (name != null && name.hasImageEqualTo("Override")) { + return true; + } + } + return false; + } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/MethodNamingConventions.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/MethodNamingConventions.xml index e962b685dc..d2283ba88a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/MethodNamingConventions.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/MethodNamingConventions.xml @@ -51,6 +51,17 @@ public class Foo { + + + #1343 MethodNamingConventions for overrided methods + 0 + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index f891c77160..c23aaf7115 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -14,6 +14,7 @@ * [#1335](https://sourceforge.net/p/pmd/bugs/1335/): GuardLogStatementJavaUtil should not apply to SLF4J Logger * [#1342](https://sourceforge.net/p/pmd/bugs/1342/): UseConcurrentHashMap false positive (with documentation example) +* [#1343](https://sourceforge.net/p/pmd/bugs/1343/): MethodNamingConventions for overrided methods * [#1345](https://sourceforge.net/p/pmd/bugs/1345/): UseCollectionIsEmpty throws NullPointerException * [#1353](https://sourceforge.net/p/pmd/bugs/1353/): False positive "Only One Return" with lambda From cc43e6f8be9ec1dd7f1d757ac9f901b7372048d5 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 15 May 2015 16:06:29 +0200 Subject: [PATCH 13/21] #1354 Complex FieldDeclarationsShouldBeAtStartOfClass false positive with Spring annotations --- ...dDeclarationsShouldBeAtStartOfClassRule.java | 7 ++++++- .../FieldDeclarationsShouldBeAtStartOfClass.xml | 17 +++++++++++++++++ src/site/markdown/overview/changelog.md | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/FieldDeclarationsShouldBeAtStartOfClassRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/FieldDeclarationsShouldBeAtStartOfClassRule.java index f81d1e7f64..3f5fdfcf8a 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/FieldDeclarationsShouldBeAtStartOfClassRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/FieldDeclarationsShouldBeAtStartOfClassRule.java @@ -4,6 +4,7 @@ package net.sourceforge.pmd.lang.java.rule.design; import net.sourceforge.pmd.lang.ast.Node; +import net.sourceforge.pmd.lang.java.ast.ASTAnnotation; import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBodyDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; @@ -50,7 +51,11 @@ public class FieldDeclarationsShouldBeAtStartOfClassRule extends AbstractJavaRul for (int i = 0; i < parent.jjtGetNumChildren(); i++) { Node child = parent.jjtGetChild(i); if (child.jjtGetNumChildren() > 0) { - child = child.jjtGetChild(0); + if (!(child.jjtGetChild(0) instanceof ASTAnnotation) || child.jjtGetNumChildren() == 1) { + child = child.jjtGetChild(0); + } else { + child = child.jjtGetChild(1); + } } if (child.equals(node)) { break; diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FieldDeclarationsShouldBeAtStartOfClass.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FieldDeclarationsShouldBeAtStartOfClass.xml index 495193385d..afc92632fa 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FieldDeclarationsShouldBeAtStartOfClass.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FieldDeclarationsShouldBeAtStartOfClass.xml @@ -153,6 +153,23 @@ public class MyClass { // something } }; +} + ]]> + + + #1354 Complex FieldDeclarationsShouldBeAtStartOfClass false positive with Spring annotations + 0 + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index c23aaf7115..b604c38368 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -17,5 +17,6 @@ * [#1343](https://sourceforge.net/p/pmd/bugs/1343/): MethodNamingConventions for overrided methods * [#1345](https://sourceforge.net/p/pmd/bugs/1345/): UseCollectionIsEmpty throws NullPointerException * [#1353](https://sourceforge.net/p/pmd/bugs/1353/): False positive "Only One Return" with lambda +* [#1354](https://sourceforge.net/p/pmd/bugs/1354/): Complex FieldDeclarationsShouldBeAtStartOfClass false positive with Spring annotations **API Changes:** From 357f206102fee7335d1ab05710b85953def9b4eb Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 15 May 2015 20:24:06 +0200 Subject: [PATCH 14/21] #1330 AvoidReassigningParameters does not work with varargs --- .../rule/design/AvoidReassigningParametersRule.java | 1 + .../java/symboltable/VariableNameDeclaration.java | 6 ++++++ .../rule/design/xml/AvoidReassigningParameters.xml | 11 +++++++++++ src/site/markdown/overview/changelog.md | 1 + 4 files changed, 19 insertions(+) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/AvoidReassigningParametersRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/AvoidReassigningParametersRule.java index fe497d763a..b1ff2670e8 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/AvoidReassigningParametersRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/AvoidReassigningParametersRule.java @@ -32,6 +32,7 @@ public class AvoidReassigningParametersRule extends AbstractJavaRule { if ((jocc.isOnLeftHandSide() || jocc.isSelfAssignment()) && jocc.getNameForWhichThisIsAQualifier() == null && !jocc.useThisOrSuper() + && !decl.isVarargs() && (!decl.isArray() || jocc.getLocation().jjtGetParent().jjtGetParent().jjtGetNumChildren() == 1)) { // not an array or no primary suffix to access the array // values diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/VariableNameDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/VariableNameDeclaration.java index b3317bf831..35813b0f88 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/VariableNameDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/VariableNameDeclaration.java @@ -36,6 +36,12 @@ public class VariableNameDeclaration extends AbstractNameDeclaration implements } } + public boolean isVarargs() { + ASTVariableDeclaratorId astVariableDeclaratorId = (ASTVariableDeclaratorId) node; + ASTFormalParameter parameter = astVariableDeclaratorId.getFirstParentOfType(ASTFormalParameter.class); + return parameter != null && parameter.isVarargs(); + } + public boolean isExceptionBlockParameter() { return ((ASTVariableDeclaratorId) node).isExceptionBlockParameter(); } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/AvoidReassigningParameters.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/AvoidReassigningParameters.xml index 97968c48c0..8584a954fb 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/AvoidReassigningParameters.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/AvoidReassigningParameters.xml @@ -234,6 +234,17 @@ public class PmdBug { public static void main(String[] args) { new PmdBug().foo("Hello world"); } +} + ]]> + + + #1330 AvoidReassigningParameters does not work with varargs + 0 + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index b604c38368..69576469cd 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -12,6 +12,7 @@ **Bugfixes:** +* [#1330](https://sourceforge.net/p/pmd/bugs/1330/): AvoidReassigningParameters does not work with varargs * [#1335](https://sourceforge.net/p/pmd/bugs/1335/): GuardLogStatementJavaUtil should not apply to SLF4J Logger * [#1342](https://sourceforge.net/p/pmd/bugs/1342/): UseConcurrentHashMap false positive (with documentation example) * [#1343](https://sourceforge.net/p/pmd/bugs/1343/): MethodNamingConventions for overrided methods From a416513fc9b6827326d93b79e503e7610deae194 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 18 May 2015 21:14:12 +0200 Subject: [PATCH 15/21] reformat, whitespaces --- .../pmd/lang/java/ast/ParserCornersTest.java | 158 +++++++----------- 1 file changed, 63 insertions(+), 95 deletions(-) diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java index 666e7f980f..85438ba86a 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java @@ -15,31 +15,22 @@ import net.sourceforge.pmd.lang.java.ParserTst; import org.apache.commons.io.IOUtils; import org.junit.Test; - public class ParserCornersTest extends ParserTst { /** - * #1107 PMD 5.0.4 couldn't parse call of parent outer java class method from inner class - * @throws Exception any error + * #1107 PMD 5.0.4 couldn't parse call of parent outer java class method + * from inner class + * + * @throws Exception + * any error */ @Test public void testInnerOuterClass() throws Exception { - parseJava17("/**\n" + - " * @author azagorulko\n" + - " *\n" + - " */\n" + - "public class TestInnerClassCallsOuterParent {\n" + - "\n" + - " public void test() {\n" + - " new Runnable() {\n" + - " @Override\n" + - " public void run() {\n" + - " TestInnerClassCallsOuterParent.super.toString();\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n" - ); + parseJava17("/**\n" + " * @author azagorulko\n" + " *\n" + " */\n" + + "public class TestInnerClassCallsOuterParent {\n" + "\n" + " public void test() {\n" + + " new Runnable() {\n" + " @Override\n" + " public void run() {\n" + + " TestInnerClassCallsOuterParent.super.toString();\n" + " }\n" + + " };\n" + " }\n" + "}\n"); } @Test @@ -51,27 +42,27 @@ public class ParserCornersTest extends ParserTst { public final void testCastLookaheadProblem() throws Throwable { parseJava14(CAST_LOOKAHEAD_PROBLEM); } - + /** - * Tests a specific generic notation for calling methods. - * See: https://jira.codehaus.org/browse/MPMD-139 + * Tests a specific generic notation for calling methods. See: + * https://jira.codehaus.org/browse/MPMD-139 */ @Test public void testGenericsProblem() { - parseJava15(GENERICS_PROBLEM); - parseJava17(GENERICS_PROBLEM); + parseJava15(GENERICS_PROBLEM); + parseJava17(GENERICS_PROBLEM); } - + @Test public void testParsersCases() { - String test15 = readAsString("/net/sourceforge/pmd/ast/ParserCornerCases.java"); - parseJava15(test15); - - String test17 = readAsString("/net/sourceforge/pmd/ast/ParserCornerCases17.java"); - parseJava17(test17); - - String test18 = readAsString("/net/sourceforge/pmd/ast/ParserCornerCases18.java"); - parseJava18(test18); + String test15 = readAsString("/net/sourceforge/pmd/ast/ParserCornerCases.java"); + parseJava15(test15); + + String test17 = readAsString("/net/sourceforge/pmd/ast/ParserCornerCases17.java"); + parseJava17(test17); + + String test18 = readAsString("/net/sourceforge/pmd/ast/ParserCornerCases18.java"); + parseJava18(test18); } /** @@ -79,78 +70,55 @@ public class ParserCornersTest extends ParserTst { */ @Test public void testLambdaBug1333() { - parseJava18("final class Bug1333 {\n" + - " private static final Logger LOG = LoggerFactory.getLogger(Foo.class);\n" + - "\n" + - " public void deleteDirectoriesByNamePattern() {\n" + - " delete(path -> deleteDirectory(path));\n" + - " }\n" + - "\n" + - " private void delete(Consumer consumer) {\n" + - " LOG.debug(consumer.toString());\n" + - " }\n" + - "\n" + - " private void deleteDirectory(String path) {\n" + - " LOG.debug(path);\n" + - " }\n" + - "}"); + parseJava18("final class Bug1333 {\n" + + " private static final Logger LOG = LoggerFactory.getLogger(Foo.class);\n" + "\n" + + " public void deleteDirectoriesByNamePattern() {\n" + + " delete(path -> deleteDirectory(path));\n" + " }\n" + "\n" + + " private void delete(Consumer consumer) {\n" + + " LOG.debug(consumer.toString());\n" + " }\n" + "\n" + + " private void deleteDirectory(String path) {\n" + " LOG.debug(path);\n" + " }\n" + "}"); } @Test public void testMultipleExceptionCatching() { - String code = "public class Foo { public void bar() { " - + "try { System.out.println(); } catch (RuntimeException | IOException e) {} } }"; - try { - parseJava15(code); - fail("Expected exception"); - } catch (ParseException e) { - assertEquals("Line 1, Column 94: Cannot catch multiple exceptions when running in JDK inferior to 1.7 mode!", e.getMessage()); - } + String code = "public class Foo { public void bar() { " + + "try { System.out.println(); } catch (RuntimeException | IOException e) {} } }"; + try { + parseJava15(code); + fail("Expected exception"); + } catch (ParseException e) { + assertEquals( + "Line 1, Column 94: Cannot catch multiple exceptions when running in JDK inferior to 1.7 mode!", + e.getMessage()); + } - try { - parseJava17(code); - // no exception expected - } catch (ParseException e) { - fail(); - } + try { + parseJava17(code); + // no exception expected + } catch (ParseException e) { + fail(); + } } private String readAsString(String resource) { - InputStream in = ParserCornersTest.class.getResourceAsStream(resource); - try { - return IOUtils.toString(in); - } catch (IOException e) { - throw new RuntimeException(e); - } finally { - IOUtils.closeQuietly(in); - } + InputStream in = ParserCornersTest.class.getResourceAsStream(resource); + try { + return IOUtils.toString(in); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + IOUtils.closeQuietly(in); + } } - - private static final String GENERICS_PROBLEM = - "public class Test {" + PMD.EOL + - " public void test() {" + PMD.EOL + - " String o = super. doStuff(\"\");" + PMD.EOL + - " }" + PMD.EOL + - "}"; - private static final String ABSTRACT_METHOD_LEVEL_CLASS_DECL = - "public class Test {" + PMD.EOL + - " void bar() {" + PMD.EOL + - " abstract class X { public abstract void f(); }" + PMD.EOL + - " class Y extends X { public void f() {" + PMD.EOL + - " new Y().f();" + PMD.EOL + - " }}" + PMD.EOL + - " }" + PMD.EOL + - "}"; + private static final String GENERICS_PROBLEM = "public class Test {" + PMD.EOL + " public void test() {" + PMD.EOL + + " String o = super. doStuff(\"\");" + PMD.EOL + " }" + PMD.EOL + "}"; - private static final String CAST_LOOKAHEAD_PROBLEM = - "public class BadClass {" + PMD.EOL + - " public Class foo() {" + PMD.EOL + - " return (byte[].class);" + PMD.EOL + - " }" + PMD.EOL + - "}"; + private static final String ABSTRACT_METHOD_LEVEL_CLASS_DECL = "public class Test {" + PMD.EOL + " void bar() {" + + PMD.EOL + " abstract class X { public abstract void f(); }" + PMD.EOL + + " class Y extends X { public void f() {" + PMD.EOL + " new Y().f();" + PMD.EOL + " }}" + PMD.EOL + + " }" + PMD.EOL + "}"; - public static junit.framework.Test suite() { - return new junit.framework.JUnit4TestAdapter(ParserCornersTest.class); - } + private static final String CAST_LOOKAHEAD_PROBLEM = "public class BadClass {" + PMD.EOL + " public Class foo() {" + + PMD.EOL + " return (byte[].class);" + PMD.EOL + " }" + PMD.EOL + "}"; } From b50e49777fb708808aedd5f6e905683f792a9bf3 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Mon, 18 May 2015 21:17:16 +0200 Subject: [PATCH 16/21] #1355 NullPointerException in a java file having a single comment line --- .../sourceforge/pmd/lang/java/ast/ASTCompilationUnit.java | 7 +++++-- .../sourceforge/pmd/lang/java/ast/ParserCornersTest.java | 8 ++++++++ src/site/markdown/overview/changelog.md | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTCompilationUnit.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTCompilationUnit.java index 09bcdd67e0..430b52a292 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTCompilationUnit.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTCompilationUnit.java @@ -47,8 +47,11 @@ public class ASTCompilationUnit extends AbstractJavaTypeNode implements RootNode } public ASTPackageDeclaration getPackageDeclaration() { - Node n = jjtGetChild(0); - return n instanceof ASTPackageDeclaration ? (ASTPackageDeclaration) n : null; + if (jjtGetNumChildren() > 0) { + Node n = jjtGetChild(0); + return n instanceof ASTPackageDeclaration ? (ASTPackageDeclaration) n : null; + } + return null; } public ClassTypeResolver getClassTypeResolver() { diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java index 85438ba86a..5ca3e424c3 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java @@ -79,6 +79,14 @@ public class ParserCornersTest extends ParserTst { + " private void deleteDirectory(String path) {\n" + " LOG.debug(path);\n" + " }\n" + "}"); } + /** + * Test for https://sourceforge.net/p/pmd/bugs/1355/ + */ + @Test + public void emptyFileJustComment() { + parseJava18("// just a comment"); + } + @Test public void testMultipleExceptionCatching() { String code = "public class Foo { public void bar() { " diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 69576469cd..165990a601 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -19,5 +19,6 @@ * [#1345](https://sourceforge.net/p/pmd/bugs/1345/): UseCollectionIsEmpty throws NullPointerException * [#1353](https://sourceforge.net/p/pmd/bugs/1353/): False positive "Only One Return" with lambda * [#1354](https://sourceforge.net/p/pmd/bugs/1354/): Complex FieldDeclarationsShouldBeAtStartOfClass false positive with Spring annotations +* [#1355](https://sourceforge.net/p/pmd/bugs/1355/): NullPointerException in a java file having a single comment line **API Changes:** From c34b55285b87b0e9d40449e92ca484c6bf96bc7f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 21 May 2015 21:33:29 +0200 Subject: [PATCH 17/21] Adding back missing changelog entry for 5.3.1 --- src/site/markdown/overview/changelog-old.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/site/markdown/overview/changelog-old.md b/src/site/markdown/overview/changelog-old.md index cf0016bef6..a90f1e5651 100644 --- a/src/site/markdown/overview/changelog-old.md +++ b/src/site/markdown/overview/changelog-old.md @@ -4,6 +4,25 @@ Previous versions of PMD can be downloaded here: http://sourceforge.net/projects/pmd/files/pmd/ +## 20-April-2015 - 5.3.1 + +**New/Modified/Deprecated Rules:** + +* Language Java, ruleset design.xml: The rule "UseSingleton" *has been renamed* to "UseUtilityClass". + See also bugs [#1059](https://sourceforge.net/p/pmd/bugs/1059) and [#1339](https://sourceforge.net/p/pmd/bugs/1339/). + +**Pull Requests:** + +* [#53](https://github.com/pmd/pmd/pull/53): Fix some NullPointerExceptions + +**Bugfixes:** + +* [#1332](https://sourceforge.net/p/pmd/bugs/1332/): False Positive: UnusedPrivateMethod +* [#1333](https://sourceforge.net/p/pmd/bugs/1333/): Error while processing Java file with Lambda expressions +* [#1337](https://sourceforge.net/p/pmd/bugs/1337/): False positive "Avoid throwing raw exception types" when exception is not thrown +* [#1338](https://sourceforge.net/p/pmd/bugs/1338/): The pmd-java8 POM bears the wrong parent module version + + ## April 1, 2015 - 5.3.0 **New Supported Languages:** From 2aa194201564999813bacd5f0f75947d61183fbb Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 22 May 2015 18:18:12 +0200 Subject: [PATCH 18/21] Prepare pmd release 5.3.2 --- src/site/markdown/overview/changelog.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 165990a601..f12aa03d1e 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -1,14 +1,6 @@ # Changelog -## ????? - 5.3.2-SNAPSHOT - -**New Supported Languages:** - -**Feature Request and Improvements:** - -**New/Modified/Deprecated Rules:** - -**Pull Requests:** +## 22-May-2015 - 5.3.2 **Bugfixes:** @@ -20,5 +12,3 @@ * [#1353](https://sourceforge.net/p/pmd/bugs/1353/): False positive "Only One Return" with lambda * [#1354](https://sourceforge.net/p/pmd/bugs/1354/): Complex FieldDeclarationsShouldBeAtStartOfClass false positive with Spring annotations * [#1355](https://sourceforge.net/p/pmd/bugs/1355/): NullPointerException in a java file having a single comment line - -**API Changes:** From 2c99fbd5e5e6f45f028d0837d6159543f56aa1b7 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 22 May 2015 18:23:41 +0200 Subject: [PATCH 19/21] [maven-release-plugin] prepare release pmd_releases/5.3.2 --- pmd-core/pom.xml | 2 +- pmd-cpp/pom.xml | 2 +- pmd-cs/pom.xml | 2 +- pmd-dist/pom.xml | 2 +- pmd-fortran/pom.xml | 2 +- pmd-go/pom.xml | 2 +- pmd-java/pom.xml | 2 +- pmd-javascript/pom.xml | 2 +- pmd-jsp/pom.xml | 2 +- pmd-matlab/pom.xml | 2 +- pmd-objectivec/pom.xml | 2 +- pmd-php/pom.xml | 2 +- pmd-plsql/pom.xml | 2 +- pmd-python/pom.xml | 2 +- pmd-ruby/pom.xml | 2 +- pmd-scala/pom.xml | 2 +- pmd-test/pom.xml | 2 +- pmd-vm/pom.xml | 2 +- pmd-xml/pom.xml | 2 +- pom.xml | 4 ++-- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pmd-core/pom.xml b/pmd-core/pom.xml index be57d8915c..f91bba1845 100644 --- a/pmd-core/pom.xml +++ b/pmd-core/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-cpp/pom.xml b/pmd-cpp/pom.xml index 62bbb721b1..24dd0dbf32 100644 --- a/pmd-cpp/pom.xml +++ b/pmd-cpp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-cs/pom.xml b/pmd-cs/pom.xml index 2f7153228b..a585f82693 100644 --- a/pmd-cs/pom.xml +++ b/pmd-cs/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index 6b14b175bb..cb49a3133c 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-fortran/pom.xml b/pmd-fortran/pom.xml index a058c204a9..5c1756ad57 100644 --- a/pmd-fortran/pom.xml +++ b/pmd-fortran/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-go/pom.xml b/pmd-go/pom.xml index cfaa424c18..5f7d31360d 100644 --- a/pmd-go/pom.xml +++ b/pmd-go/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-java/pom.xml b/pmd-java/pom.xml index 05fb3cd85f..af1d7b2317 100644 --- a/pmd-java/pom.xml +++ b/pmd-java/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-javascript/pom.xml b/pmd-javascript/pom.xml index 22524c5b75..490a364f64 100644 --- a/pmd-javascript/pom.xml +++ b/pmd-javascript/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-jsp/pom.xml b/pmd-jsp/pom.xml index 5ae1efd270..85c1b81c4c 100644 --- a/pmd-jsp/pom.xml +++ b/pmd-jsp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-matlab/pom.xml b/pmd-matlab/pom.xml index 304b15534c..12afa5d35f 100644 --- a/pmd-matlab/pom.xml +++ b/pmd-matlab/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-objectivec/pom.xml b/pmd-objectivec/pom.xml index bfbf3137fd..976fd6f8e0 100644 --- a/pmd-objectivec/pom.xml +++ b/pmd-objectivec/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-php/pom.xml b/pmd-php/pom.xml index 3b4027a937..54d6556dd6 100644 --- a/pmd-php/pom.xml +++ b/pmd-php/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-plsql/pom.xml b/pmd-plsql/pom.xml index 74a92962b5..8ec58fa5c3 100644 --- a/pmd-plsql/pom.xml +++ b/pmd-plsql/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-python/pom.xml b/pmd-python/pom.xml index 625a100ec2..287770287f 100644 --- a/pmd-python/pom.xml +++ b/pmd-python/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-ruby/pom.xml b/pmd-ruby/pom.xml index 543a69fda8..2d5ad4d0f8 100644 --- a/pmd-ruby/pom.xml +++ b/pmd-ruby/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-scala/pom.xml b/pmd-scala/pom.xml index 1e8645c351..874846e5a6 100644 --- a/pmd-scala/pom.xml +++ b/pmd-scala/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-test/pom.xml b/pmd-test/pom.xml index dcea2454a0..3e01b180d9 100644 --- a/pmd-test/pom.xml +++ b/pmd-test/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-vm/pom.xml b/pmd-vm/pom.xml index a3bcd1ac3a..fa9ffa6636 100644 --- a/pmd-vm/pom.xml +++ b/pmd-vm/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml index cb3c92096a..266901732b 100644 --- a/pmd-xml/pom.xml +++ b/pmd-xml/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 diff --git a/pom.xml b/pom.xml index faacd670e7..5791ca878f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.sourceforge.pmd pmd - 5.3.2-SNAPSHOT + 5.3.2 pom PMD @@ -244,7 +244,7 @@ scm:git:git://github.com/pmd/pmd.git scm:git:ssh://git@github.com/pmd/pmd.git https://github.com/pmd/pmd - pmd/5.3.x + pmd_releases/5.3.2 From 793af091c0b152e360423ce22d023971d1679f82 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 22 May 2015 18:23:42 +0200 Subject: [PATCH 20/21] [maven-release-plugin] prepare for next development iteration --- pmd-core/pom.xml | 2 +- pmd-cpp/pom.xml | 2 +- pmd-cs/pom.xml | 2 +- pmd-dist/pom.xml | 2 +- pmd-fortran/pom.xml | 2 +- pmd-go/pom.xml | 2 +- pmd-java/pom.xml | 2 +- pmd-javascript/pom.xml | 2 +- pmd-jsp/pom.xml | 2 +- pmd-matlab/pom.xml | 2 +- pmd-objectivec/pom.xml | 2 +- pmd-php/pom.xml | 2 +- pmd-plsql/pom.xml | 2 +- pmd-python/pom.xml | 2 +- pmd-ruby/pom.xml | 2 +- pmd-scala/pom.xml | 2 +- pmd-test/pom.xml | 2 +- pmd-vm/pom.xml | 2 +- pmd-xml/pom.xml | 2 +- pom.xml | 4 ++-- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pmd-core/pom.xml b/pmd-core/pom.xml index f91bba1845..f37be2048b 100644 --- a/pmd-core/pom.xml +++ b/pmd-core/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-cpp/pom.xml b/pmd-cpp/pom.xml index 24dd0dbf32..39d6608df9 100644 --- a/pmd-cpp/pom.xml +++ b/pmd-cpp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-cs/pom.xml b/pmd-cs/pom.xml index a585f82693..ec04a4bff2 100644 --- a/pmd-cs/pom.xml +++ b/pmd-cs/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index cb49a3133c..ea40ce79de 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-fortran/pom.xml b/pmd-fortran/pom.xml index 5c1756ad57..2ed21d7dd2 100644 --- a/pmd-fortran/pom.xml +++ b/pmd-fortran/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-go/pom.xml b/pmd-go/pom.xml index 5f7d31360d..e11f0463ba 100644 --- a/pmd-go/pom.xml +++ b/pmd-go/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-java/pom.xml b/pmd-java/pom.xml index af1d7b2317..d6ecec8924 100644 --- a/pmd-java/pom.xml +++ b/pmd-java/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-javascript/pom.xml b/pmd-javascript/pom.xml index 490a364f64..981ef37b0a 100644 --- a/pmd-javascript/pom.xml +++ b/pmd-javascript/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-jsp/pom.xml b/pmd-jsp/pom.xml index 85c1b81c4c..5b4de2bc86 100644 --- a/pmd-jsp/pom.xml +++ b/pmd-jsp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-matlab/pom.xml b/pmd-matlab/pom.xml index 12afa5d35f..c99f089e96 100644 --- a/pmd-matlab/pom.xml +++ b/pmd-matlab/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-objectivec/pom.xml b/pmd-objectivec/pom.xml index 976fd6f8e0..500c45eb3a 100644 --- a/pmd-objectivec/pom.xml +++ b/pmd-objectivec/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-php/pom.xml b/pmd-php/pom.xml index 54d6556dd6..426e774c7f 100644 --- a/pmd-php/pom.xml +++ b/pmd-php/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-plsql/pom.xml b/pmd-plsql/pom.xml index 8ec58fa5c3..5d8ec2691e 100644 --- a/pmd-plsql/pom.xml +++ b/pmd-plsql/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-python/pom.xml b/pmd-python/pom.xml index 287770287f..9d8f7c3941 100644 --- a/pmd-python/pom.xml +++ b/pmd-python/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-ruby/pom.xml b/pmd-ruby/pom.xml index 2d5ad4d0f8..f7feb24c69 100644 --- a/pmd-ruby/pom.xml +++ b/pmd-ruby/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-scala/pom.xml b/pmd-scala/pom.xml index 874846e5a6..546bb2fa4b 100644 --- a/pmd-scala/pom.xml +++ b/pmd-scala/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-test/pom.xml b/pmd-test/pom.xml index 3e01b180d9..fed53bace4 100644 --- a/pmd-test/pom.xml +++ b/pmd-test/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-vm/pom.xml b/pmd-vm/pom.xml index fa9ffa6636..43dc63fa07 100644 --- a/pmd-vm/pom.xml +++ b/pmd-vm/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml index 266901732b..5a8d3d697f 100644 --- a/pmd-xml/pom.xml +++ b/pmd-xml/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT diff --git a/pom.xml b/pom.xml index 5791ca878f..b3245a945d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.sourceforge.pmd pmd - 5.3.2 + 5.3.3-SNAPSHOT pom PMD @@ -244,7 +244,7 @@ scm:git:git://github.com/pmd/pmd.git scm:git:ssh://git@github.com/pmd/pmd.git https://github.com/pmd/pmd - pmd_releases/5.3.2 + pmd/5.3.x From 00ff9f25ae567f5736d0f4fa10f093c99e7a4876 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 22 May 2015 19:28:37 +0200 Subject: [PATCH 21/21] Prepare next development version --- src/site/markdown/overview/changelog-old.md | 14 ++++++++++++++ src/site/markdown/overview/changelog.md | 19 ++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/site/markdown/overview/changelog-old.md b/src/site/markdown/overview/changelog-old.md index a90f1e5651..92fa9e6903 100644 --- a/src/site/markdown/overview/changelog-old.md +++ b/src/site/markdown/overview/changelog-old.md @@ -4,6 +4,20 @@ Previous versions of PMD can be downloaded here: http://sourceforge.net/projects/pmd/files/pmd/ +## 22-May-2015 - 5.3.2 + +**Bugfixes:** + +* [#1330](https://sourceforge.net/p/pmd/bugs/1330/): AvoidReassigningParameters does not work with varargs +* [#1335](https://sourceforge.net/p/pmd/bugs/1335/): GuardLogStatementJavaUtil should not apply to SLF4J Logger +* [#1342](https://sourceforge.net/p/pmd/bugs/1342/): UseConcurrentHashMap false positive (with documentation example) +* [#1343](https://sourceforge.net/p/pmd/bugs/1343/): MethodNamingConventions for overrided methods +* [#1345](https://sourceforge.net/p/pmd/bugs/1345/): UseCollectionIsEmpty throws NullPointerException +* [#1353](https://sourceforge.net/p/pmd/bugs/1353/): False positive "Only One Return" with lambda +* [#1354](https://sourceforge.net/p/pmd/bugs/1354/): Complex FieldDeclarationsShouldBeAtStartOfClass false positive with Spring annotations +* [#1355](https://sourceforge.net/p/pmd/bugs/1355/): NullPointerException in a java file having a single comment line + + ## 20-April-2015 - 5.3.1 **New/Modified/Deprecated Rules:** diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index f12aa03d1e..77e4e9587d 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -1,14 +1,15 @@ # Changelog -## 22-May-2015 - 5.3.2 +## ????? - 5.3.3-SNAPSHOT + +**New Supported Languages:** + +**Feature Request and Improvements:** + +**New/Modified/Deprecated Rules:** + +**Pull Requests:** **Bugfixes:** -* [#1330](https://sourceforge.net/p/pmd/bugs/1330/): AvoidReassigningParameters does not work with varargs -* [#1335](https://sourceforge.net/p/pmd/bugs/1335/): GuardLogStatementJavaUtil should not apply to SLF4J Logger -* [#1342](https://sourceforge.net/p/pmd/bugs/1342/): UseConcurrentHashMap false positive (with documentation example) -* [#1343](https://sourceforge.net/p/pmd/bugs/1343/): MethodNamingConventions for overrided methods -* [#1345](https://sourceforge.net/p/pmd/bugs/1345/): UseCollectionIsEmpty throws NullPointerException -* [#1353](https://sourceforge.net/p/pmd/bugs/1353/): False positive "Only One Return" with lambda -* [#1354](https://sourceforge.net/p/pmd/bugs/1354/): Complex FieldDeclarationsShouldBeAtStartOfClass false positive with Spring annotations -* [#1355](https://sourceforge.net/p/pmd/bugs/1355/): NullPointerException in a java file having a single comment line +**API Changes:**