Merge branch 'pmd/5.3.x' into master

This commit is contained in:
Andreas Dangel
2015-06-06 19:32:41 +02:00
7 changed files with 89 additions and 15 deletions

View File

@@ -51,11 +51,7 @@ public class FieldDeclarationsShouldBeAtStartOfClassRule extends AbstractJavaRul
for (int i = 0; i < parent.jjtGetNumChildren(); i++) {
Node child = parent.jjtGetChild(i);
if (child.jjtGetNumChildren() > 0) {
if (!(child.jjtGetChild(0) instanceof ASTAnnotation) || child.jjtGetNumChildren() == 1) {
child = child.jjtGetChild(0);
} else {
child = child.jjtGetChild(1);
}
child = skipAnnotations(child);
}
if (child.equals(node)) {
break;
@@ -80,4 +76,21 @@ public class FieldDeclarationsShouldBeAtStartOfClassRule extends AbstractJavaRul
}
return data;
}
/**
* Ignore all annotations, until anything, that is not an annotation and
* return this node
* @param child the node from where to start the search
* @return the first child or the first child after annotations
*/
private Node skipAnnotations(Node child) {
Node nextChild = child.jjtGetChild(0);
for (int j = 0; j < child.jjtGetNumChildren(); j++) {
if (!(child.jjtGetChild(j) instanceof ASTAnnotation)) {
nextChild = child.jjtGetChild(j);
break;
}
}
return nextChild;
}
}

View File

@@ -253,7 +253,8 @@ public class Test {
count(./InclusiveOrExpression)=0 and
count(./ExclusiveOrExpression)=0 and
count(./ConditionalAndExpression)=0 and
count(./ConditionalOrExpression)=0]
count(./ConditionalOrExpression)=0 and
count(./EqualityExpression)=0]
]]>
</value>
</property>

View File

@@ -170,6 +170,30 @@ public class MyClass {
public void myPublicBean() {}
private static void myPrivateStatic() {}
}
]]></code>
</test-code>
<test-code>
<description>#1364 FieldDeclarationsShouldBeAtStartOfClass false positive using multiple annotations</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class MyEntity {
private static final String MY_STRING = "STRING";
@Id
@Column
private Long id;
@NotNull
@ManyToOne
@JoinColumn
@Valid
private RelationEntity relation;
public MyEntity() {
}
}
]]></code>
</test-code>

View File

@@ -240,6 +240,17 @@ public class NewClass {
public void falsePositive(Boolean b) throws IOException {
System.out.write(( "" + b ).getBytes());
}
}
]]></code>
</test-code>
<test-code>
<description>#1366 UselessParentheses false positive on multiple equality operators</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class Useless {
public boolean test(Object a, Object b) {
return (a == null) == (b == null);
}
}
]]></code>
</test-code>

View File

@@ -560,6 +560,8 @@
<reports>
<report>javadoc</report>
<report>test-javadoc</report>
<report>aggregate</report>
<report>test-aggregate</report>
</reports>
</reportSet>
</reportSets>

View File

@@ -38,5 +38,4 @@
**Bugfixes:**
**API Changes:**

View File

