Merge branch 'master' into 1845-fix-methodreturnsinternalarray-regression

This commit is contained in:
artem.krosheninnikov
2019-06-14 12:33:41 +03:00
162 changed files with 1800 additions and 462 deletions

View File

@ -1468,7 +1468,7 @@ public class Something {
|Name|Default Value|Description|Multivalued|
|----|-------------|-----------|-----------|
|ignoredAnnotations|lombok.Setter \| lombok.Getter \| lombok.Builder \| lombok.Data \| lombok.RequiredArgsConstructor \| lombok.AllArgsConstructor \| lombok.Value \| lombok.NoArgsConstructor \| java.lang.Deprecated \| javafx.fxml.FXML|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
|ignoredAnnotations|lombok.Setter \| lombok.Getter \| lombok.Builder \| lombok.Data \| lombok.RequiredArgsConstructor \| lombok.AllArgsConstructor \| lombok.Value \| lombok.NoArgsConstructor \| java.lang.Deprecated \| javafx.fxml.FXML \| lombok.experimental.Delegate|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
**Use this rule with the default properties by just referencing it:**
``` xml
@ -1479,7 +1479,7 @@ public class Something {
``` xml
<rule ref="category/java/bestpractices.xml/UnusedPrivateField">
<properties>
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor|java.lang.Deprecated|javafx.fxml.FXML" />
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor|java.lang.Deprecated|javafx.fxml.FXML|lombok.experimental.Delegate" />
</properties>
</rule>
```

View File

@ -1779,7 +1779,7 @@ public class Foo {
|Name|Default Value|Description|Multivalued|
|----|-------------|-----------|-----------|
|ignoredAnnotations|lombok.Setter \| lombok.Getter \| lombok.Builder \| lombok.Data \| lombok.RequiredArgsConstructor \| lombok.AllArgsConstructor \| lombok.Value \| lombok.NoArgsConstructor|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
|ignoredAnnotations|lombok.Setter \| lombok.Getter \| lombok.Builder \| lombok.Data \| lombok.RequiredArgsConstructor \| lombok.AllArgsConstructor \| lombok.Value \| lombok.NoArgsConstructor \| lombok.experimental.Delegate|Fully qualified names of the annotation types that should be ignored by this rule|yes. Delimiter is '\|'.|
|checkInnerClasses|false|Check inner classes|no|
|disallowNotAssignment|false|Disallow violations where the first usage is not an assignment|no|
@ -1792,7 +1792,7 @@ public class Foo {
``` xml
<rule ref="category/java/design.xml/SingularField">
<properties>
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor" />
<property name="ignoredAnnotations" value="lombok.Setter|lombok.Getter|lombok.Builder|lombok.Data|lombok.RequiredArgsConstructor|lombok.AllArgsConstructor|lombok.Value|lombok.NoArgsConstructor|lombok.experimental.Delegate" />
<property name="checkInnerClasses" value="false" />
<property name="disallowNotAssignment" value="false" />
</properties>

View File

@ -293,7 +293,7 @@ public static Foo getFoo() {
SimpleDateFormat instances are not synchronized. Sun recommends using separate format instances
for each thread. If multiple threads must access a static formatter, the formatter must be
synchronized either on method or block level.
synchronized on block level.
This rule has been deprecated in favor of the rule {% rule UnsynchronizedStaticFormatter %}.
@ -307,17 +307,34 @@ public class Foo {
void bar() {
sdf.format(); // poor, no thread-safety
}
synchronized void foo() {
sdf.format(); // preferred
void foo() {
synchronized (sdf) { // preferred
sdf.format();
}
}
}
```
**Use this rule by referencing it:**
**This rule has the following properties:**
|Name|Default Value|Description|Multivalued|
|----|-------------|-----------|-----------|
|allowMethodLevelSynchronization|false|If true, method level synchronization is allowed as well as synchronized block. Otherwise only synchronized blocks are allowed.|no|
**Use this rule with the default properties by just referencing it:**
``` xml
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticDateFormatter" />
```
**Use this rule and customize it:**
``` xml
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticDateFormatter">
<properties>
<property name="allowMethodLevelSynchronization" value="false" />
</properties>
</rule>
```
## UnsynchronizedStaticFormatter
**Since:** PMD 6.11.0
@ -327,7 +344,7 @@ public class Foo {
Instances of `java.text.Format` are generally not synchronized.
Sun recommends using separate format instances for each thread.
If multiple threads must access a static formatter, the formatter must be
synchronized either on method or block level.
synchronized on block level.
**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.multithreading.UnsynchronizedStaticFormatterRule](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/multithreading/UnsynchronizedStaticFormatterRule.java)
@ -339,17 +356,34 @@ public class Foo {
void bar() {
sdf.format(); // poor, no thread-safety
}
synchronized void foo() {
sdf.format(); // preferred
void foo() {
synchronized (sdf) { // preferred
sdf.format();
}
}
}
```
**Use this rule by referencing it:**
**This rule has the following properties:**
|Name|Default Value|Description|Multivalued|
|----|-------------|-----------|-----------|
|allowMethodLevelSynchronization|false|If true, method level synchronization is allowed as well as synchronized block. Otherwise only synchronized blocks are allowed.|no|
**Use this rule with the default properties by just referencing it:**
``` xml
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticFormatter" />
```
**Use this rule and customize it:**
``` xml
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticFormatter">
<properties>
<property name="allowMethodLevelSynchronization" value="false" />
</properties>
</rule>
```
## UseConcurrentHashMap
**Since:** PMD 4.2.6

View File

@ -14,11 +14,66 @@ This is a {{ site.pmd.release_type }} release.
### New and noteworthy
#### Modified Rules
* The Java rule {% rule "java/bestpractices/UnusedPrivateField" %} (`java-bestpractices`) now ignores by
default fields, that are annotated with the Lombok experimental annotation `@Delegate`. This can be
customized with the property `ignoredAnnotations`.
* The Java rule {% rule "java/design/SingularField" %} (`java-design`) now ignores by
default fields, that are annotated with the Lombok experimental annotation `@Delegate`. This can be
customized with the property `ignoredAnnotations`.
* The Java rules {% rule "java/multithreading/UnsynchronizedStaticFormatter" %} and
{% rule "java/multithreading/UnsynchronizedStaticDateFormatter" %} (`java-multithreading`)
now prefer synchronized blocks by default. They will raise a violation, if the synchronization is implemented
on the method level. To allow the old behavior, the new property `allowMethodLevelSynchronization` can
be enabled.
### Fixed Issues
* java
* [#1848](https://github.com/pmd/pmd/issues/1848): \[java] Local classes should preserve their modifiers
* java-bestpractices
* [#1703](https://github.com/pmd/pmd/issues/1703): \[java] UnusedPrivateField on member annotated with lombok @Delegate
* java-multithreading
* [#1814](https://github.com/pmd/pmd/issues/1814): \[java] UnsynchronizedStaticFormatter documentation and implementation wrong
* [#1815](https://github.com/pmd/pmd/issues/1815): \[java] False negative in UnsynchronizedStaticFormatter
* plsql
* [#1828](https://github.com/pmd/pmd/issues/1828): \[plsql] Parentheses stopped working
* [#1850](https://github.com/pmd/pmd/issues/1850): \[plsql] Parsing errors with INSERT using returning or records and TRIM expression
### API Changes
#### Deprecated APIs
> Reminder: Please don't use members marked with the annotation {% jdoc core::annotation.InternalApi %}, as they will likely be removed, hidden, or otherwise intentionally broken with 7.0.0.
##### In ASTs
As part of the changes we'd like to do to AST classes for 7.0.0, we would like to
hide some methods and constructors that rule writers should not have access to.
The following usages are now deprecated **in the Java AST** (with other languages to come):
* Manual instantiation of nodes. **Constructors of node classes are deprecated** and marked {% jdoc core::annotation.InternalApi %}. Nodes should only be obtained from the parser, which for rules, means that never need to instantiate node themselves. Those constructors will be made package private with 7.0.0.
* **Subclassing of abstract node classes, or usage of their type**. Version 7.0.0 will bring a new set of abstractions that will be public API, but the base classes are and will stay internal. You should not couple your code to them.
* In the meantime you should use interfaces like {% jdoc java::lang.java.ast.JavaNode %} or {% jdoc core::lang.ast.Node %}, or the other published interfaces in this package, to refer to nodes generically.
* Concrete node classes will **be made final** with 7.0.0.
* Setters found in any node class or interface. **Rules should consider the AST immutable**. We will make those setters package private with 7.0.0.
Please look at {% jdoc_package java::lang.java.ast %} to find out the full list
of deprecations.
### External Contributions
* [#1792](https://github.com/pmd/pmd/pull/1792): \[java] Added lombok.experimental to AbstractLombokAwareRule - [jakivey32](https://github.com/jakivey32)
* [#1808](https://github.com/pmd/pmd/pull/1808): \[plsql] Fix PL/SQL Syntax errors - [kabroxiko](https://github.com/kabroxiko)
* [#1829](https://github.com/pmd/pmd/pull/1829): \[java] Fix false negative in UnsynchronizedStaticFormatter - [Srinivasan Venkatachalam](https://github.com/Srini1993)
{% endtocmaker %}

View File

@ -1,4 +1,7 @@
/**
* Fix #1848 Local classes should preserve their modifiers
* Clément Fournier 05/2019
*====================================================================
* Add support for Java 12 switch expressions and switch rules.
* Andreas Dangel, Clément Fournier 03/2019
*====================================================================
@ -442,6 +445,17 @@ public class JavaParser {
return getToken(1).kind == IDENTIFIER && getToken(1).image.equals(keyword);
}
private boolean shouldStartStatementInSwitch() {
switch (getToken(1).kind) {
case _DEFAULT:
case CASE:
case RBRACE:
return false;
default:
return true;
}
}
public Map<Integer, String> getSuppressMap() {
return token_source.getSuppressMap();
}
@ -1698,8 +1712,7 @@ void ClassOrInterfaceDeclaration(int modifiers):
inInterface = false;
}
{
( /* See note about this optional final modifier in BlockStatement */
["final"|"abstract"] "class" | "interface" { jjtThis.setInterface(); inInterface = true; } )
( "class" | "interface" { jjtThis.setInterface(); inInterface = true; } )
t=<IDENTIFIER> { checkForBadTypeIdentifierUsage(t.image); jjtThis.setImage(t.image); }
[ TypeParameters() ]
[ ExtendsList() ]
@ -2423,13 +2436,26 @@ void BlockStatement():
|
Statement()
|
/*
TODO: Seems like we should be discarding the "final"
after using it in the lookahead; I added a ["final|abstract"] inside
ClassOrInterfaceDeclaration, but that seems like a hack that
could break other things...
*/
LOOKAHEAD( (Annotation())* ["final"|"abstract"] "class") (Annotation())* ClassOrInterfaceDeclaration(0)
// we don't need to lookahead further here
// the ambiguity between start of local class and local variable decl
// is already handled in the lookahead guarding LocalVariableDeclaration above.
LocalClassDecl()
}
void LocalClassDecl() #void:
{int mods = 0;}
{
// this preserves the modifiers of the local class.
// it allows for modifiers that are forbidden for local classes,
// but anyway we are *not* checking modifiers for incompatibilities
// anywhere else in this grammar (and indeed the production Modifiers
// accepts any modifier explicitly for the purpose of forgiving modifier errors,
// and reporting them later if needed --see its documentation).
// In particular, it unfortunately allows local class declarations to start
// with a "default" modifier, which introduces an ambiguity with default
// switch labels. This is guarded by a custom lookahead around SwitchLabel
mods=Modifiers() ClassOrInterfaceDeclaration(mods)
}
/*
@ -2484,7 +2510,11 @@ void SwitchBlock() #void :
(
"->" SwitchLabeledRulePart() (SwitchLabeledRule())*
|
":" (LOOKAHEAD(2) SwitchLabel() ":")* (BlockStatement())* (SwitchLabeledStatementGroup())*
":" (LOOKAHEAD(2) SwitchLabel() ":")*
// the lookahead is to prevent choosing BlockStatement when the token is "default",
// which could happen as local class declarations accept the "default" modifier.
(LOOKAHEAD({shouldStartStatementInSwitch()}) BlockStatement())*
(SwitchLabeledStatementGroup())*
)
)?
"}"
@ -2512,7 +2542,10 @@ void SwitchLabeledRulePart() #void:
void SwitchLabeledStatementGroup() #void:
{}
{
(LOOKAHEAD(2) SwitchLabel() ":")+ ( BlockStatement() )*
(LOOKAHEAD(2) SwitchLabel() ":")+
// the lookahead is to prevent choosing BlockStatement when the token is "default",
// which could happen as local class declarations accept the "default" modifier.
(LOOKAHEAD({shouldStartStatementInSwitch()}) BlockStatement() )*
}
void SwitchLabel() :

View File

@ -1,10 +1,11 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAdditiveExpression.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
/**
* Represents an addition operation on two or more values, or string concatenation.
* This has a precedence greater than {@link ASTShiftExpression}, and lower
@ -20,10 +21,15 @@ package net.sourceforge.pmd.lang.java.ast;
* </pre>
*/
public class ASTAdditiveExpression extends AbstractJavaTypeNode {
@InternalApi
@Deprecated
public ASTAdditiveExpression(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAdditiveExpression(JavaParser p, int id) {
super(p, id);
}

View File

@ -1,10 +1,10 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAllocationExpression.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.java.qname.JavaTypeQualifiedName;
@ -12,17 +12,18 @@ public class ASTAllocationExpression extends AbstractJavaTypeNode implements Jav
private JavaTypeQualifiedName qualifiedName;
@InternalApi
@Deprecated
public ASTAllocationExpression(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAllocationExpression(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
@ -54,6 +55,8 @@ public class ASTAllocationExpression extends AbstractJavaTypeNode implements Jav
return qualifiedName;
}
@InternalApi
@Deprecated
public void setQualifiedName(JavaTypeQualifiedName qname) {
this.qualifiedName = qname;
}

View File

@ -1,10 +1,11 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAndExpression.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
/**
* Represents a non-shortcut boolean AND-expression.
* This has a precedence greater than {@link ASTExclusiveOrExpression},
@ -21,10 +22,15 @@ package net.sourceforge.pmd.lang.java.ast;
* </pre>
*/
public class ASTAndExpression extends AbstractJavaTypeNode {
@InternalApi
@Deprecated
public ASTAndExpression(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAndExpression(JavaParser p, int id) {
super(p, id);
}

View File

@ -1,7 +1,6 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAnnotation.java */
package net.sourceforge.pmd.lang.java.ast;
@ -9,6 +8,7 @@ import java.util.Arrays;
import java.util.List;
import net.sourceforge.pmd.Rule;
import net.sourceforge.pmd.annotation.InternalApi;
/**
@ -22,19 +22,22 @@ import net.sourceforge.pmd.Rule;
* | {@linkplain ASTMarkerAnnotation MarkerAnnotation}
*
* </pre>
*
*/
public class ASTAnnotation extends AbstractJavaTypeNode {
private static final List<String> UNUSED_RULES
= Arrays.asList("UnusedPrivateField", "UnusedLocalVariable", "UnusedPrivateMethod", "UnusedFormalParameter");
= Arrays.asList("UnusedPrivateField", "UnusedLocalVariable", "UnusedPrivateMethod", "UnusedFormalParameter");
private static final List<String> SERIAL_RULES = Arrays.asList("BeanMembersShouldSerialize", "MissingSerialVersionUID");
@InternalApi
@Deprecated
public ASTAnnotation(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAnnotation(JavaParser p, int id) {
super(p, id);
}
@ -82,10 +85,10 @@ public class ASTAnnotation extends AbstractJavaTypeNode {
if (isSuppressWarnings()) {
for (ASTLiteral element : findDescendantsOfType(ASTLiteral.class)) {
if (element.hasImageEqualTo("\"PMD\"") || element.hasImageEqualTo("\"PMD." + rule.getName() + "\"")
// Check for standard annotations values
|| element.hasImageEqualTo("\"all\"")
|| element.hasImageEqualTo("\"serial\"") && SERIAL_RULES.contains(rule.getName())
|| element.hasImageEqualTo("\"unused\"") && UNUSED_RULES.contains(rule.getName())) {
// Check for standard annotations values
|| element.hasImageEqualTo("\"all\"")
|| element.hasImageEqualTo("\"serial\"") && SERIAL_RULES.contains(rule.getName())
|| element.hasImageEqualTo("\"unused\"") && UNUSED_RULES.contains(rule.getName())) {
return true;
}
}
@ -96,7 +99,8 @@ public class ASTAnnotation extends AbstractJavaTypeNode {
private boolean isSuppressWarnings() {
return "SuppressWarnings".equals(getAnnotationName()) || "java.lang.SuppressWarnings".equals(getAnnotationName());
return "SuppressWarnings".equals(getAnnotationName())
|| "java.lang.SuppressWarnings".equals(getAnnotationName());
}
@Override

View File

@ -1,21 +1,25 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAnnotationMethodDeclaration.java Version 4.1 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY= */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTAnnotationMethodDeclaration extends AbstractMethodLikeNode {
@InternalApi
@Deprecated
public ASTAnnotationMethodDeclaration(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAnnotationMethodDeclaration(JavaParser p, int id) {
super(p, id);
}
/** Accept the visitor. **/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
@ -27,7 +31,3 @@ public class ASTAnnotationMethodDeclaration extends AbstractMethodLikeNode {
return MethodLikeKind.METHOD;
}
}
/*
* JavaCC - OriginalChecksum=f6dd440446f8aa5c9c191ae760080ee0 (do not edit this
* line)
*/

View File

@ -1,22 +1,25 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAnnotationTypeBody.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTAnnotationTypeBody extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTAnnotationTypeBody(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAnnotationTypeBody(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,26 +1,28 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAnnotationTypeDeclaration.java */
package net.sourceforge.pmd.lang.java.ast;
import java.util.List;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTAnnotationTypeDeclaration extends AbstractAnyTypeDeclaration {
@InternalApi
@Deprecated
public ASTAnnotationTypeDeclaration(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAnnotationTypeDeclaration(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor.
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,22 +1,25 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAnnotationTypeMemberDeclaration.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTAnnotationTypeMemberDeclaration extends AbstractTypeBodyDeclaration {
@InternalApi
@Deprecated
public ASTAnnotationTypeMemberDeclaration(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAnnotationTypeMemberDeclaration(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,22 +1,25 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTArgumentList.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTArgumentList extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTArgumentList(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTArgumentList(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,15 +1,21 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTArguments.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTArguments extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTArguments(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTArguments(JavaParser p, int id) {
super(p, id);
}
@ -21,9 +27,6 @@ public class ASTArguments extends AbstractJavaNode {
return this.jjtGetChild(0).jjtGetNumChildren();
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,24 +1,27 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTArrayDimsAndInits.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTArrayDimsAndInits extends AbstractJavaNode implements Dimensionable {
private int arrayDepth;
@InternalApi
@Deprecated
public ASTArrayDimsAndInits(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTArrayDimsAndInits(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,22 +1,25 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTArrayInitializer.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTArrayInitializer extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTArrayInitializer(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTArrayInitializer(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,10 +1,11 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAssertStatement.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
/**
* Represents an {@code assert} statement.
*
@ -15,10 +16,15 @@ package net.sourceforge.pmd.lang.java.ast;
* </pre>
*/
public class ASTAssertStatement extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTAssertStatement(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAssertStatement(JavaParser p, int id) {
super(p, id);
}

View File

@ -1,10 +1,11 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTAssignmentOperator.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
/**
* Represents an assignment operator in an {@linkplain ASTExpression assignment expression}.
*
@ -15,17 +16,24 @@ package net.sourceforge.pmd.lang.java.ast;
* </pre>
*/
public class ASTAssignmentOperator extends AbstractJavaNode {
private boolean isCompound;
@InternalApi
@Deprecated
public ASTAssignmentOperator(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTAssignmentOperator(JavaParser p, int id) {
super(p, id);
}
// TODO this could be determined from the image of the operator, no need to set it in the parser...
@InternalApi
@Deprecated
public void setCompound() {
isCompound = true;
}

View File

@ -1,25 +1,27 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTBlock.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTBlock extends AbstractJavaNode {
private boolean containsComment;
@InternalApi
@Deprecated
public ASTBlock(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTBlock(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
@ -29,6 +31,8 @@ public class ASTBlock extends AbstractJavaNode {
return this.containsComment;
}
@InternalApi
@Deprecated
public void setContainsComment() {
this.containsComment = true;
}

View File

@ -1,22 +1,25 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTBlockStatement.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTBlockStatement extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTBlockStatement(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTBlockStatement(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
@ -26,7 +29,7 @@ public class ASTBlockStatement extends AbstractJavaNode {
* Tells if this BlockStatement is an allocation statement. This is done by
*
* @return the result of
* containsDescendantOfType(ASTAllocationExpression.class)
* containsDescendantOfType(ASTAllocationExpression.class)
*/
public final boolean isAllocation() {
return hasDescendantOfType(ASTAllocationExpression.class);

View File

@ -1,22 +1,29 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTBooleanLiteral.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTBooleanLiteral extends AbstractJavaTypeNode {
private boolean isTrue;
@InternalApi
@Deprecated
public ASTBooleanLiteral(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTBooleanLiteral(JavaParser p, int id) {
super(p, id);
}
@InternalApi
@Deprecated
public void setTrue() {
isTrue = true;
}
@ -25,9 +32,6 @@ public class ASTBooleanLiteral extends AbstractJavaTypeNode {
return this.isTrue;
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,15 +1,21 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTBreakStatement.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTBreakStatement extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTBreakStatement(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTBreakStatement(JavaParser p, int id) {
super(p, id);
}

View File

@ -1,21 +1,29 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTCastExpression.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTCastExpression extends AbstractJavaTypeNode {
private boolean intersectionTypes = false;
@InternalApi
@Deprecated
public ASTCastExpression(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTCastExpression(JavaParser p, int id) {
super(p, id);
}
@InternalApi
@Deprecated
public void setIntersectionTypes(boolean intersectionTypes) {
this.intersectionTypes = intersectionTypes;
}
@ -24,9 +32,6 @@ public class ASTCastExpression extends AbstractJavaTypeNode {
return intersectionTypes;
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,13 +1,14 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTCatchStatement.java */
package net.sourceforge.pmd.lang.java.ast;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.pmd.annotation.InternalApi;
/**
* Catch statement node.
@ -16,10 +17,15 @@ import java.util.List;
* </pre>
*/
public class ASTCatchStatement extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTCatchStatement(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTCatchStatement(JavaParser p, int id) {
super(p, id);
}

View File

@ -1,10 +1,11 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTClassOrInterfaceBody.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
/**
* Represents the body of a {@linkplain ASTClassOrInterfaceDeclaration class or interface declaration}.
* This includes anonymous classes, including those defined within an {@linkplain ASTEnumConstant enum constant}.
@ -16,17 +17,19 @@ package net.sourceforge.pmd.lang.java.ast;
* </pre>
*/
public class ASTClassOrInterfaceBody extends AbstractJavaNode {
@InternalApi
@Deprecated
public ASTClassOrInterfaceBody(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTClassOrInterfaceBody(JavaParser p, int id) {
super(p, id);
}
/**
* Accept the visitor.
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,18 +1,22 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTClassOrInterfaceBodyDeclaration.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.Rule;
import net.sourceforge.pmd.annotation.InternalApi;
public class ASTClassOrInterfaceBodyDeclaration extends AbstractTypeBodyDeclaration implements CanSuppressWarnings, ASTAnyTypeBodyDeclaration {
@InternalApi
@Deprecated
public ASTClassOrInterfaceBodyDeclaration(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTClassOrInterfaceBodyDeclaration(JavaParser p, int id) {
super(p, id);
}
@ -35,9 +39,6 @@ public class ASTClassOrInterfaceBodyDeclaration extends AbstractTypeBodyDeclarat
return false;
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);

View File

@ -1,13 +1,13 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTClassOrInterfaceDeclaration.java */
package net.sourceforge.pmd.lang.java.ast;
import java.util.Collections;
import java.util.List;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.util.CollectionUtil;
@ -25,7 +25,6 @@ import net.sourceforge.pmd.util.CollectionUtil;
* {@linkplain ASTImplementsList ImplementsList}?
* {@linkplain ASTClassOrInterfaceBody ClassOrInterfaceBody}
* </pre>
*
*/
public class ASTClassOrInterfaceDeclaration extends AbstractAnyTypeDeclaration {
@ -34,10 +33,14 @@ public class ASTClassOrInterfaceDeclaration extends AbstractAnyTypeDeclaration {
private boolean isInterface;
@InternalApi
@Deprecated
public ASTClassOrInterfaceDeclaration(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTClassOrInterfaceDeclaration(JavaParser p, int id) {
super(p, id);
}
@ -47,14 +50,15 @@ public class ASTClassOrInterfaceDeclaration extends AbstractAnyTypeDeclaration {
return isNested() || isLocal();
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
@Override
public boolean isPackagePrivate() {
return super.isPackagePrivate() && !isLocal();
}
/**
* Returns true if the class is declared inside a block other
@ -68,7 +72,7 @@ public class ASTClassOrInterfaceDeclaration extends AbstractAnyTypeDeclaration {
isLocal = false;
break;
} else if (current instanceof ASTMethodOrConstructorDeclaration
|| current instanceof ASTInitializer) {
|| current instanceof ASTInitializer) {
isLocal = true;
break;
}
@ -86,6 +90,8 @@ public class ASTClassOrInterfaceDeclaration extends AbstractAnyTypeDeclaration {
return this.isInterface;
}
@InternalApi
@Deprecated
public void setInterface() {
this.isInterface = true;
}
@ -128,8 +134,8 @@ public class ASTClassOrInterfaceDeclaration extends AbstractAnyTypeDeclaration {
public List<ASTClassOrInterfaceType> getSuperInterfacesTypeNodes() {
Iterable<ASTClassOrInterfaceType> it = isInterface()
? getFirstChildOfType(ASTExtendsList.class)
: getFirstChildOfType(ASTImplementsList.class);
? getFirstChildOfType(ASTExtendsList.class)
: getFirstChildOfType(ASTImplementsList.class);
return it == null ? Collections.<ASTClassOrInterfaceType>emptyList() : CollectionUtil.toList(it.iterator());
}

View File

@ -1,10 +1,10 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTClassOrInterfaceType.java */
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.Node;
@ -16,13 +16,17 @@ import net.sourceforge.pmd.lang.ast.Node;
* ClassOrInterfaceType ::= &lt;IDENTIFIER&gt; {@linkplain ASTTypeArguments TypeArguments}? ( "." &lt;IDENTIFIER&gt; {@linkplain ASTTypeArguments TypeArguments}? )*
*
* </pre>
*
*/
public class ASTClassOrInterfaceType extends AbstractJavaTypeNode {
@InternalApi
@Deprecated
public ASTClassOrInterfaceType(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTClassOrInterfaceType(JavaParser p, int id) {
super(p, id);
}
@ -38,7 +42,7 @@ public class ASTClassOrInterfaceType extends AbstractJavaTypeNode {
* to check this, if {@link #getType()} is null.
*
* @return <code>true</code> if this node referencing a type in the same
* compilation unit, <code>false</code> otherwise.
* compilation unit, <code>false</code> otherwise.
*/
public boolean isReferenceToClassSameCompilationUnit() {
ASTCompilationUnit root = getFirstParentOfType(ASTCompilationUnit.class);

View File

@ -1,12 +1,12 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/* Generated By:JJTree: Do not edit this line. ASTCompilationUnit.java */
package net.sourceforge.pmd.lang.java.ast;
import java.util.List;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.RootNode;
import net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver;
@ -17,10 +17,14 @@ public class ASTCompilationUnit extends AbstractJavaTypeNode implements RootNode
private ClassTypeResolver classTypeResolver;
private List<Comment> comments;
@InternalApi
@Deprecated
public ASTCompilationUnit(int id) {
super(id);
}
@InternalApi
@Deprecated
public ASTCompilationUnit(JavaParser p, int id) {
super(p, id);
}
@ -29,13 +33,12 @@ public class ASTCompilationUnit extends AbstractJavaTypeNode implements RootNode
return comments;
}
@InternalApi
@Deprecated
public void setComments(List<Comment> comments) {
this.comments = comments;
}
/**
* Accept the visitor. *
*/
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
@ -57,6 +60,8 @@ public class ASTCompilationUnit extends AbstractJavaTypeNode implements RootNode
return classTypeResolver;
}
@InternalApi
@Deprecated
public void setClassTypeResolver(ClassTypeResolver classTypeResolver) {
this.classTypeResolver = classTypeResolver;
}

Some files were not shown because too many files have changed in this diff Show More