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/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/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/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/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/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/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/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/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/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java index 8c300d079b..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 @@ -70,21 +70,21 @@ 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 for https://sourceforge.net/p/pmd/bugs/1355/ + */ + @Test + public void emptyFileJustComment() { + parseJava18("// just a comment"); } @Test 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/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/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/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/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/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 + 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..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 + + + #1335 GuardLogStatementJavaUtil should not apply to SLF4J Logger + 0 + + + + #1347 False positive for GuardLogStatementJavaUtil + 0 + 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/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..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 @@ -330,6 +330,31 @@ 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 + + + + #1349 VariableNamingConventions : underscore in final but at first position ? + 0 + 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 + + diff --git a/src/site/markdown/overview/changelog-old.md b/src/site/markdown/overview/changelog-old.md index cf0016bef6..92fa9e6903 100644 --- a/src/site/markdown/overview/changelog-old.md +++ b/src/site/markdown/overview/changelog-old.md @@ -4,6 +4,39 @@ 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:** + +* 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:** diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 0173e5ed1f..3e8e266acc 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -34,14 +34,9 @@ **Pull Requests:** * [#21](https://github.com/adangel/pmd/pull/21): Added PMD Rules for Singleton pattern violations. -* [#53](https://github.com/pmd/pmd/pull/53): Fix some NullPointerExceptions * [#54](https://github.com/pmd/pmd/pull/54): Add a new rulesets for Maven's POM rules **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 **API Changes:** 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