Turn ParserCornerTest into a tree dump test

This commit is contained in:
Clément Fournier
2020-08-23 18:33:17 +02:00
parent f4cdb3bf64
commit e5bf0b3f82
23 changed files with 2876 additions and 108 deletions

View File

@ -4,34 +4,38 @@
package net.sourceforge.pmd.lang.java.ast;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import net.sourceforge.pmd.lang.ast.NodeStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper;
import net.sourceforge.pmd.lang.java.BaseJavaTreeDumpTest;
import net.sourceforge.pmd.lang.java.JavaParsingHelper;
import net.sourceforge.pmd.lang.symboltable.NameDeclaration;
import net.sourceforge.pmd.lang.symboltable.NameOccurrence;
public class ParserCornersTest extends BaseParserTest {
private static final String MULTICATCH = "public class Foo { public void bar() { "
+ "try { System.out.println(); } catch (RuntimeException | IOException e) {} } }";
public class ParserCornersTest extends BaseJavaTreeDumpTest {
private final JavaParsingHelper java = JavaParsingHelper.WITH_PROCESSING.withResourceContext(getClass());
private final JavaParsingHelper java4 = java.withDefaultVersion("1.4");
private final JavaParsingHelper java7 = java.withDefaultVersion("1.7");
private final JavaParsingHelper java8 = java.withDefaultVersion("1.8");
private final JavaParsingHelper java5 = java.withDefaultVersion("1.7");
@Rule
public ExpectedException expect = ExpectedException.none();
@Override
public @NonNull BaseParsingHelper<?, ?> getParser() {
return java4;
}
@Test
public void testInvalidUnicodeEscape() {
expect.expect(TokenMgrError.class); // previously Error
@ -58,25 +62,25 @@ public class ParserCornersTest extends BaseParserTest {
@Test
public void testDiamondUsageJava8() {
java8.parse("public class PMDExceptionTest {\n"
+ " private Component makeUI() {\n"
+ " String[] model = {\"123456\", \"7890\"};\n"
+ " JComboBox<String> comboBox = new JComboBox<>(model);\n"
+ " comboBox.setEditable(true);\n"
+ " comboBox.setEditor(new BasicComboBoxEditor() {\n"
+ " private Component editorComponent;\n"
+ " @Override public Component getEditorComponent() {\n"
+ " if (editorComponent == null) {\n"
+ " JTextField tc = (JTextField) super.getEditorComponent();\n"
+ " editorComponent = new JLayer<>(tc, new ValidationLayerUI<>());\n"
+ " }\n"
+ " return editorComponent;\n"
+ " }\n"
+ " });\n"
+ " JPanel p = new JPanel();\n"
+ " p.add(comboBox);\n"
+ " return p;\n"
+ " }\n"
+ "}");
+ " private Component makeUI() {\n"
+ " String[] model = {\"123456\", \"7890\"};\n"
+ " JComboBox<String> comboBox = new JComboBox<>(model);\n"
+ " comboBox.setEditable(true);\n"
+ " comboBox.setEditor(new BasicComboBoxEditor() {\n"
+ " private Component editorComponent;\n"
+ " @Override public Component getEditorComponent() {\n"
+ " if (editorComponent == null) {\n"
+ " JTextField tc = (JTextField) super.getEditorComponent();\n"
+ " editorComponent = new JLayer<>(tc, new ValidationLayerUI<>());\n"
+ " }\n"
+ " return editorComponent;\n"
+ " }\n"
+ " });\n"
+ " JPanel p = new JPanel();\n"
+ " p.add(comboBox);\n"
+ " return p;\n"
+ " }\n"
+ "}");
}
@Test
@ -101,24 +105,17 @@ public class ParserCornersTest extends BaseParserTest {
@Test
public void testParsersCases15() {
java5.parseResource("ParserCornerCases.java");
doTest("ParserCornerCases", java5);
}
@Test
public void testParsersCases17() {
java7.parseResource("ParserCornerCases17.java");
doTest("ParserCornerCases17", java7);
}
@Test
public void testParsersCases18() {
ASTCompilationUnit cu = java8.parseResource("ParserCornerCases18.java");
NodeStream<ASTFormalParameter> formals = cu.descendants(ASTFormalParameter.class)
.crossFindBoundaries()
.cached();
Assert.assertEquals(21, formals.count());
Assert.assertEquals(4, formals.filter(ASTFormalParameter::isExplicitReceiverParameter).count());
Assert.assertEquals(17, formals.filter(it -> !it.isExplicitReceiverParameter()).count());
doTest("ParserCornerCases18", java8);
}
/**
@ -126,19 +123,12 @@ public class ParserCornersTest extends BaseParserTest {
*/
@Test
public void testLambdaBug1333() {
java8.parse("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<? super String> consumer) {\n"
+ " LOG.debug(consumer.toString());\n" + " }\n" + "\n"
+ " private void deleteDirectory(String path) {\n" + " LOG.debug(path);\n" + " }\n"
+ "}");
doTest("LambdaBug1333", java8);
}
@Test
public void testLambdaBug1470() {
java8.parseResource("LambdaBug1470.java");
doTest("LambdaBug1470", java8);
}
/**
@ -146,96 +136,59 @@ public class ParserCornersTest extends BaseParserTest {
*/
@Test
public void emptyFileJustComment() {
java8.parse("// just a comment");
getParser().parse("// just a comment");
}
@Test
public void testMultipleExceptionCatchingJava7() {
java7.parse(MULTICATCH);
}
@Test
public void testBug1429ParseError() {
java8.parseResource("Bug1429.java");
doTest("Bug1429", java8);
}
@Test
public void testBug1530ParseError() {
java8.parseResource("Bug1530.java");
doTest("Bug1530", java8);
}
@Test
public void testGitHubBug207() {
java8.parseResource("GitHubBug207.java");
doTest("GitHubBug207", java8);
}
@Test
public void testBug206() {
java8.parse("public @interface Foo {" + "\n"
+ "static final ThreadLocal<Interner<Integer>> interner =" + "\n"
+ " ThreadLocal.withInitial(Interners::newStrongInterner);" + "\n"
+ "}");
doTest("LambdaBug206", java8);
}
@Test
public void testGitHubBug208ParseError() {
java5.parseResource("GitHubBug208.java");
}
@Test
public void testGitHubBug257NonExistingCast() {
String code = "public class Test {" + "\n"
+ " public static void main(String[] args) {" + "\n"
+ " double a = 4.0;" + "\n"
+ " double b = 2.0;" + "\n"
+ " double result = Math.sqrt((a) - b);" + "\n"
+ " System.out.println(result);" + "\n"
+ " }" + "\n"
+ "}";
assertEquals("A cast was found when none expected",
0,
java5.parse(code).findDescendantsOfType(ASTCastExpression.class).size());
doTest("GitHubBug208", java5);
}
@Test
public void testGitHubBug309() {
java8.parseResource("GitHubBug309.java");
doTest("GitHubBug309", java8);
}
/**
* This triggered bug #1484 UnusedLocalVariable - false positive -
* parenthesis
*/
@Test
public void stringConcatentationShouldNotBeCast() {
String code = "public class Test {\n" + " public static void main(String[] args) {\n"
+ " System.out.println(\"X\" + (args) + \"Y\");\n" + " }\n" + "}";
Assert.assertEquals(0, java8.parse(code).findDescendantsOfType(ASTCastExpression.class).size());
}
/**
* Empty statements should be allowed.
* @throws Exception
*
* @see <a href="https://github.com/pmd/pmd/issues/378">github issue 378</a>
*/
@Test
public void testParseEmptyStatements() {
String code = "import a;;import b; public class Foo {}";
ASTCompilationUnit cu = java8.parse(code);
assertNotNull(cu);
Assert.assertEquals(ASTEmptyDeclaration.class, cu.getChild(1).getClass());
public void testEmptyStatements1() {
doTest("EmptyStmts1");
}
String code2 = "package c;; import a; import b; public class Foo {}";
ASTCompilationUnit cu2 = java8.parse(code2);
assertNotNull(cu2);
Assert.assertEquals(ASTEmptyDeclaration.class, cu2.getChild(1).getClass());
@Test
public void testEmptyStatements2() {
doTest("EmptyStmts2");
}
String code3 = "package c; import a; import b; public class Foo {};";
ASTCompilationUnit cu3 = java8.parse(code3);
assertNotNull(cu3);
Assert.assertEquals(ASTEmptyDeclaration.class, cu3.getChild(4).getClass());
@Test
public void testEmptyStatements3() {
doTest("EmptyStmts3");
}
@Test
@ -261,16 +214,12 @@ public class ParserCornersTest extends BaseParserTest {
@Test
public void testSwitchWithFallthrough() {
ASTCompilationUnit compilationUnit = java.parseResource("SwitchWithFallthrough.java", "11");
ASTSwitchStatement switchStatement = compilationUnit.getFirstDescendantOfType(ASTSwitchStatement.class);
Assert.assertEquals(2, switchStatement.findChildrenOfType(ASTSwitchFallthroughBranch.class).size());
doTest("SwitchWithFallthrough");
}
@Test
public void testSwitchStatements() {
ASTCompilationUnit compilationUnit = java.parseResource("SwitchStatements.java", "11");
ASTSwitchStatement switchStatement = compilationUnit.getFirstDescendantOfType(ASTSwitchStatement.class);
Assert.assertEquals(2, switchStatement.findChildrenOfType(ASTSwitchBranch.class).size());
doTest("SwitchStatements");
}

View File

@ -0,0 +1,100 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "Bug1429", @CanonicalName = "Bug1429", @Enum = "false", @Image = "Bug1429", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "Bug1429", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "getAttributeTuples", @MethodName = "getAttributeTuples", @Name = "getAttributeTuples", @Varargs = "false", @Visibility = "public", @Void = "false"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Set", @TypeImage = "Set", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
+- FormalParameters[@Size = "0"]
+- Block[@Size = "1", @containsComment = "false"]
+- ReturnStatement[]
+- CastExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Set", @TypeImage = "Set", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
+- ConditionalExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "1", @Parenthesized = "true"]
+- InfixExpression[@CompileTimeConstant = "false", @Expression = "true", @Operator = "==", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- FieldAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "attributes", @Name = "attributes", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- ThisExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- NullLiteral[@BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "false", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @IntLiteral = "false", @LongLiteral = "false", @NullLiteral = "true", @NumericLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @StringLiteral = "false"]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "emptySet", @MethodName = "emptySet", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- AmbiguousName[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @CompileTimeConstant = "false", @Expression = "true", @Image = "Collections", @Name = "Collections", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "false", @TypeImage = "Collections", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| +- ArgumentList[@Size = "0"]
+- ConstructorCall[@AnonymousClass = "false", @CompileTimeConstant = "false", @Diamond = "false", @DiamondTypeArgs = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false", @QualifiedInstanceCreation = "false"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "HashSet", @TypeImage = "HashSet", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
+- ArgumentList[@Size = "1"]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "collect", @MethodName = "collect", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- AmbiguousName[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @CompileTimeConstant = "false", @Expression = "true", @Image = "CollectionUtils", @Name = "CollectionUtils", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "false", @TypeImage = "CollectionUtils", @Void = "false"]
+- ArgumentList[@Size = "2"]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "keySet", @MethodName = "keySet", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- FieldAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "attributes", @Name = "attributes", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- ThisExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ArgumentList[@Size = "0"]
+- ConstructorCall[@AnonymousClass = "true", @CompileTimeConstant = "false", @Diamond = "false", @DiamondTypeArgs = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false", @QualifiedInstanceCreation = "false"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Transformer", @TypeImage = "Transformer", @Void = "false"]
+- ArgumentList[@Size = "0"]
+- AnonymousClassDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "true", @BinaryName = "Bug1429$1", @CanonicalName = null, @Enum = "false", @Image = "", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @Record = "false", @RegularClass = "false", @SimpleName = "", @TopLevel = "false", @Visibility = "anonymous"]
+- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "1", @Image = "transform", @MethodName = "transform", @Name = "transform", @Varargs = "false", @Visibility = "public", @Void = "false"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
| +- Annotation[@AnnotationName = "Override", @SimpleName = "Override"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Override", @TypeImage = "Override", @Void = "false"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Object", @TypeImage = "Object", @Void = "false"]
+- FormalParameters[@Size = "1"]
| +- FormalParameter[@Varargs = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Object", @TypeImage = "Object", @Void = "false"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "obj", @LambdaParameter = "false", @LocalVariable = "false", @Name = "obj", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "obj", @Visibility = "package"]
+- Block[@Size = "5", @containsComment = "false"]
+- LocalVariableDeclaration[@TypeInferred = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| +- VariableDeclarator[@Initializer = "true", @Name = "key"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "false", @Image = "key", @LambdaParameter = "false", @LocalVariable = "true", @Name = "key", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "key", @Visibility = "package"]
| +- CastExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "obj", @Name = "obj", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- LocalVariableDeclaration[@TypeInferred = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| +- VariableDeclarator[@Initializer = "true", @Name = "value"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "false", @Image = "value", @LambdaParameter = "false", @LocalVariable = "true", @Name = "value", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "value", @Visibility = "package"]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "get", @MethodName = "get", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- FieldAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "attributes", @Name = "attributes", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- ThisExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "HGXLIFFTypeConfiguration", @TypeImage = "HGXLIFFTypeConfiguration", @Void = "false"]
| +- ArgumentList[@Size = "1"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "key", @Name = "key", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- LocalVariableDeclaration[@TypeInferred = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| +- VariableDeclarator[@Initializer = "true", @Name = "result"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "false", @Image = "result", @LambdaParameter = "false", @LocalVariable = "true", @Name = "result", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "result", @Visibility = "package"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "key", @Name = "key", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- IfStatement[@Else = "false"]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "isNotEmpty", @MethodName = "isNotEmpty", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- AmbiguousName[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @CompileTimeConstant = "false", @Expression = "true", @Image = "StringUtils", @Name = "StringUtils", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "false", @TypeImage = "StringUtils", @Void = "false"]
| | +- ArgumentList[@Size = "1"]
| | +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "value", @Name = "value", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- Block[@Size = "1", @containsComment = "false"]
| +- ExpressionStatement[]
| +- AssignmentExpression[@CompileTimeConstant = "false", @Compound = "false", @Expression = "true", @Operator = "=", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- VariableAccess[@AccessType = "WRITE", @CompileTimeConstant = "false", @Expression = "true", @Image = "result", @Name = "result", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "concat", @MethodName = "concat", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "concat", @MethodName = "concat", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "result", @Name = "result", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- ArgumentList[@Size = "1"]
| | +- StringLiteral[@BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "true", @ConstValue = ":", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @Image = "":"", @IntLiteral = "false", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @StringLiteral = "true", @TextBlock = "false"]
| +- ArgumentList[@Size = "1"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "value", @Name = "value", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- ReturnStatement[]
+- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "result", @Name = "result", @ParenthesisDepth = "0", @Parenthesized = "false"]

View File

@ -0,0 +1,19 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "Bug1530", @CanonicalName = "Bug1530", @Enum = "false", @Image = "Bug1530", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "Bug1530", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "incChild", @MethodName = "incChild", @Name = "incChild", @Varargs = "false", @Visibility = "public", @Void = "true"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- VoidType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "void", @Void = "true"]
+- FormalParameters[@Size = "0"]
+- Block[@Size = "1", @containsComment = "false"]
+- ExpressionStatement[]
+- UnaryExpression[@CompileTimeConstant = "false", @Expression = "true", @Operator = "++", @ParenthesisDepth = "0", @Parenthesized = "false", @Prefix = "false"]
+- FieldAccess[@AccessType = "WRITE", @CompileTimeConstant = "false", @Expression = "true", @Image = "currentChild", @Name = "currentChild", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- CastExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "1", @Parenthesized = "true"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "PathElement", @TypeImage = "PathElement", @Void = "false"]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "getUserObject", @MethodName = "getUserObject", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "getLastLeaf", @MethodName = "getLastLeaf", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- AmbiguousName[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @CompileTimeConstant = "false", @Expression = "true", @Image = "stack", @Name = "stack", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "false", @TypeImage = "stack", @Void = "false"]
| +- ArgumentList[@Size = "0"]
+- ArgumentList[@Size = "0"]

View File

@ -0,0 +1,4 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
import a;;import b; public class Foo {}

View File

@ -0,0 +1,7 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ImportDeclaration[@ImportOnDemand = "false", @ImportedName = "a", @ImportedSimpleName = "a", @PackageName = "", @Static = "false"]
+- EmptyDeclaration[]
+- ImportDeclaration[@ImportOnDemand = "false", @ImportedName = "b", @ImportedSimpleName = "b", @PackageName = "", @Static = "false"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "Foo", @CanonicalName = "Foo", @Enum = "false", @Image = "Foo", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "Foo", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "0"]

View File

@ -0,0 +1,4 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package c;; import a; import b;

View File

@ -0,0 +1,6 @@
+- CompilationUnit[@PackageName = "c", @declarationsAreInDefaultPackage = "false"]
+- PackageDeclaration[@PackageNameImage = "c"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
+- EmptyDeclaration[]
+- ImportDeclaration[@ImportOnDemand = "false", @ImportedName = "a", @ImportedSimpleName = "a", @PackageName = "", @Static = "false"]
+- ImportDeclaration[@ImportOnDemand = "false", @ImportedName = "b", @ImportedSimpleName = "b", @PackageName = "", @Static = "false"]

View File

@ -0,0 +1,4 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package c; import a; public class Foo {};;

View File

@ -0,0 +1,9 @@
+- CompilationUnit[@PackageName = "c", @declarationsAreInDefaultPackage = "false"]
+- PackageDeclaration[@PackageNameImage = "c"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
+- ImportDeclaration[@ImportOnDemand = "false", @ImportedName = "a", @ImportedSimpleName = "a", @PackageName = "", @Static = "false"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "c.Foo", @CanonicalName = "c.Foo", @Enum = "false", @Image = "Foo", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "c", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "Foo", @TopLevel = "true", @Visibility = "public"]
| +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
| +- ClassOrInterfaceBody[@Size = "0"]
+- EmptyDeclaration[]
+- EmptyDeclaration[]

View File

@ -0,0 +1,23 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "GitHubBug207", @CanonicalName = "GitHubBug207", @Enum = "false", @Image = "GitHubBug207", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "GitHubBug207", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "1", @Image = "resourceHttpMessageWriter", @MethodName = "resourceHttpMessageWriter", @Name = "resourceHttpMessageWriter", @Varargs = "false", @Visibility = "private", @Void = "false"]
+- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "HttpMessageWriter", @TypeImage = "HttpMessageWriter", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Resource", @TypeImage = "Resource", @Void = "false"]
+- FormalParameters[@Size = "1"]
| +- FormalParameter[@Varargs = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "true", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Context", @TypeImage = "Context", @Void = "false"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "context", @LambdaParameter = "false", @LocalVariable = "false", @Name = "context", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "context", @Visibility = "package"]
+- Block[@Size = "1", @containsComment = "false"]
+- ReturnStatement[]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "map", @MethodName = "map", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "context", @Name = "context", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- ArgumentList[@Size = "1"]
+- MethodReference[@CompileTimeConstant = "false", @ConstructorReference = "false", @Expression = "true", @MethodName = "cast", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- AmbiguousName[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @CompileTimeConstant = "false", @Expression = "true", @Image = "BodyInserters", @Name = "BodyInserters", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "false", @TypeImage = "BodyInserters", @Void = "false"]
+- TypeArguments[@Diamond = "false", @Size = "1"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Resource", @TypeImage = "Resource", @Void = "false"]

View File

@ -0,0 +1,26 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "GitHubBug208", @CanonicalName = "GitHubBug208", @Enum = "false", @Image = "GitHubBug208", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "GitHubBug208", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "testMethod", @MethodName = "testMethod", @Name = "testMethod", @Varargs = "false", @Visibility = "public", @Void = "true"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- VoidType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "void", @Void = "true"]
+- FormalParameters[@Size = "0"]
+- Block[@Size = "1", @containsComment = "false"]
+- LocalClassStatement[]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "GitHubBug208$1LocalClass", @CanonicalName = null, @Enum = "false", @Image = "LocalClass", @Interface = "false", @Local = "true", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "LocalClass", @TopLevel = "false", @Visibility = "local"]
+- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- Annotation[@AnnotationName = "Lazy", @SimpleName = "Lazy"]
| | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Lazy", @TypeImage = "Lazy", @Void = "false"]
| +- Annotation[@AnnotationName = "Configuration", @SimpleName = "Configuration"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Configuration", @TypeImage = "Configuration", @Void = "false"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "foo", @MethodName = "foo", @Name = "foo", @Varargs = "false", @Visibility = "package", @Void = "false"]
+- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- Annotation[@AnnotationName = "Bean", @SimpleName = "Bean"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Bean", @TypeImage = "Bean", @Void = "false"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Object", @TypeImage = "Object", @Void = "false"]
+- FormalParameters[@Size = "0"]
+- Block[@Size = "1", @containsComment = "false"]
+- ReturnStatement[]
+- NullLiteral[@BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "false", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @IntLiteral = "false", @LongLiteral = "false", @NullLiteral = "true", @NumericLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @StringLiteral = "false"]

View File

@ -0,0 +1,45 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ImportDeclaration[@ImportOnDemand = "true", @ImportedName = "java.util", @ImportedSimpleName = null, @PackageName = "java.util", @Static = "false"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "GitHubBug309", @CanonicalName = "GitHubBug309", @Enum = "false", @Image = "GitHubBug309", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "GitHubBug309", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "1", @Image = "main", @MethodName = "main", @Name = "main", @Varargs = "false", @Visibility = "public", @Void = "true"]
+- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"]
+- VoidType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "void", @Void = "true"]
+- FormalParameters[@Size = "1"]
| +- FormalParameter[@Varargs = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- ArrayType[@ArrayDepth = "1", @ArrayType = "true", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "String", @Void = "false"]
| | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| | +- ArrayDimensions[@Size = "1"]
| | +- ArrayTypeDim[@Varargs = "false"]
| +- VariableDeclaratorId[@ArrayType = "true", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "args", @LambdaParameter = "false", @LocalVariable = "false", @Name = "args", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "args", @Visibility = "package"]
+- Block[@Size = "2", @containsComment = "true"]
+- LocalVariableDeclaration[@TypeInferred = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Runnable", @TypeImage = "Runnable", @Void = "false"]
| +- VariableDeclarator[@Initializer = "true", @Name = "r11"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "false", @Image = "r11", @LambdaParameter = "false", @LocalVariable = "true", @Name = "r11", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "r11", @Visibility = "package"]
| +- MethodReference[@CompileTimeConstant = "false", @ConstructorReference = "true", @Expression = "true", @MethodName = "new", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- TypeExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Main", @TypeImage = "Main", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
+- LocalVariableDeclaration[@TypeInferred = "false", @Visibility = "local"]
+- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "IntFunction", @TypeImage = "IntFunction", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ArrayType[@ArrayDepth = "1", @ArrayType = "true", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "int", @Void = "false"]
| +- PrimitiveType[@ArrayDepth = "0", @ArrayType = "false", @Boolean = "false", @ClassOrInterfaceType = "false", @Image = "int", @ModelConstant = "int", @PrimitiveType = "true", @TypeImage = "int", @Void = "false"]
| +- ArrayDimensions[@Size = "1"]
| +- ArrayTypeDim[@Varargs = "false"]
+- VariableDeclarator[@Initializer = "true", @Name = "r13"]
+- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "false", @Image = "r13", @LambdaParameter = "false", @LocalVariable = "true", @Name = "r13", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "r13", @Visibility = "package"]
+- MethodReference[@CompileTimeConstant = "false", @ConstructorReference = "true", @Expression = "true", @MethodName = "new", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- TypeExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ArrayType[@ArrayDepth = "1", @ArrayType = "true", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "int", @Void = "false"]
| +- PrimitiveType[@ArrayDepth = "0", @ArrayType = "false", @Boolean = "false", @ClassOrInterfaceType = "false", @Image = "int", @ModelConstant = "int", @PrimitiveType = "true", @TypeImage = "int", @Void = "false"]
| +- ArrayDimensions[@Size = "1"]
| +- ArrayTypeDim[@Varargs = "false"]
+- TypeArguments[@Diamond = "false", @Size = "1"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]

View File

@ -0,0 +1,19 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
final class Bug1333 {
private static final Logger LOG = LoggerFactory.getLogger(Foo.class);
public void deleteDirectoriesByNamePattern() {
delete(path -> deleteDirectory(path));
}
private void delete(Consumer<? super String> consumer) {
LOG.debug(consumer.toString());
}
private void deleteDirectory(String path) {
LOG.debug(path);
}
}

View File

@ -0,0 +1,63 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "Bug1333", @CanonicalName = "Bug1333", @Enum = "false", @Image = "Bug1333", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "true", @Record = "false", @RegularClass = "true", @SimpleName = "Bug1333", @TopLevel = "true", @Visibility = "package"]
+- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"]
+- ClassOrInterfaceBody[@Size = "4"]
+- FieldDeclaration[@VariableName = "LOG", @Visibility = "private"]
| +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Logger", @TypeImage = "Logger", @Void = "false"]
| +- VariableDeclarator[@Initializer = "true", @Name = "LOG"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "true", @FormalParameter = "false", @Image = "LOG", @LambdaParameter = "false", @LocalVariable = "false", @Name = "LOG", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "LOG", @Visibility = "private"]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "getLogger", @MethodName = "getLogger", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- AmbiguousName[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @CompileTimeConstant = "false", @Expression = "true", @Image = "LoggerFactory", @Name = "LoggerFactory", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "false", @TypeImage = "LoggerFactory", @Void = "false"]
| +- ArgumentList[@Size = "1"]
| +- ClassLiteral[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Foo", @TypeImage = "Foo", @Void = "false"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "deleteDirectoriesByNamePattern", @MethodName = "deleteDirectoriesByNamePattern", @Name = "deleteDirectoriesByNamePattern", @Varargs = "false", @Visibility = "public", @Void = "true"]
| +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
| +- VoidType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "void", @Void = "true"]
| +- FormalParameters[@Size = "0"]
| +- Block[@Size = "1", @containsComment = "false"]
| +- ExpressionStatement[]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "delete", @MethodName = "delete", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ArgumentList[@Size = "1"]
| +- LambdaExpression[@BlockBody = "false", @CompileTimeConstant = "false", @Expression = "true", @ExpressionBody = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- LambdaParameterList[@Size = "1"]
| | +- LambdaParameter[@TypeInferred = "true", @Visibility = "package"]
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| | +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "path", @LambdaParameter = "true", @LocalVariable = "false", @Name = "path", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "true", @VariableName = "path", @Visibility = "package"]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "deleteDirectory", @MethodName = "deleteDirectory", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ArgumentList[@Size = "1"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "path", @Name = "path", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- MethodDeclaration[@Abstract = "false", @Arity = "1", @Image = "delete", @MethodName = "delete", @Name = "delete", @Varargs = "false", @Visibility = "private", @Void = "true"]
| +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"]
| +- VoidType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "void", @Void = "true"]
| +- FormalParameters[@Size = "1"]
| | +- FormalParameter[@Varargs = "false", @Visibility = "local"]
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Consumer", @TypeImage = "Consumer", @Void = "false"]
| | | +- TypeArguments[@Diamond = "false", @Size = "1"]
| | | +- WildcardType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @LowerBound = "true", @PrimitiveType = "false", @TypeImage = "?", @UpperBound = "false", @Void = "false"]
| | | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| | +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "consumer", @LambdaParameter = "false", @LocalVariable = "false", @Name = "consumer", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "consumer", @Visibility = "package"]
| +- Block[@Size = "1", @containsComment = "false"]
| +- ExpressionStatement[]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "debug", @MethodName = "debug", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "LOG", @Name = "LOG", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ArgumentList[@Size = "1"]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "toString", @MethodName = "toString", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "consumer", @Name = "consumer", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ArgumentList[@Size = "0"]
+- MethodDeclaration[@Abstract = "false", @Arity = "1", @Image = "deleteDirectory", @MethodName = "deleteDirectory", @Name = "deleteDirectory", @Varargs = "false", @Visibility = "private", @Void = "true"]
+- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"]
+- VoidType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "void", @Void = "true"]
+- FormalParameters[@Size = "1"]
| +- FormalParameter[@Varargs = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "path", @LambdaParameter = "false", @LocalVariable = "false", @Name = "path", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "path", @Visibility = "package"]
+- Block[@Size = "1", @containsComment = "false"]
+- ExpressionStatement[]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "debug", @MethodName = "debug", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "LOG", @Name = "LOG", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- ArgumentList[@Size = "1"]
+- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "path", @Name = "path", @ParenthesisDepth = "0", @Parenthesized = "false"]

View File

@ -0,0 +1,77 @@
+- CompilationUnit[@PackageName = "com.sample.test", @declarationsAreInDefaultPackage = "false"]
+- PackageDeclaration[@PackageNameImage = "com.sample.test"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
+- ImportDeclaration[@ImportOnDemand = "false", @ImportedName = "rx.Observable", @ImportedSimpleName = "Observable", @PackageName = "rx", @Static = "false"]
+- ImportDeclaration[@ImportOnDemand = "false", @ImportedName = "rx.Subscriber", @ImportedSimpleName = "Subscriber", @PackageName = "rx", @Static = "false"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "com.sample.test.pmdTest", @CanonicalName = "com.sample.test.pmdTest", @Enum = "false", @Image = "pmdTest", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "com.sample.test", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "pmdTest", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "3"]
+- FieldDeclaration[@VariableName = "stuff", @Visibility = "private"]
| +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"]
| +- PrimitiveType[@ArrayDepth = "0", @ArrayType = "false", @Boolean = "true", @ClassOrInterfaceType = "false", @Image = "boolean", @ModelConstant = "boolean", @PrimitiveType = "true", @TypeImage = "boolean", @Void = "false"]
| +- VariableDeclarator[@Initializer = "false", @Name = "stuff"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "true", @FormalParameter = "false", @Image = "stuff", @LambdaParameter = "false", @LocalVariable = "false", @Name = "stuff", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "stuff", @Visibility = "private"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "testSuper", @MethodName = "testSuper", @Name = "testSuper", @Varargs = "false", @Visibility = "public", @Void = "false"]
| +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Observable", @TypeImage = "Observable", @Void = "false"]
| | +- TypeArguments[@Diamond = "false", @Size = "1"]
| | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Boolean", @TypeImage = "Boolean", @Void = "false"]
| +- FormalParameters[@Size = "0"]
| +- Block[@Size = "1", @containsComment = "false"]
| +- ReturnStatement[]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "map", @MethodName = "map", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "create", @MethodName = "create", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- TypeExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Observable", @TypeImage = "Observable", @Void = "false"]
| | +- ArgumentList[@Size = "1"]
| | +- LambdaExpression[@BlockBody = "true", @CompileTimeConstant = "false", @Expression = "true", @ExpressionBody = "false", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- LambdaParameterList[@Size = "1"]
| | | +- LambdaParameter[@TypeInferred = "false", @Visibility = "package"]
| | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| | | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Subscriber", @TypeImage = "Subscriber", @Void = "false"]
| | | | +- TypeArguments[@Diamond = "false", @Size = "1"]
| | | | +- WildcardType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @LowerBound = "true", @PrimitiveType = "false", @TypeImage = "?", @UpperBound = "false", @Void = "false"]
| | | | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "String", @TypeImage = "String", @Void = "false"]
| | | +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "subscriber", @LambdaParameter = "true", @LocalVariable = "false", @Name = "subscriber", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "subscriber", @Visibility = "package"]
| | +- Block[@Size = "1", @containsComment = "false"]
| | +- ExpressionStatement[]
| | +- AssignmentExpression[@CompileTimeConstant = "false", @Compound = "false", @Expression = "true", @Operator = "=", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- VariableAccess[@AccessType = "WRITE", @CompileTimeConstant = "false", @Expression = "true", @Image = "stuff", @Name = "stuff", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- BooleanLiteral[@BooleanLiteral = "true", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @IntLiteral = "false", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @StringLiteral = "false", @True = "true"]
| +- ArgumentList[@Size = "1"]
| +- LambdaExpression[@BlockBody = "false", @CompileTimeConstant = "false", @Expression = "true", @ExpressionBody = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- LambdaParameterList[@Size = "1"]
| | +- LambdaParameter[@TypeInferred = "true", @Visibility = "package"]
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| | +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "authToken", @LambdaParameter = "true", @LocalVariable = "false", @Name = "authToken", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "true", @VariableName = "authToken", @Visibility = "package"]
| +- BooleanLiteral[@BooleanLiteral = "true", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @IntLiteral = "false", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @StringLiteral = "false", @True = "false"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "testSuper2", @MethodName = "testSuper2", @Name = "testSuper2", @Varargs = "false", @Visibility = "public", @Void = "false"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Observable", @TypeImage = "Observable", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Boolean", @TypeImage = "Boolean", @Void = "false"]
+- FormalParameters[@Size = "0"]
+- Block[@Size = "1", @containsComment = "false"]
+- ReturnStatement[]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "map", @MethodName = "map", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "create", @MethodName = "create", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- TypeExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Observable", @TypeImage = "Observable", @Void = "false"]
| +- ArgumentList[@Size = "1"]
| +- LambdaExpression[@BlockBody = "true", @CompileTimeConstant = "false", @Expression = "true", @ExpressionBody = "false", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- LambdaParameterList[@Size = "1"]
| | +- LambdaParameter[@TypeInferred = "true", @Visibility = "package"]
| | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| | +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "subscriber", @LambdaParameter = "true", @LocalVariable = "false", @Name = "subscriber", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "true", @VariableName = "subscriber", @Visibility = "package"]
| +- Block[@Size = "1", @containsComment = "false"]
| +- ExpressionStatement[]
| +- AssignmentExpression[@CompileTimeConstant = "false", @Compound = "false", @Expression = "true", @Operator = "=", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- VariableAccess[@AccessType = "WRITE", @CompileTimeConstant = "false", @Expression = "true", @Image = "stuff", @Name = "stuff", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- BooleanLiteral[@BooleanLiteral = "true", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @IntLiteral = "false", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @StringLiteral = "false", @True = "true"]
+- ArgumentList[@Size = "1"]
+- LambdaExpression[@BlockBody = "false", @CompileTimeConstant = "false", @Expression = "true", @ExpressionBody = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- LambdaParameterList[@Size = "1"]
| +- LambdaParameter[@TypeInferred = "true", @Visibility = "package"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "true", @Image = "authToken", @LambdaParameter = "true", @LocalVariable = "false", @Name = "authToken", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "true", @VariableName = "authToken", @Visibility = "package"]
+- BooleanLiteral[@BooleanLiteral = "true", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @IntLiteral = "false", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @StringLiteral = "false", @True = "false"]

View File

@ -0,0 +1,8 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
public @interface Foo {
static final ThreadLocal<Interner<Integer>> interner =
ThreadLocal.withInitial(Interners::newStrongInterner);
}

View File

@ -0,0 +1,19 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- AnnotationTypeDeclaration[@Abstract = "true", @Annotation = "true", @Anonymous = "false", @BinaryName = "Foo", @CanonicalName = "Foo", @Enum = "false", @Image = "Foo", @Interface = "true", @Local = "false", @Nested = "false", @PackageName = "", @Record = "false", @RegularClass = "false", @SimpleName = "Foo", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{public}"]
+- AnnotationTypeBody[@Size = "1"]
+- FieldDeclaration[@VariableName = "interner", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{static, final}"]
+- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "ThreadLocal", @TypeImage = "ThreadLocal", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Interner", @TypeImage = "Interner", @Void = "false"]
| +- TypeArguments[@Diamond = "false", @Size = "1"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "Integer", @TypeImage = "Integer", @Void = "false"]
+- VariableDeclarator[@Initializer = "true", @Name = "interner"]
+- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "true", @FormalParameter = "false", @Image = "interner", @LambdaParameter = "false", @LocalVariable = "false", @Name = "interner", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "interner", @Visibility = "public"]
+- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "withInitial", @MethodName = "withInitial", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- TypeExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "ThreadLocal", @TypeImage = "ThreadLocal", @Void = "false"]
+- ArgumentList[@Size = "1"]
+- MethodReference[@CompileTimeConstant = "false", @ConstructorReference = "false", @Expression = "true", @MethodName = "newStrongInterner", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- AmbiguousName[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @CompileTimeConstant = "false", @Expression = "true", @Image = "Interners", @Name = "Interners", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "false", @TypeImage = "Interners", @Void = "false"]

View File

@ -0,0 +1,39 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "SwitchStatements", @CanonicalName = "SwitchStatements", @Enum = "false", @Image = "SwitchStatements", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "SwitchStatements", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "myMethod", @MethodName = "myMethod", @Name = "myMethod", @Varargs = "false", @Visibility = "public", @Void = "true"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- VoidType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "void", @Void = "true"]
+- FormalParameters[@Size = "0"]
+- Block[@Size = "4", @containsComment = "false"]
+- LocalVariableDeclaration[@TypeInferred = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- PrimitiveType[@ArrayDepth = "0", @ArrayType = "false", @Boolean = "false", @ClassOrInterfaceType = "false", @Image = "int", @ModelConstant = "int", @PrimitiveType = "true", @TypeImage = "int", @Void = "false"]
| +- VariableDeclarator[@Initializer = "true", @Name = "a"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "false", @Image = "a", @LambdaParameter = "false", @LocalVariable = "true", @Name = "a", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "a", @Visibility = "package"]
| +- NumericLiteral[@Base = "10", @BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @Image = "1", @IntLiteral = "true", @Integral = "true", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "true", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "int", @StringLiteral = "false", @ValueAsDouble = "1.0", @ValueAsFloat = "1.0", @ValueAsInt = "1", @ValueAsLong = "1"]
+- SwitchStatement[@DefaultCase = "true", @ExhaustiveEnumSwitch = "false"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "a", @Name = "a", @ParenthesisDepth = "0", @Parenthesized = "false"]
| +- SwitchFallthroughBranch[]
| | +- SwitchLabel[@Default = "false"]
| | +- NumericLiteral[@Base = "10", @BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @Image = "1", @IntLiteral = "true", @Integral = "true", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "true", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "int", @StringLiteral = "false", @ValueAsDouble = "1.0", @ValueAsFloat = "1.0", @ValueAsInt = "1", @ValueAsLong = "1"]
| +- SwitchFallthroughBranch[]
| +- SwitchLabel[@Default = "true"]
+- SwitchStatement[@DefaultCase = "false", @ExhaustiveEnumSwitch = "false"]
| +- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "a", @Name = "a", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- SwitchStatement[@DefaultCase = "true", @ExhaustiveEnumSwitch = "false"]
+- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "a", @Name = "a", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- SwitchFallthroughBranch[]
| +- SwitchLabel[@Default = "false"]
| | +- NumericLiteral[@Base = "10", @BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @Image = "1", @IntLiteral = "true", @Integral = "true", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "true", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "int", @StringLiteral = "false", @ValueAsDouble = "1.0", @ValueAsFloat = "1.0", @ValueAsInt = "1", @ValueAsLong = "1"]
| +- ExpressionStatement[]
| | +- MethodCall[@CompileTimeConstant = "false", @Expression = "true", @Image = "println", @MethodName = "println", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | +- FieldAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "out", @Name = "out", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | | +- TypeExpression[@CompileTimeConstant = "false", @Expression = "true", @ParenthesisDepth = "0", @Parenthesized = "false"]
| | | +- ClassOrInterfaceType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "true", @FullyQualified = "false", @PrimitiveType = "false", @ReferenceToClassSameCompilationUnit = "false", @SimpleName = "System", @TypeImage = "System", @Void = "false"]
| | +- ArgumentList[@Size = "1"]
| | +- StringLiteral[@BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "true", @ConstValue = "1", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @Image = ""1"", @IntLiteral = "false", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @StringLiteral = "true", @TextBlock = "false"]
| +- BreakStatement[@Label = null]
+- SwitchFallthroughBranch[]
+- SwitchLabel[@Default = "true"]

View File

@ -0,0 +1,22 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = "true"]
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "SwitchWithFallthrough", @CanonicalName = "SwitchWithFallthrough", @Enum = "false", @Image = "SwitchWithFallthrough", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "false", @Record = "false", @RegularClass = "true", @SimpleName = "SwitchWithFallthrough", @TopLevel = "true", @Visibility = "public"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- ClassOrInterfaceBody[@Size = "1"]
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "myMethod", @MethodName = "myMethod", @Name = "myMethod", @Varargs = "false", @Visibility = "public", @Void = "true"]
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
+- VoidType[@ArrayDepth = "0", @ArrayType = "false", @ClassOrInterfaceType = "false", @PrimitiveType = "false", @TypeImage = "void", @Void = "true"]
+- FormalParameters[@Size = "0"]
+- Block[@Size = "2", @containsComment = "false"]
+- LocalVariableDeclaration[@TypeInferred = "false", @Visibility = "local"]
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
| +- PrimitiveType[@ArrayDepth = "0", @ArrayType = "false", @Boolean = "false", @ClassOrInterfaceType = "false", @Image = "int", @ModelConstant = "int", @PrimitiveType = "true", @TypeImage = "int", @Void = "false"]
| +- VariableDeclarator[@Initializer = "true", @Name = "a"]
| +- VariableDeclaratorId[@ArrayType = "false", @EnumConstant = "false", @ExceptionBlockParameter = "false", @Field = "false", @FormalParameter = "false", @Image = "a", @LambdaParameter = "false", @LocalVariable = "true", @Name = "a", @PatternBinding = "false", @RecordComponent = "false", @ResourceDeclaration = "false", @TypeInferred = "false", @VariableName = "a", @Visibility = "package"]
| +- NumericLiteral[@Base = "10", @BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @Image = "1", @IntLiteral = "true", @Integral = "true", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "true", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "int", @StringLiteral = "false", @ValueAsDouble = "1.0", @ValueAsFloat = "1.0", @ValueAsInt = "1", @ValueAsLong = "1"]
+- SwitchStatement[@DefaultCase = "true", @ExhaustiveEnumSwitch = "false"]
+- VariableAccess[@AccessType = "READ", @CompileTimeConstant = "false", @Expression = "true", @Image = "a", @Name = "a", @ParenthesisDepth = "0", @Parenthesized = "false"]
+- SwitchFallthroughBranch[]
| +- SwitchLabel[@Default = "false"]
| +- NumericLiteral[@Base = "10", @BooleanLiteral = "false", @CharLiteral = "false", @CompileTimeConstant = "true", @DoubleLiteral = "false", @Expression = "true", @FloatLiteral = "false", @Image = "1", @IntLiteral = "true", @Integral = "true", @LongLiteral = "false", @NullLiteral = "false", @NumericLiteral = "true", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "int", @StringLiteral = "false", @ValueAsDouble = "1.0", @ValueAsFloat = "1.0", @ValueAsInt = "1", @ValueAsLong = "1"]
+- SwitchFallthroughBranch[]
+- SwitchLabel[@Default = "true"]

View File

@ -30,7 +30,8 @@ abstract class BaseTreeDumpTest(
/**
* @see BaseTextComparisonTest.doTest
*/
fun doTest(fileBaseName: String) {
@JvmOverloads
fun doTest(fileBaseName: String, parser: BaseParsingHelper<*, *> = this.parser) {
super.doTest(fileBaseName, "") { sourceText ->
buildString {
printer.renderSubtree(parser.parse(sourceText), this)