@@ -11,102 +11,126 @@ Summary
<table>
<tr>
<th>IDE</th>
<th>Homepage</th>
<th>Source Code</th>
<th>Maintainers</th>
</tr>
<tr>
<td><a href="#BlueJ">BlueJ</a></td>
<td><a href="https://github.com/pmd/pmd/tree/master/pmd-bluej/">pmd-bluej</a></td>
<td></td>
<td><a href="https://github.com/pmd/pmd-misc/tree/master/pmd-bluej/">pmd-bluej</a></td>
<td><a href="http://tomcopeland.blogs.com/">Tom Copeland</a></td>
</tr>
<tr>
<td><a href="#Code_Guide">CodeGuide</a></td>
<td></td>
<td>N/A</td>
<td>Austin Moore</td>
</tr>
<tr>
<td><a href="#Eclipse">Eclipse</a></td>
<td><a href="https://github.com/pmd/pmd/tree/master/pmd-eclipse-plugin/">pmd-eclipse</a></td>
<td></td>
<td><a href="https://github.com/pmd/pmd-eclipse-plugin">github: pmd/pmd-eclipse</a></td>
<td>Philippe Herlin</td>
</tr>
<tr>
<td>eclipse-pmd</td>
<td><a href="http://acanda.github.io/eclipse-pmd/">http://acanda.github.io/eclipse-pmd/</a></td>
<td><a href="https://github.com/acanda/eclipse-pmd/">github: acanda/eclipse-pmd</a></td>
<td>Philip Graf</td>
</tr>
<tr>
<td><a href="#Emacs">Emacs</a></td>
<td><a href="https://github.com/pmd/pmd/tree/master/pmd-emacs/">pmd-emacs</a></td>
<td></td>
<td><a href="https://github.com/pmd/pmd-emacs/">github: pmd/pmd-emacs</a></td>
<td>Nascif Abousalh Neto</td>
</tr>
<tr>
<td><a href="#Gel">Gel</a></td>
<td><a href="https://github.com/pmd/pmd/tree/master/pmd-gel/">pmd-gel</a></td>
<td></td>
<td><a href="https://github.com/pmd/pmd-misc/tree/master/pmd-gel/">github: pmd/pmd-misc/pmd-gel</a></td>
<td>Andrei Lumianski</td>
</tr>
<tr>
<td><a href="#IDEA">IntelliJ IDEA</a></td>
<td></td>
<td>N/A</td>
<td>Amit Dev, <a href="http://tomcopeland.blogs.com/">Tom Copeland</a></td>
</tr>
<tr>
<td><a href="#IDEA_-_QAPlug">IntelliJ IDEA - QAPlug</a></td>
<td></td>
<td>N/A</td>
<td>Jakub Sławiński</td>
</tr>
<tr>
<td><a href="#JBuilder">JBuilder</a></td>
<td><a href="https://github.com/pmd/pmd/tree/master/pmd-jbuilder/">pmd-jbuilder</a></td>
<td></td>
<td><a href="https://github.com/pmd/pmd-misc/tree/master/pmd-jbuilder/">github: pmd/pmd-misc/pmd-jbuilder</a></td>
<td><a href="http://tomcopeland.blogs.com/">Tom Copeland</a></td>
</tr>
<tr>
<td><a href="#JCreator">JCreator</a></td>
<td></td>
<td>N/A</td>
<td>Brant Gurganus</td>
</tr>
<tr>
<td><a href="#JDeveloper">JDeveloper</a></td>
<td><a href="https://github.com/pmd/pmd/tree/master/pmd-jdeveloper.12.1.2/">pmd-jdeveloper</a></td>
<td></td>
<td><a href="https://github.com/pmd/pmd-jdeveloper">github: pmd/pmd-jdeveloper</a></td>
<td><a href="http://develishdevelopment.wordpress.com/">Torsten Kleiber</a></td>
</tr>
<tr>
<td><a href="#JEdit">JEdit</a></td>
<td><a href="https://github.com/pmd/pmd/tree/master/pmd-jedit/">pmd-jedit</a></td>
<td>Jiger Patel</td>
<td><a href="http://plugins.jedit.org/plugins/?PMDPlugin">jEdit - PMD Plugin</a></td>
<td><a href="https://sourceforge.net/p/jedit/PMDPlugin/ci/master/tree/">sourceforge: jedit/PMDPlugin</a></td>
<td>Jiger Patel, Dale Anson</td>
</tr>
<tr>
<td><a href="#Maven">Maven</a></td>
<td></td>
<td>N/A</td>
<td>N/A</td>
</tr>
<tr>
<td><a href="#Maven_2">Maven 2</a></td>
<td></td>
<td>N/A</td>
<td><a href="http://maven.apache.org/plugins/maven-pmd-plugin/">apache.org / maven</a></td>
</tr>
<tr>
<td><a href="#NetBeans">NetBeans</a></td>
<td></td>
<td><a href="http://kenai.com/projects/sqe/">SQE</a></td>
<td>N/A</td>
</tr>
<tr>
<td><a href="#TextPad">TextPad</a></td>
<td></td>
<td>N/A</td>
<td>Jeff Epstein</td>
</tr>
<tr>
<td><a href="#WebLogic_Workshop_8.1.x">WebLogic Workshop 8.1.x</a></td>
<td></td>
<td>N/A</td>
<td>Kevin Conaway</td>
</tr>