From 24f84f90f199fdebf25c97c37d00ecfe116274a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 2 Apr 2024 17:55:48 +0200 Subject: [PATCH 001/142] deprecate duplicate methods in lambda expression --- .../pmd/lang/java/ast/ASTLambdaExpression.java | 10 ++++++---- .../sourceforge/pmd/lang/java/ast/TestExtensions.kt | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTLambdaExpression.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTLambdaExpression.java index cb6e353da9..b068b1929a 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTLambdaExpression.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTLambdaExpression.java @@ -76,30 +76,32 @@ public final class ASTLambdaExpression extends AbstractJavaExpr implements Funct } /** Returns the body of this expression, if it is a block. */ - @Nullable - public ASTBlock getBlock() { + public @Nullable ASTBlock getBlock() { return AstImplUtil.getChildAs(this, 1, ASTBlock.class); } /** Returns the body of this expression, if it is an expression. */ - @Nullable - public ASTExpression getExpression() { + public @Nullable ASTExpression getExpression() { return AstImplUtil.getChildAs(this, 1, ASTExpression.class); } /** * Returns the body of this lambda if it is a block. + * @deprecated Use {@link #getBlock()} */ @Nullable + @Deprecated public ASTBlock getBlockBody() { return NodeStream.of(getLastChild()).filterIs(ASTBlock.class).first(); } /** * Returns the body of this lambda if it is an expression. + * @deprecated Use {@link #getExpression()} */ @Nullable + @Deprecated public ASTExpression getExpressionBody() { return NodeStream.of(getLastChild()).filterIs(ASTExpression.class).first(); } diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/TestExtensions.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/TestExtensions.kt index bb3fed6787..220b3c8f77 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/TestExtensions.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/TestExtensions.kt @@ -521,7 +521,7 @@ fun TreeNodeWrapper.blockLambda(assertions: ValuedNodeSpec.exprLambda(assertions: ValuedNodeSpec Date: Tue, 2 Apr 2024 19:52:42 +0200 Subject: [PATCH 002/142] [java] Add new rule LambdaCanBeMethodReference --- .../LambdaCanBeMethodReferenceRule.java | 114 ++++++++++++++++ .../resources/category/java/codestyle.xml | 20 +++ .../LambdaCanBeMethodReferenceTest.java | 11 ++ .../xml/LambdaCanBeMethodReference.xml | 127 ++++++++++++++++++ 4 files changed, 272 insertions(+) create mode 100644 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java create mode 100644 pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceTest.java create mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java new file mode 100644 index 0000000000..447bdb13f0 --- /dev/null +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -0,0 +1,114 @@ +package net.sourceforge.pmd.lang.java.rule.codestyle; + +import net.sourceforge.pmd.lang.java.ast.ASTArgumentList; +import net.sourceforge.pmd.lang.java.ast.ASTClassLiteral; +import net.sourceforge.pmd.lang.java.ast.ASTConstructorCall; +import net.sourceforge.pmd.lang.java.ast.ASTExpression; +import net.sourceforge.pmd.lang.java.ast.ASTLambdaExpression; +import net.sourceforge.pmd.lang.java.ast.ASTLambdaParameter; +import net.sourceforge.pmd.lang.java.ast.ASTLambdaParameterList; +import net.sourceforge.pmd.lang.java.ast.ASTLiteral; +import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; +import net.sourceforge.pmd.lang.java.ast.ASTSuperExpression; +import net.sourceforge.pmd.lang.java.ast.ASTThisExpression; +import net.sourceforge.pmd.lang.java.ast.ASTTypeExpression; +import net.sourceforge.pmd.lang.java.ast.internal.JavaAstUtils; +import net.sourceforge.pmd.lang.java.ast.internal.PrettyPrintingUtil; +import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; +import net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol; +import net.sourceforge.pmd.lang.java.types.OverloadSelectionResult; +import net.sourceforge.pmd.properties.PropertyDescriptor; +import net.sourceforge.pmd.properties.PropertyFactory; + +public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { + + private static final PropertyDescriptor REPORT_IF_MAY_NPE = + PropertyFactory.booleanProperty("reportEvenIfMayNPE") + .desc("Also report those expressions that may throw a null pointer exception (NPE) when converted to a method reference. " + + "Those expressions will NPE at mref creation time, while the equivalent lambda would NPE only when invoked (which may be never).") + .defaultValue(true) + .build(); + + public LambdaCanBeMethodReferenceRule() { + super(ASTLambdaExpression.class); + definePropertyDescriptor(REPORT_IF_MAY_NPE); + } + + @Override + public Object visit(ASTLambdaExpression node, Object data) { + if (node.isExpressionBody()) { + // Note: we on purpose do not even try on block-bodied lambdas. + // Single-expression block bodies should be reported by another + // rule for transformation to an expression-body. + ASTExpression expression = node.getExpression(); + if (expression instanceof ASTMethodCall) { + ASTMethodCall call = (ASTMethodCall) expression; + if (canBeTransformed(call) && argumentsListMatches(call, node.getParameters())) { + asCtx(data).addViolation(node, buildMethodRefString(call)); + } + } + } + return null; + } + + private String buildMethodRefString(ASTMethodCall call) { + StringBuilder sb = new StringBuilder(); + ASTExpression qualifier = call.getQualifier(); + if (qualifier == null) { + OverloadSelectionResult info = call.getOverloadSelectionInfo(); + assert !info.isFailed() : "should not be failed: " + call; + boolean isStatic = info.getMethodType().isStatic(); + if (isStatic) { + JTypeDeclSymbol symbol = info.getMethodType().getDeclaringType().getSymbol(); + assert symbol != null + : "null symbol for " + info.getMethodType().getDeclaringType() + ", method " + info.getMethodType(); + sb.append(symbol.getSimpleName()); + } else { + sb.append("this"); + } + } else { + sb.append(PrettyPrintingUtil.prettyPrint(qualifier)); + } + sb.append("::").append(call.getMethodName()); + return sb.toString(); + } + + private boolean argumentsListMatches(ASTMethodCall call, ASTLambdaParameterList params) { + ASTArgumentList args = call.getArguments(); + if (args.size() != params.size()) { + return false; + } + for (int i = 0; i < args.size(); i++) { + ASTExpression arg = args.get(i); + ASTLambdaParameter parm = params.get(i); + if (!JavaAstUtils.isReferenceToVar(arg, parm.getVarId().getSymbol())) { + return false; + } + } + return true; + } + + private boolean canBeTransformed(ASTMethodCall call) { + ASTExpression qualifier = call.getQualifier(); + if (call.getOverloadSelectionInfo().isFailed()) { + // err on the side of FNs + return false; + } + if (qualifier instanceof ASTConstructorCall) { + // ctors may not be transformed because that would change semantics, + // with only one instance being created + return false; + } else if (qualifier instanceof ASTTypeExpression + || qualifier instanceof ASTSuperExpression + || qualifier instanceof ASTThisExpression + || qualifier instanceof ASTClassLiteral + || qualifier instanceof ASTLiteral + || qualifier == null) { + // these are always transformable + return true; + } + + return getProperty(REPORT_IF_MAY_NPE); + } + +} diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml index 64e20e3842..3f44745cd4 100644 --- a/pmd-java/src/main/resources/category/java/codestyle.xml +++ b/pmd-java/src/main/resources/category/java/codestyle.xml @@ -774,6 +774,26 @@ try { + + + + todo + + 3 + + + + + + + + Static referee, return type adapted int to void + 1 + 5 + + Lambda expression could be written as a method reference: `Foo::correct` + + correct(x)); // flag + int foo = 0; + iTakeLambda(x -> correct(foo)); // ok + } + public static int correct(int a) { + return 0; + } + } + + interface ALambda { + void doSomething(int a); + } + ]]> + + + self referee, return type adapted int to void + 1 + 5 + + Lambda expression could be written as a method reference: `this::correct` + + correct(x)); // flag + int foo = 0; + iTakeLambda(x -> correct(foo)); // ok + } + public int correct(int a) { + return 0; + } + } + + interface ALambda { + void doSomething(int a); + } + ]]> + + + cannot rewrite if qualifier is ctor call + 0 + new Foo().correct(x)); + } + public int correct(int a) { + return 0; + } + } + + interface ALambda { + void doSomething(int a); + } + ]]> + + + + + can rewrite many different qualifier types without NPE risk + 4 + > l) {} + static { + iTakeLambda(x -> "abc".indexOf(x)); + iTakeLambda(x -> this.correct(x)); + iTakeLambda(x -> Integer.valueOf(x)); + iTakeClass(x -> String.class.isAssignableFrom(x)); + } + public boolean correct(int a) { + return false; + } + } + + interface ALambda { + boolean doSomething(int a); + } + ]]> + + + test when method call is invalid + 0 + Integer.parseInt(x)); + } + public boolean correct(int a) { + return false; + } + } + + interface ALambda { + boolean doSomething(int a); + } + ]]> + + + + From b478c36d636fea8bdf9a771c23322545a2389885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 2 Apr 2024 20:17:46 +0200 Subject: [PATCH 003/142] support block lambdas --- .../LambdaCanBeMethodReferenceRule.java | 26 +++++++++++----- .../xml/LambdaCanBeMethodReference.xml | 30 +++++++++++++++++++ 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index 447bdb13f0..81db9b872d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -7,8 +7,11 @@ import net.sourceforge.pmd.lang.java.ast.ASTExpression; import net.sourceforge.pmd.lang.java.ast.ASTLambdaExpression; import net.sourceforge.pmd.lang.java.ast.ASTLambdaParameter; import net.sourceforge.pmd.lang.java.ast.ASTLambdaParameterList; +import net.sourceforge.pmd.lang.java.ast.ASTList; import net.sourceforge.pmd.lang.java.ast.ASTLiteral; import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; +import net.sourceforge.pmd.lang.java.ast.ASTReturnStatement; +import net.sourceforge.pmd.lang.java.ast.ASTStatement; import net.sourceforge.pmd.lang.java.ast.ASTSuperExpression; import net.sourceforge.pmd.lang.java.ast.ASTThisExpression; import net.sourceforge.pmd.lang.java.ast.ASTTypeExpression; @@ -19,6 +22,7 @@ import net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol; import net.sourceforge.pmd.lang.java.types.OverloadSelectionResult; import net.sourceforge.pmd.properties.PropertyDescriptor; import net.sourceforge.pmd.properties.PropertyFactory; +import net.sourceforge.pmd.reporting.RuleContext; public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { @@ -37,20 +41,26 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { @Override public Object visit(ASTLambdaExpression node, Object data) { if (node.isExpressionBody()) { - // Note: we on purpose do not even try on block-bodied lambdas. - // Single-expression block bodies should be reported by another - // rule for transformation to an expression-body. ASTExpression expression = node.getExpression(); - if (expression instanceof ASTMethodCall) { - ASTMethodCall call = (ASTMethodCall) expression; - if (canBeTransformed(call) && argumentsListMatches(call, node.getParameters())) { - asCtx(data).addViolation(node, buildMethodRefString(call)); - } + processLambdaWithBody(node, asCtx(data), expression); + } else { + ASTStatement onlyStmt = ASTList.singleOrNull(node.getBlock()); + if (onlyStmt instanceof ASTReturnStatement) { + processLambdaWithBody(node, asCtx(data), ((ASTReturnStatement) onlyStmt).getExpr()); } } return null; } + private void processLambdaWithBody(ASTLambdaExpression node, RuleContext data, ASTExpression expression) { + if (expression instanceof ASTMethodCall) { + ASTMethodCall call = (ASTMethodCall) expression; + if (canBeTransformed(call) && argumentsListMatches(call, node.getParameters())) { + data.addViolation(node, buildMethodRefString(call)); + } + } + } + private String buildMethodRefString(ASTMethodCall call) { StringBuilder sb = new StringBuilder(); ASTExpression qualifier = call.getQualifier(); diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml index 39e9d7d265..17064837f5 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml @@ -55,6 +55,36 @@ } ]]> + + Block lambda + 1 + 5 + + Lambda expression could be written as a method reference: `this::correct` + + { return correct(x); }); // flag + iTakeLambda(x ->{ if(x == 1) return correct(x); else return correct(x); }); // do not flag + iTakeLambda(x ->{ + foo(); + return correct(x); + }); // do not flag + iTakeLambda(x -> {}); + } + public int correct(int a) { + return 0; + } + } + + interface ALambda { + void doSomething(int a); + } + ]]> + cannot rewrite if qualifier is ctor call 0 From b16c8de4e00913a337dcab4f3c6ea88c9208dee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 2 Apr 2024 20:21:34 +0200 Subject: [PATCH 004/142] doc and release notes --- docs/pages/release_notes.md | 8 +++++ .../resources/category/java/codestyle.xml | 30 +++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 66173ccd69..3cf370a01c 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,6 +14,10 @@ This is a {{ site.pmd.release_type }} release. ### 🚀 New and noteworthy +#### New rules + +- The new Java rule {% rule "java/codestyle/LambdaCanBeMethodReference" %} reports lambda expressions that can be replaced with a method reference. Please read the documentation of the rule for more info. + ### 🐛 Fixed Issues * java-codestyle * [#4881](https://github.com/pmd/pmd/issues/4881): \[java] ClassNamingConventions: interfaces are identified as abstract classes (regression in 7.0.0) @@ -26,6 +30,10 @@ This is a {{ site.pmd.release_type }} release. ### 🚨 API Changes +#### Deprecated API + +- {% jdoc java::lang.java.ast.ASTLambdaExpression#getBlockBody() %} and {% jdoc java::lang.java.ast.ASTLambdaExpression#getExpressionBody() %} + ### ✨ External Contributions {% endtocmaker %} diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml index 3f44745cd4..3af23f7059 100644 --- a/pmd-java/src/main/resources/category/java/codestyle.xml +++ b/pmd-java/src/main/resources/category/java/codestyle.xml @@ -782,15 +782,35 @@ try { class="net.sourceforge.pmd.lang.java.rule.codestyle.LambdaCanBeMethodReferenceRule" externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#lambdacanbemethodreference"> - todo + This rule reports lambda expressions that can be written more succinctly as a method reference. This is the case if the lambda is an expression lambda that only calls one method, passing the entire lambda parameter list in order to the method. For instance: + ```java + x -> Foo.call(x) // can be Foo::call + x -> call(x) // can be this::call, if call is an instance method + (x, y, z) -> call(x, y, z) // can be this::call + () -> foo.get() // can be foo::get + x -> x.foo() // can be XType::foo (where XType is the type of x) + ``` + + In some cases rewriting a lambda to a method reference can change the semantics of the code. For instance in `(x) -> someVar.call(x)`, the invocation of the lambda may produce a NullPointerException (NPE) if `someVar` is null. The method reference `someVar::call` will also NPE if `someVar` is null, but it will do so at the point the method reference is created, while the lambda is created without error and its NPE is only thrown if the lambda is invoked (which may be never). Code should probably not rely on this subtle semantic difference, therefore these potentially problematic lambdas are also reported by default. This behavior can be disabled by setting the property `reportEvenIfMayNPE` to `false`. + + Scope limitations: + - This rule will not report lambdas of the form `x -> new CtorCall().something(x)`, because the semantics of the method reference would be to create a single new object, while the lambda creates one object per invocation. + - The rule cannot know if the qualifier of a method call performs side effects. This means `(x) -> sideEffectingMethod().foo(x)` will be reported. Suppress the warning in this case. 3 + import java.util.stream.Stream; + + public class LambdaCanBeMethodReference { + static { + Stream.of("abc", "d") + .mapToInt(s -> s.length()) // could be String::length + .reduce((x, y) -> Integer.sum(x, y)) // could be Integer::sum + .getAsInt(); + } + } + ]]> From 2e27fa631c740c4b6da8b98026a490fe7aeae067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 2 Apr 2024 20:30:58 +0200 Subject: [PATCH 005/142] Support method ref with first param as receiver --- .../LambdaCanBeMethodReferenceRule.java | 21 +++++++++++-- .../xml/LambdaCanBeMethodReference.xml | 30 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index 81db9b872d..5a3f271d1d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -19,12 +19,18 @@ import net.sourceforge.pmd.lang.java.ast.internal.JavaAstUtils; import net.sourceforge.pmd.lang.java.ast.internal.PrettyPrintingUtil; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; import net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol; +import net.sourceforge.pmd.lang.java.symbols.JVariableSymbol; import net.sourceforge.pmd.lang.java.types.OverloadSelectionResult; import net.sourceforge.pmd.properties.PropertyDescriptor; import net.sourceforge.pmd.properties.PropertyFactory; import net.sourceforge.pmd.reporting.RuleContext; public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { + // Note that this whole thing is mostly syntactic and does not take care of the details + // like (boxing) conversions, or when the method ref is ambiguous and the lambda is not. + // Maybe in a second pass we can check that the overload resolution would succeed + // with the method reference, similar to what UnnecessaryCastRule is doing. + private static final PropertyDescriptor REPORT_IF_MAY_NPE = PropertyFactory.booleanProperty("reportEvenIfMayNPE") @@ -85,12 +91,23 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { private boolean argumentsListMatches(ASTMethodCall call, ASTLambdaParameterList params) { ASTArgumentList args = call.getArguments(); - if (args.size() != params.size()) { + int start; + if (args.size() == params.size() - 1) { + // first parameter for the method call may be its receiver + start = 1; + JVariableSymbol firstParam = params.get(0).getVarId().getSymbol(); + if (!JavaAstUtils.isReferenceToVar(call.getQualifier(), firstParam)) { + return false; + } + } else if (args.size() == params.size()) { + start = 0; + } else { return false; } + for (int i = 0; i < args.size(); i++) { ASTExpression arg = args.get(i); - ASTLambdaParameter parm = params.get(i); + ASTLambdaParameter parm = params.get(i + start); if (!JavaAstUtils.isReferenceToVar(arg, parm.getVarId().getSymbol())) { return false; } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml index 17064837f5..366f712f4d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml @@ -153,5 +153,35 @@ ]]> + + Test when method ref is on receiver + 2 + x.isEmpty()); + iTakeLambda((x,c) -> x.contains(c)); + } + public boolean correct(int a) { + return false; + } + } + + interface ALambda { + boolean doSomething(String a, CharSequence c); + } + interface ALambda2 { + boolean doSomething(String a); + } + ]]> + + + + + From c511485f5f48e819483b17eb8900bf54ec664603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 3 Apr 2024 16:38:54 +0200 Subject: [PATCH 006/142] Mrefs without expr qualifier cannot NPE --- .../LambdaCanBeMethodReferenceRule.java | 43 +++++++------ .../xml/LambdaCanBeMethodReference.xml | 64 +++++++++++++++++++ 2 files changed, 89 insertions(+), 18 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index 5a3f271d1d..6205e5df7c 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -58,30 +58,32 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { return null; } - private void processLambdaWithBody(ASTLambdaExpression node, RuleContext data, ASTExpression expression) { + private void processLambdaWithBody(ASTLambdaExpression lambda, RuleContext data, ASTExpression expression) { if (expression instanceof ASTMethodCall) { ASTMethodCall call = (ASTMethodCall) expression; - if (canBeTransformed(call) && argumentsListMatches(call, node.getParameters())) { - data.addViolation(node, buildMethodRefString(call)); + if (canBeTransformed(lambda, call) && argumentsListMatches(call, lambda.getParameters())) { + data.addViolation(lambda, buildMethodRefString(lambda, call)); } } } - private String buildMethodRefString(ASTMethodCall call) { + private String buildMethodRefString(ASTLambdaExpression lambda, ASTMethodCall call) { StringBuilder sb = new StringBuilder(); ASTExpression qualifier = call.getQualifier(); - if (qualifier == null) { - OverloadSelectionResult info = call.getOverloadSelectionInfo(); - assert !info.isFailed() : "should not be failed: " + call; - boolean isStatic = info.getMethodType().isStatic(); - if (isStatic) { - JTypeDeclSymbol symbol = info.getMethodType().getDeclaringType().getSymbol(); - assert symbol != null - : "null symbol for " + info.getMethodType().getDeclaringType() + ", method " + info.getMethodType(); - sb.append(symbol.getSimpleName()); - } else { - sb.append("this"); - } + OverloadSelectionResult info = call.getOverloadSelectionInfo(); + assert !info.isFailed() : "should not be failed: " + call; + + if (qualifier == null && info.getMethodType().isStatic() + || lambda.getParameters().size() != call.getArguments().size()) { + // this second condition corresponds to the case the first lambda + // param is the receiver of the method call + + JTypeDeclSymbol symbol = info.getMethodType().getDeclaringType().getSymbol(); + assert symbol != null + : "null symbol for " + info.getMethodType().getDeclaringType() + ", method " + info.getMethodType(); + sb.append(symbol.getSimpleName()); + } else if (qualifier == null) { + sb.append("this"); } else { sb.append(PrettyPrintingUtil.prettyPrint(qualifier)); } @@ -92,7 +94,7 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { private boolean argumentsListMatches(ASTMethodCall call, ASTLambdaParameterList params) { ASTArgumentList args = call.getArguments(); int start; - if (args.size() == params.size() - 1) { + if (params.size() == args.size() + 1) { // first parameter for the method call may be its receiver start = 1; JVariableSymbol firstParam = params.get(0).getVarId().getSymbol(); @@ -115,7 +117,8 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { return true; } - private boolean canBeTransformed(ASTMethodCall call) { + // coarse check to filter out some stuff before checking call arguments + private boolean canBeTransformed(ASTLambdaExpression lambda, ASTMethodCall call) { ASTExpression qualifier = call.getQualifier(); if (call.getOverloadSelectionInfo().isFailed()) { // err on the side of FNs @@ -135,6 +138,10 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { return true; } + if (lambda.getParameters().size() == call.getArguments().size() + 1) { + return true; + } + return getProperty(REPORT_IF_MAY_NPE); } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml index 366f712f4d..5c46d6f20f 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml @@ -109,7 +109,14 @@ can rewrite many different qualifier types without NPE risk + false 4 + + Lambda expression could be written as a method reference: `"abc"::indexOf` + Lambda expression could be written as a method reference: `this::correct` + Lambda expression could be written as a method reference: `Integer::valueOf` + Lambda expression could be written as a method reference: `String.class::isAssignableFrom` + Test when method ref is on receiver 2 + + Lambda expression could be written as a method reference: `String::isEmpty` + Lambda expression could be written as a method reference: `String::contains` + + + foo().bar(x)); + iTakeLambda(x -> fooField.bar(x)); + // this also may not NPE because it will be converted to String::contains + iTakeLambda((x,c) -> x.contains(c)); + } + public boolean correct(int a) { + return false; + } + static Foo foo() { return new Foo(); } + boolean bar(String x) { return true; } + static Foo fooField; + } + + interface ALambda { + boolean doSomething(String a, CharSequence c); + } + interface ALambda2 { + boolean doSomething(String a); + } + ]]> + + + + + Risk of NPE (report == false) + false + 1 + + Lambda expression could be written as a method reference: `String::contains` + + + + + + Risk of NPE (report == true) + true + 3 + + Lambda expression could be written as a method reference: `foo()::bar` + Lambda expression could be written as a method reference: `fooField::bar` + Lambda expression could be written as a method reference: `String::contains` + + + + From 955ccbf55c20e8dd80302ce3f80d6a798d4a21ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 3 Apr 2024 18:02:40 +0200 Subject: [PATCH 007/142] pmd warning --- .../java/rule/codestyle/LambdaCanBeMethodReferenceRule.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index 6205e5df7c..658ce36827 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -138,11 +138,9 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { return true; } - if (lambda.getParameters().size() == call.getArguments().size() + 1) { - return true; - } + return lambda.getParameters().size() == call.getArguments().size() + 1 + || getProperty(REPORT_IF_MAY_NPE); - return getProperty(REPORT_IF_MAY_NPE); } } From e32b94af3fd81edaf34fac2ee99b7a40ac68cd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 3 Apr 2024 19:03:31 +0200 Subject: [PATCH 008/142] Change defaults of the rule and ignore method calls --- .../LambdaCanBeMethodReferenceRule.java | 26 +++++-- .../resources/category/java/codestyle.xml | 4 +- .../xml/LambdaCanBeMethodReference.xml | 70 +++++++++++++++++-- 3 files changed, 87 insertions(+), 13 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index 658ce36827..4cf12824dc 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -32,16 +32,25 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { // with the method reference, similar to what UnnecessaryCastRule is doing. - private static final PropertyDescriptor REPORT_IF_MAY_NPE = - PropertyFactory.booleanProperty("reportEvenIfMayNPE") - .desc("Also report those expressions that may throw a null pointer exception (NPE) when converted to a method reference. " + private static final PropertyDescriptor IGNORE_IF_MAY_NPE = + PropertyFactory.booleanProperty("ignoreIfMayNPE") + .desc("Ignore lambdas that may throw a null pointer exception (NPE) when converted to a method reference. " + "Those expressions will NPE at mref creation time, while the equivalent lambda would NPE only when invoked (which may be never).") + .defaultValue(false) + .build(); + + + private static final PropertyDescriptor IGNORE_IF_RECEIVER_IS_METHOD = + PropertyFactory.booleanProperty("ignoreIfReceiverIsMethod") + .desc("Ignore if the receiver of the method reference is a method call. " + + "These may cause side effects that often should prevent the conversion to a method reference.") .defaultValue(true) .build(); public LambdaCanBeMethodReferenceRule() { super(ASTLambdaExpression.class); - definePropertyDescriptor(REPORT_IF_MAY_NPE); + definePropertyDescriptor(IGNORE_IF_MAY_NPE); + definePropertyDescriptor(IGNORE_IF_RECEIVER_IS_METHOD); } @Override @@ -138,8 +147,13 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { return true; } - return lambda.getParameters().size() == call.getArguments().size() + 1 - || getProperty(REPORT_IF_MAY_NPE); + boolean isIgnoredBecauseOfMethodCall = + qualifier instanceof ASTMethodCall && getProperty(IGNORE_IF_RECEIVER_IS_METHOD); + + // if call uses first lambda parm as receiver, then the mref may not npe at creation time + boolean mayNPE = lambda.getParameters().size() == call.getArguments().size(); + boolean isIgnoredBecauseOfNPE = mayNPE && getProperty(IGNORE_IF_MAY_NPE); + return !isIgnoredBecauseOfNPE && !isIgnoredBecauseOfMethodCall; } diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml index 3af23f7059..bd8f3c1821 100644 --- a/pmd-java/src/main/resources/category/java/codestyle.xml +++ b/pmd-java/src/main/resources/category/java/codestyle.xml @@ -791,7 +791,9 @@ try { x -> x.foo() // can be XType::foo (where XType is the type of x) ``` - In some cases rewriting a lambda to a method reference can change the semantics of the code. For instance in `(x) -> someVar.call(x)`, the invocation of the lambda may produce a NullPointerException (NPE) if `someVar` is null. The method reference `someVar::call` will also NPE if `someVar` is null, but it will do so at the point the method reference is created, while the lambda is created without error and its NPE is only thrown if the lambda is invoked (which may be never). Code should probably not rely on this subtle semantic difference, therefore these potentially problematic lambdas are also reported by default. This behavior can be disabled by setting the property `reportEvenIfMayNPE` to `false`. + In some cases rewriting a lambda to a method reference can change the semantics of the code. For instance in `(x) -> someVar.call(x)`, the invocation of the lambda may produce a NullPointerException (NPE) if `someVar` is null. The method reference `someVar::call` will also NPE if `someVar` is null, but it will do so at the point the method reference is created, while the lambda is created without error and its NPE is only thrown if the lambda is invoked (which may be never). Code should probably not rely on this subtle semantic difference, therefore these potentially problematic lambdas are also reported by default. This behavior can be disabled by setting the property `ignoreIfMayNPE` to `true`. + + The property `ignoreIfMayNPE` is true by default. By default, calls whose receiver is itself a method call are ignored, because they could cause side effects. This may be changed by setting the property `ignoreIfReceiverIsMethod` to `false`. Scope limitations: - This rule will not report lambdas of the form `x -> new CtorCall().something(x)`, because the semantics of the method reference would be to create a single new object, while the lambda creates one object per invocation. diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml index 5c46d6f20f..ec9bb5e19c 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml @@ -106,10 +106,45 @@ ]]> + + foo().correct(x)); + } + public int correct(int a) { + return 0; + } + static Foo foo() { return new Foo(); } + } + + interface ALambda { + void doSomething(int a); + } + ]]> + + + + Ignore methods by default + 0 + + + + Property to consider methods + false + 1 + + Lambda expression could be written as a method reference: `foo()::correct` + + + + can rewrite many different qualifier types without NPE risk - false + true 4 Lambda expression could be written as a method reference: `"abc"::indexOf` @@ -223,8 +258,9 @@ - Risk of NPE (report == false) - false + Risk of NPE, ignore = true + true + true 1 Lambda expression could be written as a method reference: `String::contains` @@ -233,8 +269,31 @@ - Risk of NPE (report == true) - true + Risk of NPE, ignore = false + false + true + 2 + + Lambda expression could be written as a method reference: `fooField::bar` + Lambda expression could be written as a method reference: `String::contains` + + + + + Risk of NPE, ignore = true, ignore method = false + true + false + 1 + + Lambda expression could be written as a method reference: `String::contains` + + + + + + Risk of NPE, ignore npe = false, dont ignore methods + false + false 3 Lambda expression could be written as a method reference: `foo()::bar` @@ -247,5 +306,4 @@ - From e03ff543938ca7c5f753501b583b8ffb692ac8d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 3 Apr 2024 22:03:17 +0200 Subject: [PATCH 009/142] fix pretty printing --- .../java/ast/internal/PrettyPrintingUtil.java | 52 ++++++++++++++++--- .../LambdaCanBeMethodReferenceRule.java | 10 +++- .../ast/internal/PrettyPrintingUtilTest.java | 17 ++++++ .../xml/LambdaCanBeMethodReference.xml | 5 +- 4 files changed, 74 insertions(+), 10 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java index a208983805..1a7fc5ad81 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java @@ -7,6 +7,7 @@ package net.sourceforge.pmd.lang.java.ast.internal; import static net.sourceforge.pmd.util.AssertionUtil.shouldNotReachHere; import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import net.sourceforge.pmd.lang.java.ast.ASTAmbiguousName; import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration; @@ -22,6 +23,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTExecutableDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTExpression; import net.sourceforge.pmd.lang.java.ast.ASTFieldAccess; import net.sourceforge.pmd.lang.java.ast.ASTFieldDeclaration; +import net.sourceforge.pmd.lang.java.ast.ASTForInit; import net.sourceforge.pmd.lang.java.ast.ASTFormalParameter; import net.sourceforge.pmd.lang.java.ast.ASTFormalParameters; import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration; @@ -30,6 +32,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTList; import net.sourceforge.pmd.lang.java.ast.ASTLiteral; import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; +import net.sourceforge.pmd.lang.java.ast.ASTMethodReference; import net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression; import net.sourceforge.pmd.lang.java.ast.ASTPrimitiveType; import net.sourceforge.pmd.lang.java.ast.ASTRecordDeclaration; @@ -122,10 +125,10 @@ public final class PrettyPrintingUtil { } } else if (t instanceof ASTUnionType) { CollectionUtil.joinOn(sb, ((ASTUnionType) t).getComponents(), - PrettyPrintingUtil::prettyPrintTypeNode, " | "); + PrettyPrintingUtil::prettyPrintTypeNode, " | "); } else if (t instanceof ASTIntersectionType) { CollectionUtil.joinOn(sb, ((ASTIntersectionType) t).getComponents(), - PrettyPrintingUtil::prettyPrintTypeNode, " & "); + PrettyPrintingUtil::prettyPrintTypeNode, " & "); } else if (t instanceof ASTAmbiguousName) { sb.append(((ASTAmbiguousName) t).getName()); } else { @@ -249,6 +252,7 @@ public final class PrettyPrintingUtil { @Override public Void visitJavaNode(JavaNode node, StringBuilder data) { + data.append("<>"); return null; // don't recurse } @@ -326,9 +330,16 @@ public final class PrettyPrintingUtil { return null; } + @Override + public Void visit(ASTAmbiguousName node, StringBuilder data) { + data.append(node.getName()); + return null; + } + @Override public Void visit(ASTMethodCall node, StringBuilder sb) { addQualifier(node, sb); + ppTypeArgs(sb, node.getExplicitTypeArguments()); sb.append(node.getMethodName()); if (node.getArguments().isEmpty()) { sb.append("()"); @@ -351,15 +362,28 @@ public final class PrettyPrintingUtil { return null; } + @Override + public Void visit(ASTMethodReference node, StringBuilder sb) { + ppMaybeInParens(sb, node.getQualifier()); + sb.append("::"); + ppTypeArgs(sb, node.getExplicitTypeArguments()); + sb.append(node.getMethodName()); + return null; + } + + private void ppMaybeInParens(StringBuilder sb, ASTExpression qualifier) { + if (!(qualifier instanceof ASTPrimaryExpression)) { + ppInParens(sb, qualifier); + } else { + qualifier.acceptVisitor(this, sb); + } + } + private void addQualifier(QualifiableExpression node, StringBuilder data) { ASTExpression qualifier = node.getQualifier(); if (qualifier != null) { - if (!(qualifier instanceof ASTPrimaryExpression)) { - ppInParens(data, qualifier); - } else { - qualifier.acceptVisitor(this, data); - } + ppMaybeInParens(data, qualifier); data.append('.'); } @@ -371,6 +395,20 @@ public final class PrettyPrintingUtil { return data.append(')'); } + + private void ppTypeArgs(StringBuilder data, @Nullable ASTTypeArguments targs) { + if (targs == null) { + return; + } + data.append('<'); + prettyPrintTypeNode(data, targs.get(0)); + for (int i = 1; i < targs.size(); i++) { + data.append(", "); + prettyPrintTypeNode(data, targs.get(i)); + } + data.append('>'); + } + } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index 4cf12824dc..57ce46a8d5 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -10,6 +10,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTLambdaParameterList; import net.sourceforge.pmd.lang.java.ast.ASTList; import net.sourceforge.pmd.lang.java.ast.ASTLiteral; import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; +import net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression; import net.sourceforge.pmd.lang.java.ast.ASTReturnStatement; import net.sourceforge.pmd.lang.java.ast.ASTStatement; import net.sourceforge.pmd.lang.java.ast.ASTSuperExpression; @@ -94,7 +95,14 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { } else if (qualifier == null) { sb.append("this"); } else { + boolean needsParentheses = !(qualifier instanceof ASTPrimaryExpression); + if (needsParentheses) { + sb.append('('); + } sb.append(PrettyPrintingUtil.prettyPrint(qualifier)); + if (needsParentheses) { + sb.append(')'); + } } sb.append("::").append(call.getMethodName()); return sb.toString(); @@ -128,7 +136,7 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { // coarse check to filter out some stuff before checking call arguments private boolean canBeTransformed(ASTLambdaExpression lambda, ASTMethodCall call) { - ASTExpression qualifier = call.getQualifier(); + ASTExpression qualifier = JavaAstUtils.peelCasts(call.getQualifier()); if (call.getOverloadSelectionInfo().isFailed()) { // err on the side of FNs return false; diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java index 115c9cbfc7..5d2a31dafc 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java @@ -21,6 +21,7 @@ import net.sourceforge.pmd.lang.java.BaseParserTest; import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; +import net.sourceforge.pmd.lang.java.ast.ASTMethodReference; import net.sourceforge.pmd.util.StringUtil; class PrettyPrintingUtilTest extends BaseParserTest { @@ -59,6 +60,22 @@ class PrettyPrintingUtilTest extends BaseParserTest { assertThat(prettyPrint(m), contentEquals("((Object) this).foo(12)")); } + @Test + void ppMethodRef() { + ASTCompilationUnit root = java.parse("class A { { foo(ASTW::meth); } }"); + @NonNull ASTMethodReference m = root.descendants(ASTMethodReference.class).firstOrThrow(); + + assertThat(prettyPrint(m), contentEquals("ASTW::meth")); + } + + @Test + void ppMethodRefWithTyArgs() { + ASTCompilationUnit root = java.parse("class A { { foo(ASTW::meth); } }"); + @NonNull ASTMethodReference m = root.descendants(ASTMethodReference.class).firstOrThrow(); + + assertThat(prettyPrint(m), contentEquals("ASTW::meth")); + } + private static Matcher contentEquals(String str) { return new BaseMatcher() { @Override diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml index ec9bb5e19c..fab395cf60 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml @@ -233,8 +233,8 @@ public static void iTakeLambda(ALambda l) {} public static void iTakeLambda(ALambda2 l) {} static { - // parseInt(int) does not exist iTakeLambda(x -> foo().bar(x)); + iTakeLambda(x -> ((Foo) foo()).bar(x)); iTakeLambda(x -> fooField.bar(x)); // this also may not NPE because it will be converted to String::contains iTakeLambda((x,c) -> x.contains(c)); @@ -294,9 +294,10 @@ Risk of NPE, ignore npe = false, dont ignore methods false false - 3 + 4 Lambda expression could be written as a method reference: `foo()::bar` + Lambda expression could be written as a method reference: `((Foo) foo())::bar` Lambda expression could be written as a method reference: `fooField::bar` Lambda expression could be written as a method reference: `String::contains` From af3d0a34f14b454730b7b34222ee89a4fe5a5ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 3 Apr 2024 22:54:41 +0200 Subject: [PATCH 010/142] Fix pretty printing ctor --- .../java/ast/internal/PrettyPrintingUtil.java | 22 ++++++++++++++++--- .../ast/internal/PrettyPrintingUtilTest.java | 9 ++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java index 1a7fc5ad81..06338e5a1b 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java @@ -11,12 +11,14 @@ import org.checkerframework.checker.nullness.qual.Nullable; import net.sourceforge.pmd.lang.java.ast.ASTAmbiguousName; import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration; +import net.sourceforge.pmd.lang.java.ast.ASTArgumentList; import net.sourceforge.pmd.lang.java.ast.ASTArrayAccess; import net.sourceforge.pmd.lang.java.ast.ASTArrayType; import net.sourceforge.pmd.lang.java.ast.ASTCastExpression; import net.sourceforge.pmd.lang.java.ast.ASTClassDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassLiteral; import net.sourceforge.pmd.lang.java.ast.ASTClassType; +import net.sourceforge.pmd.lang.java.ast.ASTConstructorCall; import net.sourceforge.pmd.lang.java.ast.ASTConstructorDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTEnumDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTExecutableDeclaration; @@ -341,13 +343,28 @@ public final class PrettyPrintingUtil { addQualifier(node, sb); ppTypeArgs(sb, node.getExplicitTypeArguments()); sb.append(node.getMethodName()); - if (node.getArguments().isEmpty()) { + ppArguments(sb, node.getArguments()); + return null; + } + + @Override + public Void visit(ASTConstructorCall node, StringBuilder sb) { + addQualifier(node, sb); + sb.append("new "); + ppTypeArgs(sb, node.getExplicitTypeArguments()); + prettyPrintTypeNode(sb, node.getTypeNode()); + ppArguments(sb, node.getArguments()); + return null; + } + + private void ppArguments(StringBuilder sb, ASTArgumentList arguments) { + if (arguments.isEmpty()) { sb.append("()"); } else { final int argStart = sb.length(); sb.append('('); boolean first = true; - for (ASTExpression arg : node.getArguments()) { + for (ASTExpression arg : arguments) { if (sb.length() - argStart >= MAX_ARG_LENGTH) { sb.append("..."); break; @@ -359,7 +376,6 @@ public final class PrettyPrintingUtil { } sb.append(')'); } - return null; } @Override diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java index 5d2a31dafc..58b14a8b46 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.Test; import net.sourceforge.pmd.lang.java.BaseParserTest; import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; +import net.sourceforge.pmd.lang.java.ast.ASTConstructorCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTMethodReference; @@ -68,6 +69,14 @@ class PrettyPrintingUtilTest extends BaseParserTest { assertThat(prettyPrint(m), contentEquals("ASTW::meth")); } + @Test + void ppCtorCall() { + ASTCompilationUnit root = java.parse("class A { { new Foo(1); } }"); + @NonNull ASTConstructorCall m = root.descendants(ASTConstructorCall.class).firstOrThrow(); + + assertThat(prettyPrint(m), contentEquals("new Foo(1)")); + } + @Test void ppMethodRefWithTyArgs() { ASTCompilationUnit root = java.parse("class A { { foo(ASTW::meth); } }"); From 09eefeac19d9ce3a6a2b84ab251c5921441bebe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 3 Apr 2024 22:58:10 +0200 Subject: [PATCH 011/142] Revert changes to pretty printing --- .../java/ast/internal/PrettyPrintingUtil.java | 72 +++---------------- .../ast/internal/PrettyPrintingUtilTest.java | 26 ------- 2 files changed, 9 insertions(+), 89 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java index 06338e5a1b..a208983805 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java @@ -7,25 +7,21 @@ package net.sourceforge.pmd.lang.java.ast.internal; import static net.sourceforge.pmd.util.AssertionUtil.shouldNotReachHere; import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import net.sourceforge.pmd.lang.java.ast.ASTAmbiguousName; import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration; -import net.sourceforge.pmd.lang.java.ast.ASTArgumentList; import net.sourceforge.pmd.lang.java.ast.ASTArrayAccess; import net.sourceforge.pmd.lang.java.ast.ASTArrayType; import net.sourceforge.pmd.lang.java.ast.ASTCastExpression; import net.sourceforge.pmd.lang.java.ast.ASTClassDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTClassLiteral; import net.sourceforge.pmd.lang.java.ast.ASTClassType; -import net.sourceforge.pmd.lang.java.ast.ASTConstructorCall; import net.sourceforge.pmd.lang.java.ast.ASTConstructorDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTEnumDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTExecutableDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTExpression; import net.sourceforge.pmd.lang.java.ast.ASTFieldAccess; import net.sourceforge.pmd.lang.java.ast.ASTFieldDeclaration; -import net.sourceforge.pmd.lang.java.ast.ASTForInit; import net.sourceforge.pmd.lang.java.ast.ASTFormalParameter; import net.sourceforge.pmd.lang.java.ast.ASTFormalParameters; import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration; @@ -34,7 +30,6 @@ import net.sourceforge.pmd.lang.java.ast.ASTList; import net.sourceforge.pmd.lang.java.ast.ASTLiteral; import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; -import net.sourceforge.pmd.lang.java.ast.ASTMethodReference; import net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression; import net.sourceforge.pmd.lang.java.ast.ASTPrimitiveType; import net.sourceforge.pmd.lang.java.ast.ASTRecordDeclaration; @@ -127,10 +122,10 @@ public final class PrettyPrintingUtil { } } else if (t instanceof ASTUnionType) { CollectionUtil.joinOn(sb, ((ASTUnionType) t).getComponents(), - PrettyPrintingUtil::prettyPrintTypeNode, " | "); + PrettyPrintingUtil::prettyPrintTypeNode, " | "); } else if (t instanceof ASTIntersectionType) { CollectionUtil.joinOn(sb, ((ASTIntersectionType) t).getComponents(), - PrettyPrintingUtil::prettyPrintTypeNode, " & "); + PrettyPrintingUtil::prettyPrintTypeNode, " & "); } else if (t instanceof ASTAmbiguousName) { sb.append(((ASTAmbiguousName) t).getName()); } else { @@ -254,7 +249,6 @@ public final class PrettyPrintingUtil { @Override public Void visitJavaNode(JavaNode node, StringBuilder data) { - data.append("<>"); return null; // don't recurse } @@ -332,39 +326,17 @@ public final class PrettyPrintingUtil { return null; } - @Override - public Void visit(ASTAmbiguousName node, StringBuilder data) { - data.append(node.getName()); - return null; - } - @Override public Void visit(ASTMethodCall node, StringBuilder sb) { addQualifier(node, sb); - ppTypeArgs(sb, node.getExplicitTypeArguments()); sb.append(node.getMethodName()); - ppArguments(sb, node.getArguments()); - return null; - } - - @Override - public Void visit(ASTConstructorCall node, StringBuilder sb) { - addQualifier(node, sb); - sb.append("new "); - ppTypeArgs(sb, node.getExplicitTypeArguments()); - prettyPrintTypeNode(sb, node.getTypeNode()); - ppArguments(sb, node.getArguments()); - return null; - } - - private void ppArguments(StringBuilder sb, ASTArgumentList arguments) { - if (arguments.isEmpty()) { + if (node.getArguments().isEmpty()) { sb.append("()"); } else { final int argStart = sb.length(); sb.append('('); boolean first = true; - for (ASTExpression arg : arguments) { + for (ASTExpression arg : node.getArguments()) { if (sb.length() - argStart >= MAX_ARG_LENGTH) { sb.append("..."); break; @@ -376,30 +348,18 @@ public final class PrettyPrintingUtil { } sb.append(')'); } - } - - @Override - public Void visit(ASTMethodReference node, StringBuilder sb) { - ppMaybeInParens(sb, node.getQualifier()); - sb.append("::"); - ppTypeArgs(sb, node.getExplicitTypeArguments()); - sb.append(node.getMethodName()); return null; } - private void ppMaybeInParens(StringBuilder sb, ASTExpression qualifier) { - if (!(qualifier instanceof ASTPrimaryExpression)) { - ppInParens(sb, qualifier); - } else { - qualifier.acceptVisitor(this, sb); - } - } - private void addQualifier(QualifiableExpression node, StringBuilder data) { ASTExpression qualifier = node.getQualifier(); if (qualifier != null) { - ppMaybeInParens(data, qualifier); + if (!(qualifier instanceof ASTPrimaryExpression)) { + ppInParens(data, qualifier); + } else { + qualifier.acceptVisitor(this, data); + } data.append('.'); } @@ -411,20 +371,6 @@ public final class PrettyPrintingUtil { return data.append(')'); } - - private void ppTypeArgs(StringBuilder data, @Nullable ASTTypeArguments targs) { - if (targs == null) { - return; - } - data.append('<'); - prettyPrintTypeNode(data, targs.get(0)); - for (int i = 1; i < targs.size(); i++) { - data.append(", "); - prettyPrintTypeNode(data, targs.get(i)); - } - data.append('>'); - } - } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java index 58b14a8b46..115c9cbfc7 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtilTest.java @@ -19,10 +19,8 @@ import org.junit.jupiter.api.Test; import net.sourceforge.pmd.lang.java.BaseParserTest; import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; -import net.sourceforge.pmd.lang.java.ast.ASTConstructorCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; -import net.sourceforge.pmd.lang.java.ast.ASTMethodReference; import net.sourceforge.pmd.util.StringUtil; class PrettyPrintingUtilTest extends BaseParserTest { @@ -61,30 +59,6 @@ class PrettyPrintingUtilTest extends BaseParserTest { assertThat(prettyPrint(m), contentEquals("((Object) this).foo(12)")); } - @Test - void ppMethodRef() { - ASTCompilationUnit root = java.parse("class A { { foo(ASTW::meth); } }"); - @NonNull ASTMethodReference m = root.descendants(ASTMethodReference.class).firstOrThrow(); - - assertThat(prettyPrint(m), contentEquals("ASTW::meth")); - } - - @Test - void ppCtorCall() { - ASTCompilationUnit root = java.parse("class A { { new Foo(1); } }"); - @NonNull ASTConstructorCall m = root.descendants(ASTConstructorCall.class).firstOrThrow(); - - assertThat(prettyPrint(m), contentEquals("new Foo(1)")); - } - - @Test - void ppMethodRefWithTyArgs() { - ASTCompilationUnit root = java.parse("class A { { foo(ASTW::meth); } }"); - @NonNull ASTMethodReference m = root.descendants(ASTMethodReference.class).firstOrThrow(); - - assertThat(prettyPrint(m), contentEquals("ASTW::meth")); - } - private static Matcher contentEquals(String str) { return new BaseMatcher() { @Override From 8ed4d13a6daa6a9c3a744cfd79809fdee746d8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 4 Apr 2024 17:17:34 +0200 Subject: [PATCH 012/142] checkstyle --- .../rule/codestyle/LambdaCanBeMethodReferenceRule.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index 57ce46a8d5..f3bda21466 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -1,3 +1,7 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + package net.sourceforge.pmd.lang.java.rule.codestyle; import net.sourceforge.pmd.lang.java.ast.ASTArgumentList; @@ -43,8 +47,8 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { private static final PropertyDescriptor IGNORE_IF_RECEIVER_IS_METHOD = PropertyFactory.booleanProperty("ignoreIfReceiverIsMethod") - .desc("Ignore if the receiver of the method reference is a method call. " + - "These may cause side effects that often should prevent the conversion to a method reference.") + .desc("Ignore if the receiver of the method reference is a method call. " + + "These may cause side effects that often should prevent the conversion to a method reference.") .defaultValue(true) .build(); From 03b8d1acef9cae64db4fc1e0458f59756516af3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 5 Apr 2024 10:19:58 +0200 Subject: [PATCH 013/142] Fix #4912 - grammar for TWR allows this expression --- pmd-java/etc/grammar/Java.jjt | 4 ++-- .../pmd/lang/java/ast/ASTResource.java | 23 +++++++------------ .../java/ast/internal/PrettyPrintingUtil.java | 1 + .../pmd/lang/java/ast/ASTTryStatementTest.kt | 8 +++++++ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index c29ac79910..66277aea7d 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -2867,8 +2867,8 @@ void Resource() : PrimaryExpression() { Node top = jjtree.peekNode(); - if (!(top instanceof ASTVariableAccess || top instanceof ASTFieldAccess)) - throwParseException("Expected a variable access, but was a " + top.getXPathNodeName()); + if (!(top instanceof ASTVariableAccess || top instanceof ASTFieldAccess || top instanceof ASTThisExpression)) + throwParseException("Expected a variable or field access, but was a " + top.getXPathNodeName()); } {} } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTResource.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTResource.java index 008753c050..539f49d527 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTResource.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTResource.java @@ -7,6 +7,7 @@ package net.sourceforge.pmd.lang.java.ast; import org.checkerframework.checker.nullness.qual.Nullable; import net.sourceforge.pmd.lang.ast.Node; +import net.sourceforge.pmd.lang.java.ast.internal.PrettyPrintingUtil; /** * A resource of a {@linkplain ASTTryStatement try-with-resources}. This contains another @@ -48,24 +49,16 @@ public final class ASTResource extends AbstractJavaNode { * then returns the sequence of names that identifies the expression. * If this has a local variable declaration, then returns the name * of the variable. + * + *

Note that this might be null if the expression is too complex. + * + * @deprecated Since 7.1.0. This method is not very useful because the expression + * might be complex and not have a real "name". */ + @Deprecated public String getStableName() { if (isConciseResource()) { - ASTExpression expr = getInitializer(); - StringBuilder builder = new StringBuilder(); - while (expr instanceof ASTFieldAccess) { - ASTFieldAccess fa = (ASTFieldAccess) expr; - builder.insert(0, "." + fa.getName()); - expr = fa.getQualifier(); - } - // the last one may be ambiguous, or a variable reference - // the only common interface we have to get their name is - // unfortunately Node::getImage - - if (expr != null) { - builder.insert(0, expr.getImage()); - } - return builder.toString(); + return PrettyPrintingUtil.prettyPrint(getInitializer()).toString(); } else { return asLocalVariableDeclaration().iterator().next().getName(); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java index 8f686942c5..2db8d737eb 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java @@ -241,6 +241,7 @@ public final class PrettyPrintingUtil { } + /** Pretty print an expression or any other kind of node. */ public static CharSequence prettyPrint(JavaNode node) { StringBuilder sb = new StringBuilder(); node.acceptVisitor(new ExprPrinter(), sb); diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt index ad2c6a3682..89b98ce250 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt @@ -132,8 +132,16 @@ class ASTTryStatementTest : ParserTestSpec({ } } + // the expr must be a field access or var access "try ( a.foo() ){}" shouldNot parse() "try (new Foo()){}" shouldNot parse() + "try(arr[0]) {}" shouldNot parse() + + "try ( a.foo().b ){}" should parse() + "try (new Foo().x){}" should parse() + // this is also allowed by javac + "try(this) {}" should parse() + "try(Foo.this) {}" should parse() } } From e636c206f063014ffaf0601d9da9e2412bbc70dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 5 Apr 2024 16:35:09 +0200 Subject: [PATCH 014/142] Doc --- .../java/net/sourceforge/pmd/lang/java/ast/ASTResource.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTResource.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTResource.java index 539f49d527..577c28d17d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTResource.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTResource.java @@ -50,10 +50,9 @@ public final class ASTResource extends AbstractJavaNode { * If this has a local variable declaration, then returns the name * of the variable. * - *

Note that this might be null if the expression is too complex. - * * @deprecated Since 7.1.0. This method is not very useful because the expression - * might be complex and not have a real "name". + * might be complex and not have a real "name". In this case we return the + * expression pretty printed. */ @Deprecated public String getStableName() { From eccd99bfd624203ab801f612fda383d16ae745f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 5 Apr 2024 16:36:48 +0200 Subject: [PATCH 015/142] release notes --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index cdc04217b8..e53ba6d38c 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -28,6 +28,8 @@ This is a {{ site.pmd.release_type }} release. * [#4913](https://github.com/pmd/pmd/issues/4913): \[cli] cpd-gui closes immediately * apex-errorprone * [#3953](https://github.com/pmd/pmd/issues/3953): \[apex] EmptyCatchBlock false positive with formal (doc) comments +* java + * [#4912](https://github.com/pmd/pmd/issues/4912): \[java] Unable to parse some Java9+ resource references * java-bestpractices * [#1084](https://github.com/pmd/pmd/issues/1084): \[java] Allow JUnitTestsShouldIncludeAssert to configure verification methods * [#4435](https://github.com/pmd/pmd/issues/4435): \[java] \[7.0-rc1] UnusedAssignment for used field From 7b553300a1d296d7e68f35c186963722b2b6006c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 16 Apr 2024 13:35:57 +0200 Subject: [PATCH 016/142] Fix #4948 - abrupt completion of switch statement --- .../sourceforge/pmd/util/CollectionUtil.java | 12 +++ .../lang/java/rule/internal/DataflowPass.java | 90 +++++++++++++++++-- .../xml/ImplicitSwitchFallThrough.xml | 55 ++++++++++++ 3 files changed, 149 insertions(+), 8 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/util/CollectionUtil.java b/pmd-core/src/main/java/net/sourceforge/pmd/util/CollectionUtil.java index 9294c59a6b..9347de077c 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/util/CollectionUtil.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/util/CollectionUtil.java @@ -662,6 +662,18 @@ public final class CollectionUtil { } } + /** + * Union of two PSets, which avoids creating a new pset if possible. + */ + public static PSet union(PSet as, PSet bs) { + if (as.isEmpty()) { + return bs; + } else if (bs.isEmpty()) { + return as; + } + return as.plusAll(bs); + } + public static @NonNull List makeUnmodifiableAndNonNull(@Nullable List list) { if (list instanceof PSequence) { return (List) list; diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index 3ecdf964d4..5444866760 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -4,6 +4,8 @@ package net.sourceforge.pmd.lang.java.rule.internal; +import static net.sourceforge.pmd.util.CollectionUtil.asSingle; + import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; @@ -17,6 +19,8 @@ import java.util.Set; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.pcollections.HashTreePSet; +import org.pcollections.PSet; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.NodeStream; @@ -383,8 +387,17 @@ public final class DataflowPass { GlobalAlgoState global = data.global; SpanInfo before = acceptOpt(switchLike.getTestedExpression(), data); - global.breakTargets.push(before.fork()); + SpanInfo breakTarget = before.fork(); + global.breakTargets.push(breakTarget); + // If switch non-total then there is a path where the switch completes normally + // (value not matched). + boolean isTotal = switchLike.hasDefaultCase() + || !switchLike.isFallthroughSwitch() + || switchLike.isExhaustiveEnumSwitch(); + + PSet successors = HashTreePSet.empty(); + boolean allBranchesCompleteAbruptly = true; SpanInfo current = before; for (ASTSwitchBranch branch : switchLike.getBranches()) { if (branch instanceof ASTSwitchArrowBranch) { @@ -393,15 +406,37 @@ public final class DataflowPass { } else { // fallthrough branch current = acceptOpt(branch, before.fork().absorb(current)); - branch.getUserMap().set(SWITCH_BRANCH_FALLS_THROUGH, current.hasCompletedAbruptly.complement()); + OptionalBool isFallingThrough = current.hasCompletedAbruptly.complement(); + branch.getUserMap().set(SWITCH_BRANCH_FALLS_THROUGH, isFallingThrough); + successors = CollectionUtil.union(successors, current.abruptCompletionTargets); + allBranchesCompleteAbruptly &= current.hasCompletedAbruptly.isTrue(); + + if (isFallingThrough == OptionalBool.NO) { + current = before.fork(); + } } } before = global.breakTargets.pop(); + PSet<@Nullable SpanInfo> externalTargets = successors.minus(before); + OptionalBool switchCompletesAbruptly; + if (isTotal && allBranchesCompleteAbruptly && externalTargets.equals(successors)) { + // then all branches complete abruptly, and none of them because of a break to this switch + switchCompletesAbruptly = OptionalBool.YES; + } else if (successors.isEmpty() || asSingle(successors) == before) { + // then the branches complete normally, or they just break the switch + switchCompletesAbruptly = OptionalBool.NO; + } else { + switchCompletesAbruptly = OptionalBool.UNKNOWN; + } + // join with the last state, which is the exit point of the // switch, if it's not closed by a break; - return before.absorb(current); + SpanInfo result = before.absorb(current); + result.hasCompletedAbruptly = switchCompletesAbruptly; + result.abruptCompletionTargets = externalTargets; + return result; } @Override @@ -707,18 +742,21 @@ public final class DataflowPass { } SpanInfo result = popTargets(loop, breakTarget, continueTarget); - result = result.absorb(iter); + result.absorb(iter); if (checkFirstIter) { // if the first iteration is checked, // then it could be false on the first try, meaning // the definitions before the loop reach after too - result = result.absorb(before); + result.absorb(before); } if (foreachVar != null) { result.deleteVar(foreachVar.getSymbol()); } + // These targets are now obsolete + result.abruptCompletionTargets = result.abruptCompletionTargets.minus(breakTarget); + result.abruptCompletionTargets = result.abruptCompletionTargets.minus(continueTarget); return result; } @@ -787,7 +825,7 @@ public final class DataflowPass { @Override public SpanInfo visit(ASTReturnStatement node, SpanInfo data) { super.visit(node, data); - return data.abruptCompletion(null); + return data.abruptCompletion(data.global.abruptCompletionTarget); } // following deals with assignment @@ -1092,6 +1130,9 @@ public final class DataflowPass { // continue jumps to the condition check, while break jumps to after the loop final TargetStack continueTargets = new TargetStack(); + /** Sentinel to represent the target of a throw or return statement. */ + final SpanInfo abruptCompletionTarget = new SpanInfo(this); + private GlobalAlgoState(Set allAssignments, Set usedAssignments, Map> killRecord) { @@ -1162,8 +1203,32 @@ public final class DataflowPass { final GlobalAlgoState global; final Map symtable; + + /** + * Whether the current span completed abruptly. Abrupt + * completion occurs with break, continue, return or throw + * statements. A loop whose body completes abruptly may or + * may not complete abruptly itself. For instance in + *

{@code
+         * for (int i = 0; i < 5; i++) {
+         *     break;
+         * }
+         * }
+ * the loop body completes abruptly on all paths, but the loop + * itself completes normally. This is also the case in a switch + * statement where all cases are followed by a break. + */ private OptionalBool hasCompletedAbruptly = OptionalBool.NO; + /** + * Collects the abrupt completion targets of the current span. + * The value {@link GlobalAlgoState#abruptCompletionTarget} + * represents a return statement or a throw that + * is not followed by an enclosing finally block. + */ + private PSet abruptCompletionTargets = HashTreePSet.empty(); + + private SpanInfo(GlobalAlgoState global) { this(null, global, new LinkedHashMap<>()); } @@ -1340,13 +1405,15 @@ public final class DataflowPass { } /** Abrupt completion for return, continue, break. */ - SpanInfo abruptCompletion(SpanInfo target) { + SpanInfo abruptCompletion(@NonNull SpanInfo target) { // if target == null then this will unwind all the parents hasCompletedAbruptly = OptionalBool.YES; + SpanInfo parent = this; while (parent != target && parent != null) { // NOPMD CompareObjectsWithEqual this is what we want if (parent.myFinally != null) { parent.myFinally.absorb(this); + abruptCompletionTargets = abruptCompletionTargets.plus(parent); // stop on the first finally, its own end state will // be merged into the nearest enclosing finally return this; @@ -1354,6 +1421,8 @@ public final class DataflowPass { parent = parent.parent; } + abruptCompletionTargets = abruptCompletionTargets.plus(target); + this.symtable.clear(); return this; } @@ -1384,6 +1453,7 @@ public final class DataflowPass { if (!parent.myCatches.isEmpty()) { for (SpanInfo c : parent.myCatches) { c.absorb(this); + abruptCompletionTargets = abruptCompletionTargets.plus(c); } } @@ -1391,11 +1461,14 @@ public final class DataflowPass { // stop on the first finally, its own end state will // be merged into the nearest enclosing finally parent.myFinally.absorb(this); + abruptCompletionTargets = abruptCompletionTargets.plus(parent); return this; } parent = parent.parent; } + abruptCompletionTargets = abruptCompletionTargets.plus(global.abruptCompletionTarget); + if (!byMethodCall) { this.symtable.clear(); // following is dead code } @@ -1420,10 +1493,11 @@ public final class DataflowPass { CollectionUtil.mergeMaps(this.symtable, other.symtable, VarLocalInfo::merge); this.hasCompletedAbruptly = mergeCertitude(this.hasCompletedAbruptly, other.hasCompletedAbruptly); + this.abruptCompletionTargets = CollectionUtil.union(this.abruptCompletionTargets, other.abruptCompletionTargets); return this; } - private OptionalBool mergeCertitude(OptionalBool first, OptionalBool other) { + static OptionalBool mergeCertitude(OptionalBool first, OptionalBool other) { if (first.isKnown() && other.isKnown()) { return first == other ? first : OptionalBool.UNKNOWN; } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml index ce77c57423..80ea0e8411 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml @@ -422,4 +422,59 @@ record MyRecord(boolean b) { ]]>
+ + #4948 FP with nested switch stmt + 0 + + + + Switch with loop with break + 3 + 11,14,18 + + From b45e15a07e3cd2cd8e034f86f19dd3782f1dd584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 16 Apr 2024 18:58:52 +0200 Subject: [PATCH 017/142] Fix finally handling --- .../lang/java/rule/internal/DataflowPass.java | 32 ++++++++++--------- .../bestpractices/xml/UnusedAssignment.xml | 1 + 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index 5444866760..b1c3dae307 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -354,7 +354,7 @@ public final class DataflowPass { // next iteration SpanInfo state = data; - Set localsToKill = new LinkedHashSet<>(); + List localsToKill = new ArrayList<>(0); for (JavaNode child : node.children()) { // each output is passed as input to the next (most relevant for blocks) @@ -609,16 +609,23 @@ public final class DataflowPass { SpanInfo finalState; finalState = bodyState.absorb(exceptionalState); if (finallyClause != null) { - // this represents the finally clause when it was entered - // because of abrupt completion - // since we don't know when it terminated we must join it with before - SpanInfo abruptFinally = before.myFinally.absorb(before); - acceptOpt(finallyClause, abruptFinally); - before.myFinally = null; - abruptFinally.abruptCompletionByThrow(false); // propagate to enclosing catch/finallies + if (finalState.abruptCompletionTargets.contains(finalState.global.abruptCompletionTarget)) { + // this represents the finally clause when it was entered + // because of abrupt completion + // since we don't know when it terminated we must join it with before + SpanInfo abruptFinally = before.myFinally.absorb(before); + acceptOpt(finallyClause, abruptFinally); + before.myFinally = null; + // fixme this should be handled another way. Not all try blocks may throw. + abruptFinally.abruptCompletionByThrow(false); // propagate to enclosing catch/finallies + } // this is the normal finally finalState = acceptOpt(finallyClause, finalState); + // then all break targets are successors of the finally + for (SpanInfo target : finalState.abruptCompletionTargets) { + target.absorb(finalState); + } } // In the 7.0 grammar, the resources should be explicitly @@ -1406,14 +1413,13 @@ public final class DataflowPass { /** Abrupt completion for return, continue, break. */ SpanInfo abruptCompletion(@NonNull SpanInfo target) { - // if target == null then this will unwind all the parents hasCompletedAbruptly = OptionalBool.YES; + abruptCompletionTargets = abruptCompletionTargets.plus(target); SpanInfo parent = this; while (parent != target && parent != null) { // NOPMD CompareObjectsWithEqual this is what we want if (parent.myFinally != null) { parent.myFinally.absorb(this); - abruptCompletionTargets = abruptCompletionTargets.plus(parent); // stop on the first finally, its own end state will // be merged into the nearest enclosing finally return this; @@ -1421,8 +1427,6 @@ public final class DataflowPass { parent = parent.parent; } - abruptCompletionTargets = abruptCompletionTargets.plus(target); - this.symtable.clear(); return this; } @@ -1446,6 +1450,7 @@ public final class DataflowPass { if (!byMethodCall) { hasCompletedAbruptly = OptionalBool.YES; } + abruptCompletionTargets = abruptCompletionTargets.plus(global.abruptCompletionTarget); SpanInfo parent = this; while (parent != null) { @@ -1453,7 +1458,6 @@ public final class DataflowPass { if (!parent.myCatches.isEmpty()) { for (SpanInfo c : parent.myCatches) { c.absorb(this); - abruptCompletionTargets = abruptCompletionTargets.plus(c); } } @@ -1461,13 +1465,11 @@ public final class DataflowPass { // stop on the first finally, its own end state will // be merged into the nearest enclosing finally parent.myFinally.absorb(this); - abruptCompletionTargets = abruptCompletionTargets.plus(parent); return this; } parent = parent.parent; } - abruptCompletionTargets = abruptCompletionTargets.plus(global.abruptCompletionTarget); if (!byMethodCall) { this.symtable.clear(); // following is dead code diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml index 20b94fa9d5..1762a32772 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml @@ -2780,6 +2780,7 @@ public class Test { Catch in loop (reportUnusedVariables) true 6 + 9,11,18,19,25,34 Date: Tue, 16 Apr 2024 19:06:03 +0200 Subject: [PATCH 018/142] fix pmd warning --- .../sourceforge/pmd/lang/java/rule/internal/DataflowPass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index b1c3dae307..e5b196afae 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -424,7 +424,7 @@ public final class DataflowPass { if (isTotal && allBranchesCompleteAbruptly && externalTargets.equals(successors)) { // then all branches complete abruptly, and none of them because of a break to this switch switchCompletesAbruptly = OptionalBool.YES; - } else if (successors.isEmpty() || asSingle(successors) == before) { + } else if (successors.isEmpty() || asSingle(successors) == before) { // NOPMD CompareObjectsWithEqual this is what we want // then the branches complete normally, or they just break the switch switchCompletesAbruptly = OptionalBool.NO; } else { From 2f54938793957da0a87fe26e4f6fc8148412eaf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Wed, 17 Apr 2024 20:05:11 -0300 Subject: [PATCH 019/142] Add failing test case for #2438 --- .../pmd/lang/cpp/cpd/CppCpdTest.java | 42 +++++++++++++++++++ .../pmd/lang/cpp/cpd/testdata/ctype.c | 29 +++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java create mode 100644 pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/ctype.c diff --git a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java new file mode 100644 index 0000000000..635613908e --- /dev/null +++ b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java @@ -0,0 +1,42 @@ +package net.sourceforge.pmd.lang.cpp.cpd; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import net.sourceforge.pmd.cpd.CPDConfiguration; +import net.sourceforge.pmd.cpd.CpdAnalysis; +import net.sourceforge.pmd.cpd.Match; +import net.sourceforge.pmd.internal.util.IOUtil; +import net.sourceforge.pmd.lang.cpp.CppLanguageModule; + +public class CppCpdTest { + private Path testdir; + + @BeforeEach + void setUp() { + String path = IOUtil.normalizePath("src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata"); + testdir = Paths.get(path); + } + + @Test + void testIssue2438() throws Exception { + CPDConfiguration configuration = new CPDConfiguration(); + configuration.setMinimumTileSize(50); + configuration.setOnlyRecognizeLanguage(CppLanguageModule.getInstance()); + try (CpdAnalysis cpd = CpdAnalysis.create(configuration)) { + cpd.files().addFile(testdir.resolve("ctype.c")); + + cpd.performAnalysis(matches -> { + // There should only be 1 duplication, and it should be maximal + assertEquals(1, matches.getMatches().size()); + assertEquals(128, matches.getMatches().get(0).getTokenCount()); + }); + } + } +} diff --git a/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/ctype.c b/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/ctype.c new file mode 100644 index 0000000000..bf58aac5ad --- /dev/null +++ b/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/ctype.c @@ -0,0 +1,29 @@ +#include + +char _ctmp; +unsigned char _ctype[] = {0x00, /* EOF */ +_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ +_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ +_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ +_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ +_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ +_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ +_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ +_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ +_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ +_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ +_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ +_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ +_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ +_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ +_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ +_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */ + From f9cb7ab99281f6eadcfde48dfc6c948c6484db47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Wed, 17 Apr 2024 20:10:40 -0300 Subject: [PATCH 020/142] Ensure CPD matches are nonoverlapping maximals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The old implementation would fail on scenarios where duplicates exceed the minimum token window. In general, if we have 20 identical tokens, 1 different, and then the same 20 again, CPD would find the 20 at the beginning match the last 20… but also the 19 at the beginning match the last 19, the 18 at the beggining… down to the windows size --- .../sourceforge/pmd/cpd/MatchCollector.java | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java index b79ac5efbd..a9c3ea1d22 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java @@ -5,6 +5,8 @@ package net.sourceforge.pmd.cpd; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -12,7 +14,7 @@ import java.util.TreeMap; class MatchCollector { private final List matchList = new ArrayList<>(); - private final Map> matchTree = new TreeMap<>(); + private final Map> matchTree = new HashMap<>(); private final MatchAlgorithm ma; MatchCollector(MatchAlgorithm ma) { @@ -38,7 +40,7 @@ class MatchCollector { if (dupes < ma.getMinimumTileSize()) { continue; } - // is it still too close together + // both blocks overlap if (diff + dupes >= 1) { continue; } @@ -48,32 +50,37 @@ class MatchCollector { } private void reportMatch(TokenEntry mark1, TokenEntry mark2, int dupes) { - matchTree.compute(dupes, (dupCount, matches) -> { + matchTree.compute(mark1.getIndex(), (m1Index, matches) -> { if (matches == null) { - matches = new TreeMap<>(); - addNewMatch(mark1, mark2, dupCount, matches); + matches = new ArrayList<>(); + addNewMatch(mark1, mark2, dupes, matches); } else { - Match matchA = matches.get(mark1.getIndex()); - Match matchB = matches.get(mark2.getIndex()); + Iterator matchIterator = matches.iterator(); + while (matchIterator.hasNext()) { + Match m = matchIterator.next(); + TokenEntry otherEnd = m.getSecondMark().getToken(); - if (matchA == null && matchB == null) { - addNewMatch(mark1, mark2, dupes, matches); - } else if (matchA == null) { - matchB.addMark(mark1); - matches.put(mark1.getIndex(), matchB); - } else if (matchB == null) { - matchA.addMark(mark2); - matches.put(mark2.getIndex(), matchA); + // does the new match supersedes this one? + if (otherEnd.getIndex() < mark2.getIndex() && otherEnd.getIndex() + m.getTokenCount() >= mark2.getIndex() + dupes) { + // this match is embedded in the previous one… ignore it. + return matches; + } else if (mark2.getIndex() < otherEnd.getIndex() && mark2.getIndex() + dupes >= otherEnd.getIndex() + m.getTokenCount()) { + // the new match is longer and overlaps with the old one - replace it + matchIterator.remove(); + matchList.remove(m); + break; + } } + + addNewMatch(mark1, mark2, dupes, matches); } return matches; }); } - private void addNewMatch(TokenEntry mark1, TokenEntry mark2, int dupes, Map matches) { + private void addNewMatch(TokenEntry mark1, TokenEntry mark2, int dupes, List matches) { Match match = new Match(dupes, mark1, mark2); - matches.put(mark1.getIndex(), match); - matches.put(mark2.getIndex(), match); + matches.add(match); matchList.add(match); } From 9d043587078605aef31893d17658cec2d72fe1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Wed, 17 Apr 2024 23:36:49 -0300 Subject: [PATCH 021/142] Add a failing test for multiple exact matches --- .../pmd/lang/cpp/cpd/CppCpdTest.java | 17 +++++++++++++++++ .../cpp/cpd/testdata/multipleExactMatches.c | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/multipleExactMatches.c diff --git a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java index 635613908e..7285c35e2d 100644 --- a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java +++ b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java @@ -39,4 +39,21 @@ public class CppCpdTest { }); } } + + @Test + void testMultipleExactMatches() throws Exception { + CPDConfiguration configuration = new CPDConfiguration(); + configuration.setMinimumTileSize(40); + configuration.setOnlyRecognizeLanguage(CppLanguageModule.getInstance()); + try (CpdAnalysis cpd = CpdAnalysis.create(configuration)) { + cpd.files().addFile(testdir.resolve("multipleExactMatches.c")); + + cpd.performAnalysis(matches -> { + // There should only be 1 duplication, and it should be maximal + assertEquals(1, matches.getMatches().size()); + assertEquals(3, matches.getMatches().get(0).getMarkCount()); + assertEquals(41, matches.getMatches().get(0).getTokenCount()); + }); + } + } } diff --git a/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/multipleExactMatches.c b/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/multipleExactMatches.c new file mode 100644 index 0000000000..853655957e --- /dev/null +++ b/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/multipleExactMatches.c @@ -0,0 +1,12 @@ + +unsigned char _ctype[] = { 3, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +4 +}; \ No newline at end of file From 0282ee35839848ddbf4bd18c1bf0728e9346628e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Wed, 17 Apr 2024 23:37:12 -0300 Subject: [PATCH 022/142] Properly handle multiple matches once again --- .../sourceforge/pmd/cpd/MatchCollector.java | 82 ++++++++++++------- 1 file changed, 52 insertions(+), 30 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java index a9c3ea1d22..120e84f77f 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java @@ -6,15 +6,19 @@ package net.sourceforge.pmd.cpd; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.TreeMap; class MatchCollector { - private final List matchList = new ArrayList<>(); - private final Map> matchTree = new HashMap<>(); + private final Map> matchTree = new TreeMap<>(); + + private final Map> tokenMatchSets = new HashMap<>(); + private final MatchAlgorithm ma; MatchCollector(MatchAlgorithm ma) { @@ -50,42 +54,60 @@ class MatchCollector { } private void reportMatch(TokenEntry mark1, TokenEntry mark2, int dupes) { - matchTree.compute(mark1.getIndex(), (m1Index, matches) -> { - if (matches == null) { - matches = new ArrayList<>(); - addNewMatch(mark1, mark2, dupes, matches); - } else { - Iterator matchIterator = matches.iterator(); - while (matchIterator.hasNext()) { - Match m = matchIterator.next(); - TokenEntry otherEnd = m.getSecondMark().getToken(); + /* + * Check if the match is previously know. This can happen when a snippet is duplicated more than once. + * If A, B and C are identical snippets, MatchAlgorithm will find the matching pairs: + * - AB + * - AC + * - BC + * It should be reduced to a single match with 3 marks + */ + if (tokenMatchSets.computeIfAbsent(mark1.getIndex(), HashSet::new).contains(mark2.getIndex())) { + return; + } - // does the new match supersedes this one? - if (otherEnd.getIndex() < mark2.getIndex() && otherEnd.getIndex() + m.getTokenCount() >= mark2.getIndex() + dupes) { - // this match is embedded in the previous one… ignore it. - return matches; - } else if (mark2.getIndex() < otherEnd.getIndex() && mark2.getIndex() + dupes >= otherEnd.getIndex() + m.getTokenCount()) { - // the new match is longer and overlaps with the old one - replace it - matchIterator.remove(); - matchList.remove(m); - break; - } - } + List matches = matchTree.computeIfAbsent(mark1.getIndex(), ArrayList::new); + Iterator matchIterator = matches.iterator(); + while (matchIterator.hasNext()) { + Match m = matchIterator.next(); + TokenEntry otherEnd = m.getSecondMark().getToken(); // TODO : this only works for mark1 being the key - addNewMatch(mark1, mark2, dupes, matches); + // does the new match supersedes this one? + if (otherEnd.getIndex() < mark2.getIndex() && otherEnd.getIndex() + m.getTokenCount() >= mark2.getIndex() + dupes) { + // this match is embedded in the previous one… ignore it. + return; + } else if (mark2.getIndex() < otherEnd.getIndex() && mark2.getIndex() + dupes >= otherEnd.getIndex() + m.getTokenCount()) { + // the new match is longer and overlaps with the old one - replace it + matchIterator.remove(); + break; + } else if (dupes == m.getTokenCount()) { + // we found yet another exact match of the same snippet. Roll it together + + // Add this adjacency to all combinations + m.iterator().forEachRemaining(other -> registerTokenMatch(other.getToken(), mark2)); + + m.addMark(mark2); + return; } - return matches; - }); + } + + // this is a new match, add it + matches.add(new Match(dupes, mark1, mark2)); + + // add matches in both directions + registerTokenMatch(mark1, mark2); } - private void addNewMatch(TokenEntry mark1, TokenEntry mark2, int dupes, List matches) { - Match match = new Match(dupes, mark1, mark2); - matches.add(match); - matchList.add(match); + private void registerTokenMatch(TokenEntry mark1, TokenEntry mark2) { + tokenMatchSets.computeIfAbsent(mark1.getIndex(), HashSet::new).add(mark2.getIndex()); + tokenMatchSets.computeIfAbsent(mark2.getIndex(), HashSet::new).add(mark1.getIndex()); } List getMatches() { - return matchList; + return matchTree.values().stream().reduce(new ArrayList<>(), (acc, matches) -> { + acc.addAll(matches); + return acc; + }); } private boolean hasPreviousDupe(TokenEntry mark1, TokenEntry mark2) { From 1e0c9cd75933c31d075575748762c6e4de716f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 18 Apr 2024 00:37:27 -0300 Subject: [PATCH 023/142] Add more specific tests in core --- .../pmd/cpd/MatchAlgorithmTest.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/cpd/MatchAlgorithmTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/cpd/MatchAlgorithmTest.java index 2ddee6712a..8ba14d640d 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/cpd/MatchAlgorithmTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/cpd/MatchAlgorithmTest.java @@ -7,6 +7,7 @@ package net.sourceforge.pmd.cpd; import static net.sourceforge.pmd.util.CollectionUtil.listOf; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.util.Iterator; @@ -35,6 +36,18 @@ class MatchAlgorithmTest { + "\n" + LINE_7 + "\n" + LINE_8; } + private static String getMultipleRepetitionsCode() { + return "var x = [\n" + + " 1, 1, 1, 1, 1, 1, 1, 1,\n" + + " 0, 0, 0, 0, 0, 0, 0, 0,\n" + + " 2, 2, 2, 2, 2, 2, 2, 2,\n" + + " 0, 0, 0, 0, 0, 0, 0, 0,\n" + + " 3, 3, 3, 3, 3, 3, 3, 3,\n" + + " 0, 0, 0, 0, 0, 0, 0, 0,\n" + + " 4, 4, 4, 4, 4, 4, 4, 4\n" + + "];"; + } + @Test void testSimple() throws IOException { DummyLanguageModule dummy = DummyLanguageModule.getInstance(); @@ -65,4 +78,36 @@ class MatchAlgorithmTest { assertEquals(fileName, mark2.getLocation().getFileId()); assertEquals(LINE_4 + "\n", sourceManager.getSlice(mark2).toString()); } + + @Test + void testMultipleMatches() throws IOException { + DummyLanguageModule dummy = DummyLanguageModule.getInstance(); + CpdLexer cpdLexer = dummy.createCpdLexer(dummy.newPropertyBundle()); + FileId fileName = FileId.fromPathLikeString("Foo.dummy"); + TextFile textFile = TextFile.forCharSeq(getMultipleRepetitionsCode(), fileName, dummy.getDefaultVersion()); + SourceManager sourceManager = new SourceManager(listOf(textFile)); + Tokens tokens = new Tokens(); + TextDocument sourceCode = sourceManager.get(textFile); + CpdLexer.tokenize(cpdLexer, sourceCode, tokens); + + MatchAlgorithm matchAlgorithm = new MatchAlgorithm(tokens, 15); + List matches = matchAlgorithm.findMatches(new CPDNullListener(), sourceManager); + assertEquals(1, matches.size()); + Match match = matches.get(0); + + Iterator marks = match.iterator(); + Mark mark1 = marks.next(); + Mark mark2 = marks.next(); + assertTrue(marks.hasNext()); + Mark mark3 = marks.next(); + + assertEquals(2, mark1.getLocation().getStartLine()); + assertEquals(fileName, mark1.getLocation().getFileId()); + + assertEquals(4, mark2.getLocation().getStartLine()); + assertEquals(fileName, mark2.getLocation().getFileId()); + + assertEquals(6, mark3.getLocation().getStartLine()); + assertEquals(fileName, mark3.getLocation().getFileId()); + } } From be902e61e16e0763648796cf86f8b646e996f4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 18 Apr 2024 00:37:37 -0300 Subject: [PATCH 024/142] Fix newly found scenarios --- .../sourceforge/pmd/cpd/MatchCollector.java | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java index 120e84f77f..606c92b859 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java @@ -28,11 +28,16 @@ class MatchCollector { public void collect(List marks) { // first get a pairwise collection of all maximal matches for (int i = 0; i < marks.size() - 1; i++) { + int skipped = 0; TokenEntry mark1 = marks.get(i); for (int j = i + 1; j < marks.size(); j++) { TokenEntry mark2 = marks.get(j); int diff = mark1.getIndex() - mark2.getIndex(); if (-diff < ma.getMinimumTileSize()) { + // self-repeating sequence such as ABBABBABB with min 6, + // will match 2 against any other occurrence of ABBABB + // avoid duplicate overlapping reports by skipping it on the next outer loop + skipped++; continue; } if (hasPreviousDupe(mark1, mark2)) { @@ -50,6 +55,8 @@ class MatchCollector { } reportMatch(mark1, mark2, dupes); } + + i += skipped; } } @@ -66,28 +73,39 @@ class MatchCollector { return; } - List matches = matchTree.computeIfAbsent(mark1.getIndex(), ArrayList::new); + // This may not be a "new match", but actually a sub-match of a larger one. + // always rely on the lowest mark index, as that's the order in which process them + final int lowestKey = tokenMatchSets.get(mark1.getIndex()).stream().reduce(mark1.getIndex(), Math::min); + + List matches = matchTree.computeIfAbsent(lowestKey, ArrayList::new); Iterator matchIterator = matches.iterator(); while (matchIterator.hasNext()) { Match m = matchIterator.next(); - TokenEntry otherEnd = m.getSecondMark().getToken(); // TODO : this only works for mark1 being the key - // does the new match supersedes this one? - if (otherEnd.getIndex() < mark2.getIndex() && otherEnd.getIndex() + m.getTokenCount() >= mark2.getIndex() + dupes) { - // this match is embedded in the previous one… ignore it. - return; - } else if (mark2.getIndex() < otherEnd.getIndex() && mark2.getIndex() + dupes >= otherEnd.getIndex() + m.getTokenCount()) { - // the new match is longer and overlaps with the old one - replace it - matchIterator.remove(); - break; - } else if (dupes == m.getTokenCount()) { - // we found yet another exact match of the same snippet. Roll it together + // Check all other marks + for (Mark otherMark : m.getMarkSet()) { + TokenEntry otherEnd = otherMark.getToken(); + if (otherEnd.getIndex() == mark1.getIndex()) { + continue; + } - // Add this adjacency to all combinations - m.iterator().forEachRemaining(other -> registerTokenMatch(other.getToken(), mark2)); + // does the new match supersedes this one? + if (otherEnd.getIndex() < mark2.getIndex() && otherEnd.getIndex() + m.getTokenCount() >= mark2.getIndex() + dupes) { + // this match is embedded in the previous one… ignore it. + return; + } else if (mark2.getIndex() < otherEnd.getIndex() && mark2.getIndex() + dupes >= otherEnd.getIndex() + m.getTokenCount()) { + // the new match is longer and overlaps with the old one - replace it + matchIterator.remove(); + break; + } else if (dupes == m.getTokenCount()) { + // we found yet another exact match of the same snippet. Roll it together - m.addMark(mark2); - return; + // Add this adjacency to all combinations + m.iterator().forEachRemaining(other -> registerTokenMatch(other.getToken(), mark2)); + + m.addMark(mark2); + return; + } } } From e1ac7a13a287379054dc7652b0e068215511f40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 18 Apr 2024 00:54:29 -0300 Subject: [PATCH 025/142] Remove multiple occurrence test from cpp - This is superceded by a generic test in pmd-core --- .../pmd/lang/cpp/cpd/CppCpdTest.java | 17 ----------------- .../cpp/cpd/testdata/multipleExactMatches.c | 12 ------------ 2 files changed, 29 deletions(-) delete mode 100644 pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/multipleExactMatches.c diff --git a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java index 7285c35e2d..635613908e 100644 --- a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java +++ b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java @@ -39,21 +39,4 @@ public class CppCpdTest { }); } } - - @Test - void testMultipleExactMatches() throws Exception { - CPDConfiguration configuration = new CPDConfiguration(); - configuration.setMinimumTileSize(40); - configuration.setOnlyRecognizeLanguage(CppLanguageModule.getInstance()); - try (CpdAnalysis cpd = CpdAnalysis.create(configuration)) { - cpd.files().addFile(testdir.resolve("multipleExactMatches.c")); - - cpd.performAnalysis(matches -> { - // There should only be 1 duplication, and it should be maximal - assertEquals(1, matches.getMatches().size()); - assertEquals(3, matches.getMatches().get(0).getMarkCount()); - assertEquals(41, matches.getMatches().get(0).getTokenCount()); - }); - } - } } diff --git a/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/multipleExactMatches.c b/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/multipleExactMatches.c deleted file mode 100644 index 853655957e..0000000000 --- a/pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/multipleExactMatches.c +++ /dev/null @@ -1,12 +0,0 @@ - -unsigned char _ctype[] = { 3, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4 -}; \ No newline at end of file From 701e78e8fe69eee3b799537c7a53c31d31f8d0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 18 Apr 2024 01:02:01 -0300 Subject: [PATCH 026/142] Update changelog --- docs/pages/release_notes.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2df014843f..d92c3c7621 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,6 +14,12 @@ This is a {{ site.pmd.release_type }} release. ### 🚀 New and noteworthy +#### More robust CPD reports + +There were a number of circumstances, specially around (but not limited to) literal sequences, were CPD would report duplicate overlapping or partially overlapping matches. These have now been fixed, and CPD will report only the longest non-overlapping duplicate. + +These improvements apply to all supported languages, irrespective of supported flags. + ### 🌟 Rule Changes * {%rule java/bestpractices/JUnitTestsShouldIncludeAssert %} and {% rule java/bestpractices/JUnitTestContainsTooManyAsserts %} @@ -32,6 +38,8 @@ This is a {{ site.pmd.release_type }} release. * [#4418](https://github.com/pmd/pmd/issues/4418): \[apex] ASTAnnotation.getImage() does not return value as written in the class * apex-errorprone * [#3953](https://github.com/pmd/pmd/issues/3953): \[apex] EmptyCatchBlock false positive with formal (doc) comments +* cpp + * [#2438](https://github.com/pmd/pmd/issues/2438): \[cpp] Repeated Duplication blocks * java * [#4899](https://github.com/pmd/pmd/issues/4899): \[java] Parsing failed in ParseLock#doParse() java.io.IOException: Stream closed * [#4902](https://github.com/pmd/pmd/issues/4902): \[java] "Bad intersection, unrelated class types" for Constable\[] and Enum\[] From 8f6270d3b5163fc988f95a4751b73221ba8f309f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 18 Apr 2024 01:11:38 -0300 Subject: [PATCH 027/142] Style issues --- .../sourceforge/pmd/cpd/MatchCollector.java | 7 +++---- .../pmd/cpd/MatchAlgorithmTest.java | 18 +++++++++--------- .../pmd/lang/cpp/cpd/CppCpdTest.java | 6 ++++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java index 606c92b859..36c6e99c2f 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/MatchCollector.java @@ -27,8 +27,9 @@ class MatchCollector { public void collect(List marks) { // first get a pairwise collection of all maximal matches - for (int i = 0; i < marks.size() - 1; i++) { - int skipped = 0; + int skipped; + for (int i = 0; i < marks.size() - 1; i += skipped + 1) { + skipped = 0; TokenEntry mark1 = marks.get(i); for (int j = i + 1; j < marks.size(); j++) { TokenEntry mark2 = marks.get(j); @@ -55,8 +56,6 @@ class MatchCollector { } reportMatch(mark1, mark2, dupes); } - - i += skipped; } } diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/cpd/MatchAlgorithmTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/cpd/MatchAlgorithmTest.java index 8ba14d640d..5e2afca9b2 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/cpd/MatchAlgorithmTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/cpd/MatchAlgorithmTest.java @@ -37,15 +37,15 @@ class MatchAlgorithmTest { } private static String getMultipleRepetitionsCode() { - return "var x = [\n" + - " 1, 1, 1, 1, 1, 1, 1, 1,\n" + - " 0, 0, 0, 0, 0, 0, 0, 0,\n" + - " 2, 2, 2, 2, 2, 2, 2, 2,\n" + - " 0, 0, 0, 0, 0, 0, 0, 0,\n" + - " 3, 3, 3, 3, 3, 3, 3, 3,\n" + - " 0, 0, 0, 0, 0, 0, 0, 0,\n" + - " 4, 4, 4, 4, 4, 4, 4, 4\n" + - "];"; + return "var x = [\n" + + " 1, 1, 1, 1, 1, 1, 1, 1,\n" + + " 0, 0, 0, 0, 0, 0, 0, 0,\n" + + " 2, 2, 2, 2, 2, 2, 2, 2,\n" + + " 0, 0, 0, 0, 0, 0, 0, 0,\n" + + " 3, 3, 3, 3, 3, 3, 3, 3,\n" + + " 0, 0, 0, 0, 0, 0, 0, 0,\n" + + " 4, 4, 4, 4, 4, 4, 4, 4\n" + + "];"; } @Test diff --git a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java index 635613908e..2faef10bc5 100644 --- a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java +++ b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java @@ -1,7 +1,10 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + package net.sourceforge.pmd.lang.cpp.cpd; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import java.nio.file.Path; import java.nio.file.Paths; @@ -11,7 +14,6 @@ import org.junit.jupiter.api.Test; import net.sourceforge.pmd.cpd.CPDConfiguration; import net.sourceforge.pmd.cpd.CpdAnalysis; -import net.sourceforge.pmd.cpd.Match; import net.sourceforge.pmd.internal.util.IOUtil; import net.sourceforge.pmd.lang.cpp.CppLanguageModule; From 540076b26b2ba5c5c79980ec371e8cbe197c3de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 18 Apr 2024 01:22:32 -0300 Subject: [PATCH 028/142] PMD fixes --- .../test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java index 2faef10bc5..0496a37a82 100644 --- a/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java +++ b/pmd-cpp/src/test/java/net/sourceforge/pmd/lang/cpp/cpd/CppCpdTest.java @@ -17,7 +17,7 @@ import net.sourceforge.pmd.cpd.CpdAnalysis; import net.sourceforge.pmd.internal.util.IOUtil; import net.sourceforge.pmd.lang.cpp.CppLanguageModule; -public class CppCpdTest { +class CppCpdTest { private Path testdir; @BeforeEach From d9dcaaeb93a3b2ee6154103810c66165e252d0d5 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 18 Apr 2024 09:30:07 +0200 Subject: [PATCH 029/142] Bump maven-source-plugin from 3.3.0 to 3.3.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f5206fed9e..b447d55abc 100644 --- a/pom.xml +++ b/pom.xml @@ -361,7 +361,7 @@ org.apache.maven.plugins maven-source-plugin - 3.3.0 + 3.3.1 org.apache.maven.plugins From 4b14d4e7575348ce5ec9af02feac8d9c583c8284 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 18 Apr 2024 09:31:56 +0200 Subject: [PATCH 030/142] Use latest ant for maven-antrun-plugin This preserves the file permissions when doing a replaceregexp on a file. --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index b447d55abc..1a644d7024 100644 --- a/pom.xml +++ b/pom.xml @@ -159,6 +159,12 @@ javacc ${javacc.version} + + + org.apache.ant + ant + ${ant.version} + From 53aecb655d956a6a772be97ef8a37df63fce8dc2 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 18 Apr 2024 09:44:07 +0200 Subject: [PATCH 031/142] Exclude pmd-cli/pmd-dist from cyclonedx BOM This should make the bom.xml/bom.json files be reproducible again. --- pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pom.xml b/pom.xml index 1a644d7024..b25a6ab968 100644 --- a/pom.xml +++ b/pom.xml @@ -756,6 +756,18 @@ makeAggregateBom + + + + pmd-cli + pmd-dist + + From b42108d55a64598374edb24ab4f83f819b0fca90 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 18 Apr 2024 09:55:16 +0200 Subject: [PATCH 032/142] [doc] Update release notes (#4967) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2df014843f..29d0fc6ef7 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -58,6 +58,8 @@ This is a {{ site.pmd.release_type }} release. * [#4886](https://github.com/pmd/pmd/issues/4886): \[java] BigIntegerInstantiation: False Positive with Java 17 and BigDecimal.TWO * pom-errorprone * [#4388](https://github.com/pmd/pmd/issues/4388): \[pom] InvalidDependencyTypes doesn't consider dependencies at all +* misc + * [#4967](https://github.com/pmd/pmd/pull/4967): Fix reproducible build issues with 7.0.0 ### 🚨 API Changes From f8bf6d13b34e0bce3b422df720c0af8b1b2d43fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 18 Apr 2024 15:06:44 +0200 Subject: [PATCH 033/142] Support labeled statements properly --- .../lang/java/rule/internal/DataflowPass.java | 108 ++++++++++++------ .../bestpractices/xml/UnusedAssignment.xml | 95 +++++++++++++++ 2 files changed, 169 insertions(+), 34 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index e5b196afae..eb8baf099d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -16,6 +16,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.function.Supplier; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; @@ -441,7 +442,7 @@ public final class DataflowPass { @Override public SpanInfo visit(ASTIfStatement node, SpanInfo data) { - return makeConditional(data, node.getCondition(), node.getThenBranch(), node.getElseBranch()); + return processBreakableStmt(node, data, () -> makeConditional(data, node.getCondition(), node.getThenBranch(), node.getElseBranch())); } @Override @@ -545,12 +546,14 @@ public final class DataflowPass { @Override public SpanInfo visit(ASTSynchronizedStatement node, SpanInfo data) { - // visit lock expr and child block - SpanInfo body = super.visit(node, data); - // We should assume that all assignments may be observed by other threads - // at the end of the critical section. - useAllSelfFields(body, JavaAstUtils.isInStaticCtx(node), enclosingClassScope); - return body; + return processBreakableStmt(node, data, () -> { + // visit lock expr and child block + SpanInfo body = super.visit(node, data); + // We should assume that all assignments may be observed by other threads + // at the end of the critical section. + useAllSelfFields(body, JavaAstUtils.isInStaticCtx(node), enclosingClassScope); + return body; + }); } @Override @@ -577,37 +580,39 @@ public final class DataflowPass { */ ASTFinallyClause finallyClause = node.getFinallyClause(); - if (finallyClause != null) { - before.myFinally = before.forkEmpty(); - } + SpanInfo finalState = processBreakableStmt(node, before, () -> { - final List catchClauses = node.getCatchClauses().toList(); - final List catchSpans = catchClauses.isEmpty() ? Collections.emptyList() - : new ArrayList<>(); + if (finallyClause != null) { + before.myFinally = before.forkEmpty(); + } - // pre-fill catch spans - for (int i = 0; i < catchClauses.size(); i++) { - catchSpans.add(before.forkEmpty()); - } + final List catchClauses = node.getCatchClauses().toList(); + final List catchSpans = catchClauses.isEmpty() ? Collections.emptyList() + : new ArrayList<>(); - @Nullable ASTResourceList resources = node.getResources(); + // pre-fill catch spans + for (int i = 0; i < catchClauses.size(); i++) { + catchSpans.add(before.forkEmpty()); + } - SpanInfo bodyState = before.fork(); - bodyState = bodyState.withCatchBlocks(catchSpans); - bodyState = acceptOpt(resources, bodyState); - bodyState = acceptOpt(node.getBody(), bodyState); - bodyState = bodyState.withCatchBlocks(Collections.emptyList()); + @Nullable ASTResourceList resources = node.getResources(); - SpanInfo exceptionalState = null; - int i = 0; - for (ASTCatchClause catchClause : node.getCatchClauses()) { - SpanInfo current = acceptOpt(catchClause, catchSpans.get(i)); - exceptionalState = current.absorb(exceptionalState); - i++; - } + SpanInfo bodyState = before.fork(); + bodyState = bodyState.withCatchBlocks(catchSpans); + bodyState = acceptOpt(resources, bodyState); + bodyState = acceptOpt(node.getBody(), bodyState); + bodyState = bodyState.withCatchBlocks(Collections.emptyList()); + + SpanInfo exceptionalState = null; + int i = 0; + for (ASTCatchClause catchClause : node.getCatchClauses()) { + SpanInfo current = acceptOpt(catchClause, catchSpans.get(i)); + exceptionalState = current.absorb(exceptionalState); + i++; + } + return bodyState.absorb(exceptionalState); + }); - SpanInfo finalState; - finalState = bodyState.absorb(exceptionalState); if (finallyClause != null) { if (finalState.abruptCompletionTargets.contains(finalState.global.abruptCompletionTarget)) { // this represents the finally clause when it was entered @@ -767,6 +772,40 @@ public final class DataflowPass { return result; } + /** + * Process a statement that may be broken out of if it is annotated with a label. + * This is theoretically all statements, as all of them may be annotated. However, + * some statements may not contain a break. Eg if a return statement has a label, + * the label can never be used. The weirdest example is probably an annotated break + * statement, which may break out of itself. + * + *

Try statements are handled specially because of the finally. + */ + private SpanInfo processBreakableStmt(ASTStatement statement, SpanInfo input, Supplier processFun) { + GlobalAlgoState globalState = input.global; + Node parent = statement.getParent(); + // in most cases this will remain empty + PSet labels = HashTreePSet.empty(); + // this will be filled with the reaching defs of the break statements, then merged with the actual exit state + SpanInfo placeholderForExitState = input.forkEmpty(); + + // collect labels and give a name to the exit state. + while (parent instanceof ASTLabeledStatement) { + String label = ((ASTLabeledStatement) parent).getLabel(); + labels = labels.plus(label); + globalState.breakTargets.namedTargets.put(label, placeholderForExitState); + parent = parent.getParent(); + } + SpanInfo endState = processFun.get(); + + // remove the labels + globalState.breakTargets.namedTargets.keySet().removeAll(labels); + + // todo edit the break targets + + return endState.absorb(placeholderForExitState); + } + private void pushTargets(ASTLoopStatement loop, SpanInfo breakTarget, SpanInfo continueTarget) { GlobalAlgoState globalState = breakTarget.global; globalState.breakTargets.unnamedTargets.push(breakTarget); @@ -809,7 +848,7 @@ public final class DataflowPass { @Override public SpanInfo visit(ASTBreakStatement node, SpanInfo data) { - return data.global.breakTargets.doBreak(data, node.getImage()); + return processBreakableStmt(node, data, () -> data.global.breakTargets.doBreak(data, node.getImage())); } @Override @@ -1543,8 +1582,9 @@ public final class DataflowPass { if (target != null) { // otherwise CT error target.absorb(data); + return data.abruptCompletion(target); } - return data.abruptCompletion(target); + return data; } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml index 1762a32772..12e5878463 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml @@ -2834,6 +2834,101 @@ public class Test { + + Custom label causes NPE + 1 + 7 + + + + + + Labeled statements (1) + 2 + 8,13 + + + + Labeled break statement (2) + 0 + + + + Labeled synchronized statement (3) + 0 + + + + Unused formal value From 23671181df8150449bad07fa104273a449d15d38 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 18 Apr 2024 20:45:14 +0200 Subject: [PATCH 034/142] [core] Typesafe saxon node iterators --- .../rule/xpath/internal/BaseNodeInfo.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/BaseNodeInfo.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/BaseNodeInfo.java index 55f8458051..aad0a8c8a1 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/BaseNodeInfo.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/BaseNodeInfo.java @@ -16,7 +16,6 @@ import net.sf.saxon.pattern.NodeTest; import net.sf.saxon.str.StringView; import net.sf.saxon.str.UnicodeString; import net.sf.saxon.tree.iter.AxisIterator; -import net.sf.saxon.tree.iter.NodeListIterator; import net.sf.saxon.tree.util.Navigator.AxisFilter; import net.sf.saxon.tree.wrapper.AbstractNodeWrapper; import net.sf.saxon.tree.wrapper.SiblingCountingNode; @@ -105,16 +104,28 @@ abstract class BaseNodeInfo extends AbstractNodeWrapper implements SiblingCounti return iterateList(nodes, true); } - @SuppressWarnings({"unchecked", "rawtypes"}) - static AxisIterator iterateList(List nodes, boolean forwards) { - return forwards ? new NodeListIterator((List) nodes) - : new RevListAxisIterator((List) nodes); + static AxisIterator iterateList(List nodes, boolean forwards) { + return forwards ? new NodeListIterator<>(nodes) + : new RevListAxisIterator<>(nodes); } - private static class RevListAxisIterator implements AxisIterator { - private final ListIterator iter; + private static class NodeListIterator implements AxisIterator { + private final ListIterator iter; - RevListAxisIterator(List list) { + NodeListIterator(List list) { + iter = list.listIterator(); + } + + @Override + public NodeInfo next() { + return this.iter.hasNext() ? this.iter.next() : null; + } + } + + private static class RevListAxisIterator implements AxisIterator { + private final ListIterator iter; + + RevListAxisIterator(List list) { iter = list.listIterator(list.size()); } From 53246d584ecf3cf59b1916514984065511a37d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 12 Apr 2024 20:21:32 -0300 Subject: [PATCH 035/142] Support sequences in XPath Attributes --- .../pmd/lang/rule/xpath/impl/AttributeAxisIterator.java | 4 +++- .../pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java index 46b0dd9f45..83ed8c471f 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java @@ -14,6 +14,7 @@ import java.lang.invoke.MethodType; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -119,7 +120,8 @@ public class AttributeAxisIterator implements Iterator { private boolean isConsideredReturnType(Method method) { Class klass = method.getReturnType(); - return CONSIDERED_RETURN_TYPES.contains(klass) || klass.isEnum(); + return CONSIDERED_RETURN_TYPES.contains(klass) || klass.isEnum() + || Collection.class.isAssignableFrom(klass); } private boolean isIgnored(Class nodeClass, Method method) { diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java index 448791c574..d854f4e9d6 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java @@ -258,13 +258,13 @@ public class SaxonXPathRuleQuery { return NAME_POOL; } - final class StaticContextWithProperties extends IndependentContext { private final Map> propertiesByName = new HashMap<>(); StaticContextWithProperties(Configuration config) { super(config); + getPackageData().setSchemaAware(true); } public void declareProperty(PropertyDescriptor prop) { From a01481a4f33273a992fcd5a1e7d80c2ebc4c3d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 18 Apr 2024 23:29:37 -0300 Subject: [PATCH 036/142] Add test for collection attributes --- .../java/net/sourceforge/pmd/lang/ast/DummyNode.java | 6 ++++++ .../rule/xpath/internal/SaxonXPathRuleQueryTest.java | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/ast/DummyNode.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/ast/DummyNode.java index a67ac6f386..eb4d5b5c96 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/ast/DummyNode.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/ast/DummyNode.java @@ -5,6 +5,7 @@ package net.sourceforge.pmd.lang.ast; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -125,6 +126,11 @@ public class DummyNode extends AbstractNode { return attributes.iterator(); } + // phony attribute that repeats the image 3 times + public List getLines() { + return Arrays.asList(getImage(), getImage(), getImage()); + } + public static class DummyRootNode extends DummyNode implements RootNode, GenericNode { // FIXME remove this diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java index 42829bbe48..6e91ae77eb 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java @@ -134,6 +134,15 @@ class SaxonXPathRuleQueryTest { assertQuery(0, "(/)[self::document-node(element(DummyNodeX))]", dummy); } + @Test + void testListAttributes() { + DummyRootNode dummy = helper.parse("(a(b))"); + List result = assertQuery(1, + "//dummyNode[count(distinct-values(@Lines)) > 0 and not(empty(index-of(@Lines, 'a')))]", dummy); + + assertEquals(dummy.getChild(0), result.get(0)); + } + @Test void ruleChainVisits() { SaxonXPathRuleQuery query = createQuery("//dummyNode[@Image='baz']/foo | //bar[@Public = 'true'] | //dummyNode[@Public = false()] | //dummyNode"); From f307e6e6cb0544a5a8a20b427f946df23bd9a581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 18 Apr 2024 23:49:35 -0300 Subject: [PATCH 037/142] Update changelog --- docs/pages/release_notes.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index befb4c1200..ab2d0ab991 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,6 +14,16 @@ This is a {{ site.pmd.release_type }} release. ### 🚀 New and noteworthy +#### Collections exposed as XPath attributes + +Up to now, all AST node getters would be exposed to XPath, as long as the return type was a primitive (boxed or unboxed), String or Enum. That meant that collections, even of these basic types, were not exposed, so for instance accessing Apex's `ASTUserClass.getInterfaceNames()` to list the interfaces implemented by a class was impossible from XPath, and would require writing a Java rule to check it. + +Since this release, PMD will also expose any getter returning a collection of any supported type as a sequence through an XPath attribute. They would require to use apropriate XQuery functions to manipulate the sequence. So for instance, to detect any given `ASTUserClass` that implements `Queueable`, it is now possible to write: + +```xml +/UserClass[not(empty(index-of(@InterfaceNames, 'Queueable')))] +``` + ### ✨ New rules - The new Java rule {%rule java/bestpractices/UnnecessaryVarargsArrayCreation %} reports explicit array creation From 8db0c80f24c3b1cefd1a146a143ec5fd76df19a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 00:14:11 -0300 Subject: [PATCH 038/142] Restrict exposed attributes based on element types --- .../xpath/impl/AttributeAxisIterator.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java index 83ed8c471f..4337f25a13 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java @@ -13,6 +13,8 @@ import java.lang.invoke.MethodHandles.Lookup; import java.lang.invoke.MethodType; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; @@ -120,8 +122,23 @@ public class AttributeAxisIterator implements Iterator { private boolean isConsideredReturnType(Method method) { Class klass = method.getReturnType(); - return CONSIDERED_RETURN_TYPES.contains(klass) || klass.isEnum() - || Collection.class.isAssignableFrom(klass); + if (CONSIDERED_RETURN_TYPES.contains(klass) || klass.isEnum()) { + return true; + } + + if (Collection.class.isAssignableFrom(klass)) { + Type t = method.getGenericReturnType(); + if (t instanceof ParameterizedType) { + try { + Class elementKlass = Class.forName(((ParameterizedType) t).getActualTypeArguments()[0].getTypeName()); + return CONSIDERED_RETURN_TYPES.contains(elementKlass) || elementKlass.isEnum(); + } catch (ClassNotFoundException ignored) { + // should never happen + } + } + } + + return false; } private boolean isIgnored(Class nodeClass, Method method) { From ce5e229c61f13e12337c7c4521847f22a4551c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 00:28:28 -0300 Subject: [PATCH 039/142] Produce deprecation warnings when atomize is used - When Saxon determines that it needs to atomize an attribute rather than getStringValue() we were not producing deprecation warnings. --- .../pmd/lang/rule/xpath/internal/AstAttributeNode.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java index 9cbb199a62..4b6f7f077f 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java @@ -68,6 +68,7 @@ class AstAttributeNode extends BaseNodeInfo implements SiblingCountingNode { @Override public AtomicSequence atomize() { + getTreeInfo().getLogger().recordUsageOf(attribute); if (value == null) { value = DomainConversion.convert(attribute.getValue()); } From 8d51a2f2a034d7eec4db4cf8855187b95c969c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 00:31:37 -0300 Subject: [PATCH 040/142] Just do it once per attribute --- .../pmd/lang/rule/xpath/internal/AstAttributeNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java index 4b6f7f077f..7bddc4f9ea 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java @@ -68,8 +68,8 @@ class AstAttributeNode extends BaseNodeInfo implements SiblingCountingNode { @Override public AtomicSequence atomize() { - getTreeInfo().getLogger().recordUsageOf(attribute); if (value == null) { + getTreeInfo().getLogger().recordUsageOf(attribute); value = DomainConversion.convert(attribute.getValue()); } return value; From b74b6e5a666375e16920e3bafb59783d7c662272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 00:46:58 -0300 Subject: [PATCH 041/142] Revert. Different rules on the same node report separately --- .../pmd/lang/rule/xpath/internal/AstAttributeNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java index 7bddc4f9ea..4b6f7f077f 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstAttributeNode.java @@ -68,8 +68,8 @@ class AstAttributeNode extends BaseNodeInfo implements SiblingCountingNode { @Override public AtomicSequence atomize() { + getTreeInfo().getLogger().recordUsageOf(attribute); if (value == null) { - getTreeInfo().getLogger().recordUsageOf(attribute); value = DomainConversion.convert(attribute.getValue()); } return value; From 0d6f196c6dbeca13b22d844cb978e658253f8f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 01:13:21 -0300 Subject: [PATCH 042/142] Fix broken tests --- .../rule/xpath/impl/AttributeAxisIteratorTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIteratorTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIteratorTest.java index 906b0128de..e674bbe56c 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIteratorTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIteratorTest.java @@ -41,7 +41,9 @@ class AttributeAxisIteratorTest { AttributeAxisIterator it = new AttributeAxisIterator(dummyNode); - assertEquals(DEFAULT_ATTRS, toMap(it).keySet()); + Set expected = CollectionUtil.setUnion(DEFAULT_ATTRS, "Lines"); + + assertEquals(expected, toMap(it).keySet()); } @Test @@ -50,7 +52,7 @@ class AttributeAxisIteratorTest { AttributeAxisIterator it = new AttributeAxisIterator(dummyNode); - Set expected = CollectionUtil.setUnion(DEFAULT_ATTRS, "Enum"); + Set expected = CollectionUtil.setUnion(DEFAULT_ATTRS, "Enum", "Lines"); assertEquals(expected, toMap(it).keySet()); } @@ -62,7 +64,9 @@ class AttributeAxisIteratorTest { AttributeAxisIterator it = new AttributeAxisIterator(dummyNode); - assertEquals(DEFAULT_ATTRS, toMap(it).keySet()); + Set expected = CollectionUtil.setUnion(DEFAULT_ATTRS, "List", "Lines"); + + assertEquals(expected, toMap(it).keySet()); } /** From 3a4abd720e6f4a18972e14abce61e138c822aa5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 01:13:37 -0300 Subject: [PATCH 043/142] Schema awareness changes the produced queries --- .../internal/SaxonXPathRuleQueryTest.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java index 6e91ae77eb..a53ffe4b91 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java @@ -152,11 +152,11 @@ class SaxonXPathRuleQueryTest { assertTrue(ruleChainVisits.contains("bar")); assertEquals(3, query.nodeNameToXPaths.size()); - assertExpression("(self::node()[(string(data(@Image))) eq baz])/child::element(foo)", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); - assertExpression("self::node()[(boolean(data(@Public))) eq false]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(1)); + assertExpression("(self::node()[(data(attribute::attribute(Image))) = baz])/child::element(foo)", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); + assertExpression("self::node()[(data(attribute::attribute(Public))) = false]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(1)); assertExpression("self::node()", query.getExpressionsForLocalNameOrDefault("dummyNode").get(2)); - assertExpression("self::node()[(string(data(@Public))) eq true]", query.getExpressionsForLocalNameOrDefault("bar").get(0)); - assertExpression("(((docOrder((((/)/descendant::element(dummyNode))[(string(data(@Image))) eq baz])/child::element(foo))) | (((/)/descendant::element(bar))[(string(data(@Public))) eq true])) | (((/)/descendant::element(dummyNode))[(boolean(data(@Public))) eq false])) | ((/)/descendant::element(dummyNode))", query.getFallbackExpr()); + assertExpression("self::node()[(data(attribute::attribute(Public))) = true]", query.getExpressionsForLocalNameOrDefault("bar").get(0)); + assertExpression("(((docOrder((((/)/descendant::element(dummyNode))[(data(attribute::attribute(Image))) = baz])/child::element(foo))) | (((/)/descendant::element(bar))[(data(attribute::attribute(Public))) = true])) | (((/)/descendant::element(dummyNode))[(data(attribute::attribute(Public))) = false])) | ((/)/descendant::element(dummyNode))", query.getFallbackExpr()); } @Test @@ -166,8 +166,8 @@ class SaxonXPathRuleQueryTest { assertEquals(1, ruleChainVisits.size()); assertTrue(ruleChainVisits.contains("dummyNode")); assertEquals(2, query.nodeNameToXPaths.size()); - assertExpression("(self::node()[(boolean(data(@Test1))) eq false])[(boolean(data(@Test2))) eq true]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); - assertExpression("(((/)/descendant::element(dummyNode))[(boolean(data(@Test1))) eq false])[(boolean(data(@Test2))) eq true]", query.getFallbackExpr()); + assertExpression("(self::node()[(data(attribute::attribute(Test1))) = false])[(data(attribute::attribute(Test2))) = true]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); + assertExpression("(((/)/descendant::element(dummyNode))[(data(attribute::attribute(Test1))) = false])[(data(attribute::attribute(Test2))) = true]", query.getFallbackExpr()); } @Test @@ -177,8 +177,8 @@ class SaxonXPathRuleQueryTest { assertEquals(1, ruleChainVisits.size()); assertTrue(ruleChainVisits.contains("dummyNode")); assertEquals(2, query.nodeNameToXPaths.size()); - assertExpression("self::node()[Q{http://pmd.sourceforge.net/pmd-dummy}imageIs(exactly-one(convertTo_xs:string(data(@Image))))]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); - assertExpression("((/)/descendant::element(Q{}dummyNode))[Q{http://pmd.sourceforge.net/pmd-dummy}imageIs(exactly-one(convertTo_xs:string(data(@Image))))]", query.getFallbackExpr()); + assertExpression("self::node()[Q{http://pmd.sourceforge.net/pmd-dummy}imageIs(exactly-one(convertTo_xs:string(data(attribute::attribute(Image)))))]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); + assertExpression("((/)/descendant::element(Q{}dummyNode))[Q{http://pmd.sourceforge.net/pmd-dummy}imageIs(exactly-one(convertTo_xs:string(data(attribute::attribute(Image)))))]", query.getFallbackExpr()); } /** @@ -215,8 +215,8 @@ class SaxonXPathRuleQueryTest { assertEquals(1, ruleChainVisits.size()); assertTrue(ruleChainVisits.contains("dummyNode")); assertEquals(2, query.nodeNameToXPaths.size()); - assertExpression("(((self::node()/child::element(foo))/child::element())/child::element(bar))[(string(data(@Test))) eq false]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); - assertExpression("docOrder(((docOrder((((/)/descendant::element(dummyNode))/child::element(foo))/child::element()))/child::element(bar))[(string(data(@Test))) eq false])", query.getFallbackExpr()); + assertExpression("(((self::node()/child::element(foo))/child::element())/child::element(bar))[(data(attribute::attribute(Test))) = false]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); + assertExpression("docOrder(((docOrder((((/)/descendant::element(dummyNode))/child::element(foo))/child::element()))/child::element(bar))[(data(attribute::attribute(Test))) = false])", query.getFallbackExpr()); } @Test @@ -226,8 +226,8 @@ class SaxonXPathRuleQueryTest { assertEquals(1, ruleChainVisits.size()); assertTrue(ruleChainVisits.contains("dummyNode")); assertEquals(2, query.nodeNameToXPaths.size()); - assertExpression("((((self::node()/child::element(foo))[(string(data(@Baz))) eq a])/child::element())/child::element(bar))[(string(data(@Test))) eq false]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); - assertExpression("docOrder(((docOrder(((((/)/descendant::element(dummyNode))/child::element(foo))[(string(data(@Baz))) eq a])/child::element()))/child::element(bar))[(string(data(@Test))) eq false])", query.getFallbackExpr()); + assertExpression("((((self::node()/child::element(foo))[(data(attribute::attribute(Baz))) = a])/child::element())/child::element(bar))[(data(attribute::attribute(Test))) = false]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); + assertExpression("docOrder(((docOrder(((((/)/descendant::element(dummyNode))/child::element(foo))[(data(attribute::attribute(Baz))) = a])/child::element()))/child::element(bar))[(data(attribute::attribute(Test))) = false])", query.getFallbackExpr()); } @Test @@ -249,7 +249,7 @@ class SaxonXPathRuleQueryTest { assertEquals(followPath(tree, "10"), results.get(0)); }); - assertExpression("docOrder((((/)/descendant::(element(dummyNode) | element(dummyNodeB)))/child::element(dummyNode))[(string(data(@Image))) eq 10])", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); + assertExpression("docOrder((((/)/descendant::(element(dummyNode) | element(dummyNodeB)))/child::element(dummyNode))[(data(attribute::attribute(Image))) = 10])", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); } @Test @@ -266,7 +266,7 @@ class SaxonXPathRuleQueryTest { )); assertEquals(0, query.getRuleChainVisits().size()); - assertExpression("docOrder((((((/)/descendant::element(dummyNode))[(string(data(@Image))) eq 0]) | (((/)/descendant::element(dummyNodeB))[(string(data(@Image))) eq 1]))/child::element(dummyNode))[(string(data(@Image))) eq 10])", query.getFallbackExpr()); + assertExpression("docOrder((((((/)/descendant::element(dummyNode))[(data(attribute::attribute(Image))) = 0]) | (((/)/descendant::element(dummyNodeB))[(data(attribute::attribute(Image))) = 1]))/child::element(dummyNode))[(data(attribute::attribute(Image))) = 10])", query.getFallbackExpr()); tree.descendantsOrSelf().forEach(n -> { List results = query.evaluate(n); @@ -308,8 +308,8 @@ class SaxonXPathRuleQueryTest { assertEquals(1, ruleChainVisits.size()); assertTrue(ruleChainVisits.contains("dummyNode")); assertEquals(2, query.nodeNameToXPaths.size()); - assertExpression("self::node()[matches(convertTo_xs:string(data(@SimpleName)), a, )]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); - assertExpression("((/)/descendant::element(Q{}dummyNode))[matches(convertTo_xs:string(data(@SimpleName)), a, )]", query.getFallbackExpr()); + assertExpression("self::node()[matches(zero-or-one(convertTo_xs:string(data(attribute::attribute(SimpleName)))), a, )]", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); + assertExpression("((/)/descendant::element(Q{}dummyNode))[matches(zero-or-one(convertTo_xs:string(data(attribute::attribute(SimpleName)))), a, )]", query.getFallbackExpr()); } @Test @@ -320,8 +320,8 @@ class SaxonXPathRuleQueryTest { assertEquals(1, ruleChainVisits.size()); assertTrue(ruleChainVisits.contains("dummyNode")); assertEquals(2, query.nodeNameToXPaths.size()); - assertExpression("(self::node()[matches(convertTo_xs:string(data(@SimpleName)), a, )])/child::element(Q{}foo)", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); - assertExpression("docOrder((((/)/descendant::element(Q{}dummyNode))[matches(convertTo_xs:string(data(@SimpleName)), a, )])/child::element(Q{}foo))", query.getFallbackExpr()); + assertExpression("(self::node()[matches(zero-or-one(convertTo_xs:string(data(attribute::attribute(SimpleName)))), a, )])/child::element(Q{}foo)", query.getExpressionsForLocalNameOrDefault("dummyNode").get(0)); + assertExpression("docOrder((((/)/descendant::element(Q{}dummyNode))[matches(zero-or-one(convertTo_xs:string(data(attribute::attribute(SimpleName)))), a, )])/child::element(Q{}foo))", query.getFallbackExpr()); } @Test @@ -331,7 +331,7 @@ class SaxonXPathRuleQueryTest { assertEquals(1, ruleChainVisits.size()); assertTrue(ruleChainVisits.contains("dummyNode")); assertEquals(2, query.nodeNameToXPaths.size()); - assertExpression("let $v0 := imageIs(bar) return ((self::node()[ends-with(convertTo_xs:string(data(@Image)), foo)])[$v0])", query.nodeNameToXPaths.get("dummyNode").get(0)); + assertExpression("let $v0 := imageIs(bar) return ((self::node()[ends-with(zero-or-one(convertTo_xs:string(data(attribute::attribute(Image)))), foo)])[$v0])", query.nodeNameToXPaths.get("dummyNode").get(0)); } @Test @@ -373,7 +373,7 @@ class SaxonXPathRuleQueryTest { assertTrue(ruleChainVisits.contains("WhileStatement")); assertTrue(ruleChainVisits.contains("DoStatement")); - final String expectedSubexpression = "(self::node()/descendant::element(dummyNode))[imageIs(exactly-one(convertTo_xs:string(data(@Image))))]"; + final String expectedSubexpression = "(self::node()/descendant::element(dummyNode))[imageIs(exactly-one(convertTo_xs:string(data(attribute::attribute(Image)))))]"; assertExpression(expectedSubexpression, query.nodeNameToXPaths.get("ForStatement").get(0)); assertExpression(expectedSubexpression, query.nodeNameToXPaths.get("WhileStatement").get(0)); assertExpression(expectedSubexpression, query.nodeNameToXPaths.get("DoStatement").get(0)); From 02e7a713fa2f76f71ccb5a783a112c4bf37d3aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 01:17:28 -0300 Subject: [PATCH 044/142] Update Apex tree dumps with the new attributes --- .../pmd/lang/apex/ast/InnerClassLocations.txt | 14 ++++---- .../lang/apex/ast/NullCoalescingOperator.txt | 2 +- .../lang/apex/ast/SafeNavigationOperator.txt | 32 +++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt index 23e291e650..d75cb639d9 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt @@ -1,29 +1,29 @@ +- ApexFile[@DefiningType = "InnerClassLocations", @RealLoc = true] - +- UserClass[@DefiningType = "InnerClassLocations", @Image = "InnerClassLocations", @RealLoc = true, @SimpleName = "InnerClassLocations", @SuperClassName = ""] + +- UserClass[@DefiningType = "InnerClassLocations", @Image = "InnerClassLocations", @InterfaceNames = null, @RealLoc = true, @SimpleName = "InnerClassLocations", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- UserClass[@DefiningType = "InnerClassLocations.bar1", @Image = "bar1", @RealLoc = true, @SimpleName = "bar1", @SuperClassName = ""] + +- UserClass[@DefiningType = "InnerClassLocations.bar1", @Image = "bar1", @InterfaceNames = null, @RealLoc = true, @SimpleName = "bar1", @SuperClassName = ""] | +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar1", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- Method[@Arity = 0, @CanonicalName = "m", @Constructor = false, @DefiningType = "InnerClassLocations.bar1", @Image = "m", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] | +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar1", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] - +- UserClass[@DefiningType = "InnerClassLocations.bar2", @Image = "bar2", @RealLoc = true, @SimpleName = "bar2", @SuperClassName = ""] + +- UserClass[@DefiningType = "InnerClassLocations.bar2", @Image = "bar2", @InterfaceNames = null, @RealLoc = true, @SimpleName = "bar2", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar2", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Method[@Arity = 0, @CanonicalName = "m", @Constructor = false, @DefiningType = "InnerClassLocations.bar2", @Image = "m", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar2", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar2", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar2", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar2", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt index 0714250b3b..c064bf5032 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt @@ -1,5 +1,5 @@ +- ApexFile[@DefiningType = "NullCoalescingOperator", @RealLoc = true] - +- UserClass[@DefiningType = "NullCoalescingOperator", @Image = "NullCoalescingOperator", @RealLoc = true, @SimpleName = "NullCoalescingOperator", @SuperClassName = ""] + +- UserClass[@DefiningType = "NullCoalescingOperator", @Image = "NullCoalescingOperator", @InterfaceNames = null, @RealLoc = true, @SimpleName = "NullCoalescingOperator", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "NullCoalescingOperator", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Method[@Arity = 2, @CanonicalName = "leftOrRight", @Constructor = false, @DefiningType = "NullCoalescingOperator", @Image = "leftOrRight", @RealLoc = true, @ReturnType = "String", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "NullCoalescingOperator", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt index 1ab6ad30a7..a31ee20f8e 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt @@ -1,26 +1,26 @@ +- ApexFile[@DefiningType = "Foo", @RealLoc = true] - +- UserClass[@DefiningType = "Foo", @Image = "Foo", @RealLoc = true, @SimpleName = "Foo", @SuperClassName = ""] + +- UserClass[@DefiningType = "Foo", @Image = "Foo", @InterfaceNames = null, @RealLoc = true, @SimpleName = "Foo", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Field[@DefiningType = "Foo", @Image = "x", @Name = "x", @RealLoc = true, @Type = "Integer", @Value = null] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Field[@DefiningType = "Foo", @Image = "profileUrl", @Name = "profileUrl", @RealLoc = true, @Type = "String", @Value = null] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- FieldDeclarationStatements[@DefiningType = "Foo", @RealLoc = true, @TypeName = "Integer"] + +- FieldDeclarationStatements[@DefiningType = "Foo", @RealLoc = true, @TypeArguments = null, @TypeName = "Integer"] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- FieldDeclaration[@DefiningType = "Foo", @Image = "x", @Name = "x", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "anIntegerField", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "anObject", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "x", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] - +- FieldDeclarationStatements[@DefiningType = "Foo", @RealLoc = true, @TypeName = "String"] + +- FieldDeclarationStatements[@DefiningType = "Foo", @RealLoc = true, @TypeArguments = null, @TypeName = "String"] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- FieldDeclaration[@DefiningType = "Foo", @Image = "profileUrl", @Name = "profileUrl", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "toExternalForm", @InputParametersSize = 0, @MethodName = "toExternalForm", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "user.getProfileUrl", @InputParametersSize = 0, @MethodName = "getProfileUrl", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "user", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "user", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "profileUrl", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- Method[@Arity = 1, @CanonicalName = "bar1", @Constructor = false, @DefiningType = "Foo", @Image = "bar1", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] @@ -30,15 +30,15 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "Foo", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "b", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "c1", @InputParametersSize = 0, @MethodName = "c1", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | +- CastExpression[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "b1", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "a1", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- Method[@Arity = 2, @CanonicalName = "bar2", @Constructor = false, @DefiningType = "Foo", @Image = "bar2", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] @@ -50,9 +50,9 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "Foo", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "aField", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] | | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = 0, @MethodName = "aMethod", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | | +- ArrayLoadExpression[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] @@ -60,9 +60,9 @@ | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "aField", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = 0, @MethodName = "aMethod", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- ArrayLoadExpression[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] @@ -77,14 +77,14 @@ | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- VariableDeclaration[@DefiningType = "Foo", @Image = "s", @RealLoc = true, @Type = "String"] | +- VariableExpression[@DefiningType = "Foo", @Image = "BillingCity", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "Account", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "contact", @RealLoc = true, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "contact", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "s", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- ReturnStatement[@DefiningType = "Foo", @RealLoc = true] +- VariableExpression[@DefiningType = "Foo", @Image = "Name", @RealLoc = true] - +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] +- SoqlExpression[@CanonicalQuery = "SELECT Name FROM Account WHERE Id = :tmpVar1", @DefiningType = "Foo", @Query = "SELECT Name FROM Account WHERE Id = :accId", @RealLoc = true] +- BindExpressions[@DefiningType = "Foo", @RealLoc = true] +- VariableExpression[@DefiningType = "Foo", @Image = "accId", @RealLoc = true] From d7693369ab3eb69833e64d739425ed0de947cb80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 01:51:21 -0300 Subject: [PATCH 045/142] Have the NodePrinter show collections as sequences --- .../kotlin/net/sourceforge/pmd/lang/test/ast/NodePrinters.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/test/ast/NodePrinters.kt b/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/test/ast/NodePrinters.kt index 4d7d47fec7..608f742b21 100644 --- a/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/test/ast/NodePrinters.kt +++ b/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/test/ast/NodePrinters.kt @@ -93,6 +93,9 @@ open class BaseNodeAttributePrinter : TextTreeRenderer(true, -1) { is Enum<*> -> value.enumDeclaringClass.simpleName + "." + value.name is Class<*> -> value.canonicalName?.let { "$it.class" } is Number, is Boolean -> value.toString() + is Collection<*> -> value.joinToString(prefix = "(", postfix = ")", separator = ", ") { + "${valueToString(it)}" + } null -> "null" else -> null } From d9e146da7eb50f84db75379d20bd2b1a6f67beac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 01:51:42 -0300 Subject: [PATCH 046/142] Update Java parser test to show modifiers properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - no longer need to manually add the attributes… - …but the format is slightly different --- .../pmd/lang/java/JavaAttributesPrinter.java | 13 - .../sourceforge/pmd/lang/java/ast/Bug1429.txt | 16 +- .../sourceforge/pmd/lang/java/ast/Bug1530.txt | 4 +- .../pmd/lang/java/ast/EmptyStmts1.txt | 2 +- .../pmd/lang/java/ast/EmptyStmts2.txt | 2 +- .../pmd/lang/java/ast/EmptyStmts3.txt | 4 +- .../lang/java/ast/GitHubBug1780OuterClass.txt | 18 +- .../pmd/lang/java/ast/GitHubBug207.txt | 6 +- .../pmd/lang/java/ast/GitHubBug208.txt | 8 +- .../pmd/lang/java/ast/GitHubBug309.txt | 10 +- .../pmd/lang/java/ast/GitHubBug3642.txt | 6 +- .../pmd/lang/java/ast/LambdaBug1333.txt | 16 +- .../pmd/lang/java/ast/LambdaBug1470.txt | 18 +- .../pmd/lang/java/ast/LambdaBug206.txt | 4 +- .../pmd/lang/java/ast/ParserCornerCases.txt | 146 +++++------ .../pmd/lang/java/ast/ParserCornerCases17.txt | 112 ++++---- .../pmd/lang/java/ast/ParserCornerCases18.txt | 242 +++++++++--------- .../pmd/lang/java/ast/SwitchStatements.txt | 6 +- .../lang/java/ast/SwitchWithFallthrough.txt | 6 +- .../pmd/lang/java/ast/SynchronizedStmts.txt | 4 +- 20 files changed, 315 insertions(+), 328 deletions(-) diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaAttributesPrinter.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaAttributesPrinter.java index 8a7466118b..9353eb5336 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaAttributesPrinter.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaAttributesPrinter.java @@ -27,15 +27,6 @@ import net.sourceforge.pmd.lang.test.ast.RelevantAttributePrinter; */ public class JavaAttributesPrinter extends RelevantAttributePrinter { - @Override - protected void fillAttributes(@NonNull Node node, @NonNull List result) { - super.fillAttributes(node, result); - if (node instanceof ASTModifierList) { - result.add(getModifierAttr("EffectiveModifiers", ((ASTModifierList) node).getEffectiveModifiers())); - result.add(getModifierAttr("ExplicitModifiers", ((ASTModifierList) node).getExplicitModifiers())); - } - } - @Override protected boolean ignoreAttribute(@NonNull Node node, @NonNull Attribute attribute) { return super.ignoreAttribute(node, attribute) @@ -53,8 +44,4 @@ public class JavaAttributesPrinter extends RelevantAttributePrinter { // for some reason Boolean::new is called somewhere in the reflection layer return o instanceof Boolean && (Boolean) o; } - - private AttributeInfo getModifierAttr(String name, Set mods) { - return new AttributeInfo(name, mods.stream().map(JModifier::getToken).collect(Collectors.joining(", ", "{", "}"))); - } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/Bug1429.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/Bug1429.txt index 01258c40d0..608f1370dd 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/Bug1429.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/Bug1429.txt @@ -1,9 +1,9 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Bug1429", @CanonicalName = "Bug1429", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Bug1429", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "getAttributeTuples", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassType[@FullyQualified = false, @SimpleName = "Set"] | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -40,21 +40,21 @@ +- ClassType[@FullyQualified = false, @SimpleName = "Transformer"] +- ArgumentList[@Empty = true, @Size = 0] +- AnonymousClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = true, @BinaryName = "Bug1429$1", @CanonicalName = null, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "", @Static = false, @TopLevel = false, @Visibility = Visibility.V_ANONYMOUS] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Final = false, @Name = "transform", @Overridden = true, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- Annotation[@SimpleName = "Override"] | +- ClassType[@FullyQualified = false, @SimpleName = "Override"] +- ClassType[@FullyQualified = false, @SimpleName = "Object"] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 5, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "key"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "key", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -62,7 +62,7 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "value"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "value", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -73,7 +73,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "key", @Name = "key", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "result"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/Bug1530.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/Bug1530.txt index a885099348..44e828f3a0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/Bug1530.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/Bug1530.txt @@ -1,9 +1,9 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Bug1530", @CanonicalName = "Bug1530", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Bug1530", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "incChild", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts1.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts1.txt index be73ae62df..1b135c3e52 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts1.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts1.txt @@ -3,5 +3,5 @@ +- EmptyDeclaration[] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "b", @ImportedSimpleName = "b", @PackageName = "", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Foo", @CanonicalName = "Foo", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Foo", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = true, @Size = 0] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts2.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts2.txt index 1285668cf4..69a2eca9a9 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts2.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts2.txt @@ -1,6 +1,6 @@ +- CompilationUnit[@PackageName = "c"] +- PackageDeclaration[@Name = "c"] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- EmptyDeclaration[] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "a", @ImportedSimpleName = "a", @PackageName = "", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "b", @ImportedSimpleName = "b", @PackageName = "", @Static = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts3.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts3.txt index eafa99ad6e..039439d9c1 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts3.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts3.txt @@ -1,9 +1,9 @@ +- CompilationUnit[@PackageName = "c"] +- PackageDeclaration[@Name = "c"] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "a", @ImportedSimpleName = "a", @PackageName = "", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "c.Foo", @CanonicalName = "c.Foo", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "c", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Foo", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassBody[@Empty = true, @Size = 0] +- EmptyDeclaration[] +- EmptyDeclaration[] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug1780OuterClass.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug1780OuterClass.txt index aff30eada1..142013490b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug1780OuterClass.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug1780OuterClass.txt @@ -1,11 +1,11 @@ +- CompilationUnit[@PackageName = "com.pmd.test"] +- PackageDeclaration[@Name = "com.pmd.test"] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.pmd.test.GitHubBug1780OuterClass", @CanonicalName = "com.pmd.test.GitHubBug1780OuterClass", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "com.pmd.test", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug1780OuterClass", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 4] +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "GitHubBug1780OuterClass", @Name = "GitHubBug1780OuterClass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExpressionStatement[] @@ -16,10 +16,10 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Inner Class AdapterClass", @Empty = false, @Image = "\"Inner Class AdapterClass\"", @Length = 24, @LiteralText = "\"Inner Class AdapterClass\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.pmd.test.GitHubBug1780OuterClass$InnerClass", @CanonicalName = "com.pmd.test.GitHubBug1780OuterClass.InnerClass", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "com.pmd.test", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "InnerClass", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "InnerClass", @Name = "InnerClass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExpressionStatement[] @@ -30,12 +30,12 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Inner Class Constructor", @Empty = false, @Image = "\"Inner Class Constructor\"", @Length = 23, @LiteralText = "\"Inner Class Constructor\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.pmd.test.GitHubBug1780OuterClass$StaticInnerClass", @CanonicalName = "com.pmd.test.GitHubBug1780OuterClass.StaticInnerClass", @EffectiveVisibility = Visibility.V_PRIVATE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "com.pmd.test", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "StaticInnerClass", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "InnerClass"] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Image = "StaticInnerClass", @Name = "StaticInnerClass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- ExplicitConstructorInvocation[@ArgumentCount = 0, @MethodName = "new", @Qualified = true, @Super = true, @This = false] @@ -51,11 +51,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "StaticInnerClass Constructor", @Empty = false, @Image = "\"StaticInnerClass Constructor\"", @Length = 28, @LiteralText = "\"StaticInnerClass Constructor\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- ArrayDimensions[@Empty = false, @Size = 1] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug207.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug207.txt index 003832ccac..ca175c431d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug207.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug207.txt @@ -1,15 +1,15 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug207", @CanonicalName = "GitHubBug207", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug207", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "resourceHttpMessageWriter", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] - +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] +- ClassType[@FullyQualified = false, @SimpleName = "HttpMessageWriter"] | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | +- ClassType[@FullyQualified = false, @SimpleName = "Resource"] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = true, @SimpleName = "Context"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "context", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug208.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug208.txt index 8f6325ca3f..0f682c9800 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug208.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug208.txt @@ -1,22 +1,22 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug208", @CanonicalName = "GitHubBug208", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug208", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testMethod", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] +- LocalClassStatement[] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug208$1LocalClass", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = false, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "LocalClass", @Static = false, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- Annotation[@SimpleName = "Lazy"] | | +- ClassType[@FullyQualified = false, @SimpleName = "Lazy"] | +- Annotation[@SimpleName = "Configuration"] | +- ClassType[@FullyQualified = false, @SimpleName = "Configuration"] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Name = "foo", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- Annotation[@SimpleName = "Bean"] | +- ClassType[@FullyQualified = false, @SimpleName = "Bean"] +- ClassType[@FullyQualified = false, @SimpleName = "Object"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug309.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug309.txt index 6daf50aaa1..83f0187049 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug309.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug309.txt @@ -1,14 +1,14 @@ +- CompilationUnit[@PackageName = ""] +- ImportDeclaration[@ImportOnDemand = true, @ImportedName = "java.util", @ImportedSimpleName = null, @PackageName = "java.util", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug309", @CanonicalName = "GitHubBug309", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug309", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -16,7 +16,7 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 2, @containsComment = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | +- VariableDeclarator[@Initializer = true, @Name = "r11"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r11", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -26,7 +26,7 @@ | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassType[@FullyQualified = false, @SimpleName = "IntFunction"] | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | +- ArrayType[@ArrayDepth = 1] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug3642.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug3642.txt index df2fdaa8b0..7dd84d21a6 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug3642.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug3642.txt @@ -1,12 +1,12 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug3642", @CanonicalName = "GitHubBug3642", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug3642", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "GitHubBug3642$Foo", @CanonicalName = "GitHubBug3642.Foo", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Foo", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{abstract, static}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = ()] +- AnnotationTypeBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = true, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "v1", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - +- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = ()] +- ClassType[@FullyQualified = false, @SimpleName = "String"] +- FormalParameters[@Empty = true, @Size = 0] +- ArrayDimensions[@Empty = false, @Size = 1] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1333.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1333.txt index 1a79f6503f..8ed63303b7 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1333.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1333.txt @@ -1,9 +1,9 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Bug1333", @CanonicalName = "Bug1333", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Bug1333", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] +- ClassBody[@Empty = false, @Size = 4] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- ClassType[@FullyQualified = false, @SimpleName = "Logger"] | +- VariableDeclarator[@Initializer = true, @Name = "LOG"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "LOG", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] @@ -13,7 +13,7 @@ | +- ClassLiteral[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | +- ClassType[@FullyQualified = false, @SimpleName = "Foo"] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "deleteDirectoriesByNamePattern", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -23,17 +23,17 @@ | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | +- LambdaParameterList[@Empty = false, @Size = 1] | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "path", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | +- MethodCall[@CompileTimeConstant = false, @Image = "deleteDirectory", @MethodName = "deleteDirectory", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "path", @Name = "path", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "delete", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Consumer"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- WildcardType[@LowerBound = true, @UpperBound = false] @@ -48,11 +48,11 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "consumer", @Name = "consumer", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "deleteDirectory", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "path", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1470.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1470.txt index 45a2db1cc1..087f538552 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1470.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1470.txt @@ -1,18 +1,18 @@ +- CompilationUnit[@PackageName = "com.sample.test"] +- PackageDeclaration[@Name = "com.sample.test"] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- 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] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.sample.test.pmdTest", @CanonicalName = "com.sample.test.pmdTest", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "com.sample.test", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "pmdTest", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 3] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = false, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.BOOLEAN] | +- VariableDeclarator[@Initializer = false, @Name = "stuff"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "stuff", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testSuper", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "Observable"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Boolean"] @@ -27,7 +27,7 @@ | | +- LambdaExpression[@Arity = 1, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Subscriber"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- WildcardType[@LowerBound = true, @UpperBound = false] @@ -42,11 +42,11 @@ | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | +- LambdaParameterList[@Empty = false, @Size = 1] | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "authToken", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | +- BooleanLiteral[@CompileTimeConstant = true, @LiteralText = "false", @ParenthesisDepth = 0, @Parenthesized = false, @True = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testSuper2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassType[@FullyQualified = false, @SimpleName = "Observable"] | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | +- ClassType[@FullyQualified = false, @SimpleName = "Boolean"] @@ -61,7 +61,7 @@ | +- LambdaExpression[@Arity = 1, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | +- LambdaParameterList[@Empty = false, @Size = 1] | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "subscriber", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExpressionStatement[] @@ -72,6 +72,6 @@ +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] +- LambdaParameterList[@Empty = false, @Size = 1] | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "authToken", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] +- BooleanLiteral[@CompileTimeConstant = true, @LiteralText = "false", @ParenthesisDepth = 0, @Parenthesized = false, @True = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug206.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug206.txt index 8a98bbff93..4d2966d6cd 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug206.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug206.txt @@ -1,9 +1,9 @@ +- CompilationUnit[@PackageName = ""] +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "Foo", @CanonicalName = "Foo", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Foo", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = (JModifier.PUBLIC)] +- AnnotationTypeBody[@Empty = false, @Size = 1] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PUBLIC, @Static = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{static, final}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] +- ClassType[@FullyQualified = false, @SimpleName = "ThreadLocal"] | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | +- ClassType[@FullyQualified = false, @SimpleName = "Interner"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases.txt index 9d337871f6..8860f0dbb2 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases.txt @@ -1,41 +1,41 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Superclass", @CanonicalName = "Superclass", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Superclass", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 3] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Superclass", @Name = "Superclass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Superclass", @Name = "Superclass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- TypeParameters[@Empty = false, @Size = 1] | | | +- TypeParameter[@Image = "V", @Name = "V", @TypeBound = false] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Class"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "V"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "clazz", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "doStuff", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Outer", @CanonicalName = "Outer", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Outer", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 2] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Outer", @Name = "Outer", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ExpressionStatement[] @@ -46,10 +46,10 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Outer constructor", @Empty = false, @Image = "\"Outer constructor\"", @Length = 17, @LiteralText = "\"Outer constructor\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Outer$Inner", @CanonicalName = "Outer.Inner", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Inner", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Inner", @Name = "Inner", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExpressionStatement[] @@ -60,16 +60,16 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Inner constructor", @Empty = false, @Image = "\"Inner constructor\"", @Length = 17, @LiteralText = "\"Inner constructor\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Child", @CanonicalName = "Child", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Child", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Inner"] | | +- ClassType[@FullyQualified = false, @SimpleName = "Outer"] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Child", @Name = "Child", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Outer"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 2, @containsComment = false] @@ -84,21 +84,21 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Child constructor", @Empty = false, @Image = "\"Child constructor\"", @Length = 17, @LiteralText = "\"Child constructor\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases", @CanonicalName = "ParserCornerCases", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ParserCornerCases", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Superclass"] | +- ClassBody[@Empty = false, @Size = 8] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "ParserCornerCases", @Name = "ParserCornerCases", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ExplicitConstructorInvocation[@ArgumentCount = 0, @MethodName = "new", @Qualified = false, @Super = true, @This = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "ParserCornerCases", @Name = "ParserCornerCases", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -109,16 +109,16 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "a", @Name = "a", @ParenthesisDepth = 0, @Parenthesized = false] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] | +- ConstructorDeclaration[@Abstract = false, @Arity = 2, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "ParserCornerCases", @Name = "ParserCornerCases", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- TypeParameters[@Empty = false, @Size = 1] | | | +- TypeParameter[@Image = "W", @Name = "W", @TypeBound = false] | | +- FormalParameters[@Empty = false, @Size = 2] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "b", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -129,22 +129,22 @@ | | +- ClassLiteral[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "ParserCornerCases", @Name = "ParserCornerCases", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "title", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ExplicitConstructorInvocation[@ArgumentCount = 0, @MethodName = "new", @Qualified = false, @Super = false, @This = true] | | +- ArgumentList[@Empty = true, @Size = 0] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testGeneric", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public, strictfp}", @ExplicitModifiers = "{public, strictfp}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STRICTFP), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STRICTFP)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 2, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableDeclarator[@Initializer = true, @Name = "o"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -155,7 +155,7 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "foo", @Empty = false, @Image = "\"foo\"", @Length = 3, @LiteralText = "\"foo\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "v"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "v", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -166,20 +166,20 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "bar", @Empty = false, @Image = "\"bar\"", @Length = 3, @LiteralText = "\"bar\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "thisGeneric", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- TypeParameters[@Empty = false, @Size = 1] | | | +- TypeParameter[@Image = "X", @Name = "X", @TypeBound = false] | | +- ClassType[@FullyQualified = false, @SimpleName = "X"] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "X"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ReturnStatement[] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "getByteArrayClass", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Class"] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -190,7 +190,7 @@ | | +- ArrayDimensions[@Empty = false, @Size = 1] | | +- ArrayTypeDim[@Varargs = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "bitwiseOperator", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -208,23 +208,23 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "shift ", @Empty = false, @Image = "\"shift \"", @Length = 6, @LiteralText = "\"shift \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "PmdTestParent", @CanonicalName = "PmdTestParent", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "PmdTestParent", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "PmdTestParent", @Name = "PmdTestParent", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "PmdTestChild", @CanonicalName = "PmdTestChild", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "PmdTestChild", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "PmdTestParent"] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "PmdTestChild", @Name = "PmdTestChild", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExplicitConstructorInvocation[@ArgumentCount = 1, @MethodName = "new", @Qualified = false, @Super = true, @This = false] @@ -233,15 +233,15 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | +- ArgumentList[@Empty = true, @Size = 0] | +- AnonymousClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = true, @BinaryName = "PmdTestChild$1", @CanonicalName = null, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "", @Static = false, @TopLevel = false, @Visibility = Visibility.V_ANONYMOUS] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Final = false, @Name = "create", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableDeclarator[@Initializer = true, @Name = "memoryMonitor"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "memoryMonitor", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -260,26 +260,26 @@ | +- ReturnStatement[] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "memoryMonitor", @Name = "memoryMonitor", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SimpleBean", @CanonicalName = "SimpleBean", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SimpleBean", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PACKAGE, @Static = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = false, @Name = "name"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "name", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SimpleBeanUser", @CanonicalName = "SimpleBeanUser", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SimpleBeanUser", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 2] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "SimpleBeanUser", @Name = "SimpleBeanUser", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "SimpleBean"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "SimpleBeanUser", @Name = "SimpleBeanUser", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExplicitConstructorInvocation[@ArgumentCount = 1, @MethodName = "new", @Qualified = false, @Super = false, @This = true] @@ -288,7 +288,7 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "SimpleBean"] | +- ArgumentList[@Empty = true, @Size = 0] | +- AnonymousClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = true, @BinaryName = "SimpleBeanUser$1", @CanonicalName = null, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "", @Static = false, @TopLevel = false, @Visibility = Visibility.V_ANONYMOUS] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- Initializer[@Static = false] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -297,12 +297,12 @@ | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "name", @Name = "name", @ParenthesisDepth = 0, @Parenthesized = false] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "test", @Empty = false, @Image = "\"test\"", @Length = 4, @LiteralText = "\"test\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SimpleBeanUser2", @CanonicalName = "SimpleBeanUser2", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SimpleBeanUser2", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "SimpleBeanUser"] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "SimpleBeanUser2", @Name = "SimpleBeanUser2", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExplicitConstructorInvocation[@ArgumentCount = 1, @MethodName = "new", @Qualified = false, @Super = true, @This = false] @@ -311,7 +311,7 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "SimpleBean"] | +- ArgumentList[@Empty = true, @Size = 0] | +- AnonymousClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = true, @BinaryName = "SimpleBeanUser2$1", @CanonicalName = null, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "", @Static = false, @TopLevel = false, @Visibility = Visibility.V_ANONYMOUS] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- Initializer[@Static = false] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -320,17 +320,17 @@ | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "name", @Name = "name", @ParenthesisDepth = 0, @Parenthesized = false] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "test2", @Empty = false, @Image = "\"test2\"", @Length = 5, @LiteralText = "\"test2\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "TestParseAnnototation", @CanonicalName = "TestParseAnnototation", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "TestParseAnnototation", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "parse", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 4, @containsComment = false] | +- ForStatement[] | | +- ForInit[] | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- Annotation[@SimpleName = "SuppressWarnings"] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "SuppressWarnings"] | | | | +- AnnotationMemberList[@Empty = false, @Size = 1] @@ -351,7 +351,7 @@ | +- ForStatement[] | | +- ForInit[] | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- Annotation[@SimpleName = "SuppressWarnings"] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "SuppressWarnings"] | | | | +- AnnotationMemberList[@Empty = false, @Size = 1] @@ -370,7 +370,7 @@ | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "List"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -383,7 +383,7 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- ForeachStatement[] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- Annotation[@SimpleName = "SuppressWarnings"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "SuppressWarnings"] | | | +- AnnotationMemberList[@Empty = false, @Size = 1] @@ -395,26 +395,26 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "l", @Name = "l", @ParenthesisDepth = 0, @Parenthesized = false] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "FooBlock", @CanonicalName = "FooBlock", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "FooBlock", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "MyFoo", @CanonicalName = "MyFoo", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "MyFoo", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "MyFoo", @Name = "MyFoo", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "FooBlock"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "b", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Foo", @CanonicalName = "Foo", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Foo", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "MyFoo"] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Foo", @Name = "Foo", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExplicitConstructorInvocation[@ArgumentCount = 1, @MethodName = "new", @Qualified = false, @Super = true, @This = false] @@ -423,19 +423,19 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "FooBlock"] | +- ArgumentList[@Empty = true, @Size = 0] | +- AnonymousClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = true, @BinaryName = "Foo$1", @CanonicalName = null, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "", @Static = false, @TopLevel = false, @Visibility = Visibility.V_ANONYMOUS] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Final = false, @Name = "valueOf", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "object", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "fish"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "fish", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -443,10 +443,10 @@ | +- ReturnStatement[] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "fish", @Name = "fish", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SuperTest", @CanonicalName = "SuperTest", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SuperTest", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "iterator", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "Iterator"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "E"] @@ -467,10 +467,10 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "E"] | | +- ArgumentList[@Empty = true, @Size = 0] | | +- AnonymousClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = true, @BinaryName = "SuperTest$1", @CanonicalName = null, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "", @Static = false, @TopLevel = false, @Visibility = Visibility.V_ANONYMOUS] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassBody[@Empty = false, @Size = 4] | | +- FieldDeclaration[@EffectiveVisibility = Visibility.V_ANONYMOUS, @Static = false, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Iterator"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "E"] @@ -481,7 +481,7 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "ImmutableSet"] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Final = false, @Name = "hasNext", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BOOLEAN] | | | +- FormalParameters[@Empty = true, @Size = 0] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -491,7 +491,7 @@ | | | | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Final = false, @Name = "next", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- ClassType[@FullyQualified = false, @SimpleName = "E"] | | | +- FormalParameters[@Empty = true, @Size = 0] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -501,7 +501,7 @@ | | | | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_ANONYMOUS, @Final = false, @Name = "remove", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 2, @containsComment = false] @@ -528,15 +528,15 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "UnsupportedOperationException"] | +- ArgumentList[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ClazzPropertyOfPrimitiveTypes", @CanonicalName = "ClazzPropertyOfPrimitiveTypes", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ClazzPropertyOfPrimitiveTypes", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 11, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Class"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- WildcardType[@LowerBound = false, @UpperBound = true] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt index da23efe42b..5f7cfe059b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt @@ -11,21 +11,21 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.Map", @ImportedSimpleName = "Map", @PackageName = "java.util", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.zip.ZipEntry", @ImportedSimpleName = "ZipEntry", @PackageName = "java.util.zip", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases17", @CanonicalName = "ParserCornerCases17", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ParserCornerCases17", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 9] +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "ParserCornerCases17", @Name = "ParserCornerCases17", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExplicitConstructorInvocation[@ArgumentCount = 0, @MethodName = "new", @Qualified = false, @Super = true, @This = false] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "binaryLiterals", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 9, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | +- VariableDeclarator[@Initializer = true, @Name = "aByte"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "aByte", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -33,7 +33,7 @@ | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b00100001", @IntLiteral = true, @Integral = true, @LiteralText = "0b00100001", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 33.0, @ValueAsFloat = 33.0, @ValueAsInt = 33, @ValueAsLong = 33] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.SHORT] | | +- VariableDeclarator[@Initializer = true, @Name = "aShort"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "aShort", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -41,31 +41,31 @@ | | +- PrimitiveType[@Kind = PrimitiveTypeKind.SHORT] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b1010000101000101", @IntLiteral = true, @Integral = true, @LiteralText = "0b1010000101000101", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 41285.0, @ValueAsFloat = 41285.0, @ValueAsInt = 41285, @ValueAsLong = 41285] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "anInt1"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "anInt1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b00000000100000000010100001010001", @IntLiteral = true, @Integral = true, @LiteralText = "0b00000000100000000010100001010001", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 8398929.0, @ValueAsFloat = 8398929.0, @ValueAsInt = 8398929, @ValueAsLong = 8398929] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "anInt2"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "anInt2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b101", @IntLiteral = true, @Integral = true, @LiteralText = "0b101", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 5.0, @ValueAsFloat = 5.0, @ValueAsInt = 5, @ValueAsLong = 5] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "anInt3"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "anInt3", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0B101", @IntLiteral = true, @Integral = true, @LiteralText = "0B101", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 5.0, @ValueAsFloat = 5.0, @ValueAsInt = 5, @ValueAsLong = 5] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableDeclarator[@Initializer = true, @Name = "aLong"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "aLong", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b0000000000000000000000000000000000000000100010001000010000010000L", @IntLiteral = false, @Integral = true, @LiteralText = "0b0000000000000000000000000000000000000000100010001000010000010000L", @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 8946704.0, @ValueAsFloat = 8946704.0, @ValueAsInt = 8946704, @ValueAsLong = 8946704] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -82,7 +82,7 @@ | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b01001100", @IntLiteral = true, @Integral = true, @LiteralText = "0b01001100", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 76.0, @ValueAsFloat = 76.0, @ValueAsInt = 76, @ValueAsLong = 76] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b10011000", @IntLiteral = true, @Integral = true, @LiteralText = "0b10011000", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 152.0, @ValueAsFloat = 152.0, @ValueAsInt = 152, @ValueAsLong = 152] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "instruction"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "instruction", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -95,7 +95,7 @@ | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b00000000", @IntLiteral = true, @Integral = true, @LiteralText = "0b00000000", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "register"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "register", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -145,113 +145,113 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "IllegalArgumentException"] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "underscoreInNumericLiterals", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 15, @containsComment = true] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableDeclarator[@Initializer = true, @Name = "creditCardNumber"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "creditCardNumber", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1111_2222_3333_4444L", @IntLiteral = false, @Integral = true, @LiteralText = "1111_2222_3333_4444L", @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.111222233334444E15, @ValueAsFloat = 1.11122226E15, @ValueAsInt = -1770257748, @ValueAsLong = 1111222233334444] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableDeclarator[@Initializer = true, @Name = "socialSecurityNumber"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "socialSecurityNumber", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "999_99_9999L", @IntLiteral = false, @Integral = true, @LiteralText = "999_99_9999L", @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 9.99999999E8, @ValueAsFloat = 1.0E9, @ValueAsInt = 999999999, @ValueAsLong = 999999999] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.FLOAT] | | +- VariableDeclarator[@Initializer = true, @Name = "pi"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "pi", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = true, @Image = "3.14_15F", @IntLiteral = false, @Integral = false, @LiteralText = "3.14_15F", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.1415, @ValueAsFloat = 3.1415, @ValueAsInt = 3, @ValueAsLong = 3] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableDeclarator[@Initializer = true, @Name = "hexBytes"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "hexBytes", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 16, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0x00_11_22_33", @IntLiteral = true, @Integral = true, @LiteralText = "0x00_11_22_33", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1122867.0, @ValueAsFloat = 1122867.0, @ValueAsInt = 1122867, @ValueAsLong = 1122867] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableDeclarator[@Initializer = true, @Name = "hexWords"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "hexWords", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 16, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0x0001_CAFE", @IntLiteral = true, @Integral = true, @LiteralText = "0x0001_CAFE", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 117502.0, @ValueAsFloat = 117502.0, @ValueAsInt = 117502, @ValueAsLong = 117502] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableDeclarator[@Initializer = true, @Name = "maxLong"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "maxLong", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 16, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0x7fff_ffff_ffff_ffffL", @IntLiteral = false, @Integral = true, @LiteralText = "0x7fff_ffff_ffff_ffffL", @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 9.223372036854776E18, @ValueAsFloat = 9.223372E18, @ValueAsInt = -1, @ValueAsLong = 9223372036854775807] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | +- VariableDeclarator[@Initializer = true, @Name = "nybbles"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "nybbles", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b0010_0101", @IntLiteral = true, @Integral = true, @LiteralText = "0b0010_0101", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 37.0, @ValueAsFloat = 37.0, @ValueAsInt = 37, @ValueAsLong = 37] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableDeclarator[@Initializer = true, @Name = "bytes"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "bytes", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b00000000_10001000_10000100_00010000", @IntLiteral = true, @Integral = true, @LiteralText = "0b00000000_10001000_10000100_00010000", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 8946704.0, @ValueAsFloat = 8946704.0, @ValueAsInt = 8946704, @ValueAsLong = 8946704] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "_52"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_52", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x1"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "_52", @Name = "_52", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x2"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "5_2", @IntLiteral = true, @Integral = true, @LiteralText = "5_2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 52.0, @ValueAsFloat = 52.0, @ValueAsInt = 52, @ValueAsLong = 52] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x4"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x4", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "5_______2", @IntLiteral = true, @Integral = true, @LiteralText = "5_______2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 52.0, @ValueAsFloat = 52.0, @ValueAsInt = 52, @ValueAsLong = 52] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x7"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x7", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 16, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0x5_2", @IntLiteral = true, @Integral = true, @LiteralText = "0x5_2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 82.0, @ValueAsFloat = 82.0, @ValueAsInt = 82, @ValueAsLong = 82] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x9"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x9", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 8, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0_52", @IntLiteral = true, @Integral = true, @LiteralText = "0_52", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 42.0, @ValueAsFloat = 42.0, @ValueAsInt = 42, @ValueAsLong = 42] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "x10"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x10", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 8, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "05_2", @IntLiteral = true, @Integral = true, @LiteralText = "05_2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 42.0, @ValueAsFloat = 42.0, @ValueAsInt = 42, @ValueAsLong = 42] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "stringsInSwitchStatements", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 4, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "dayOfWeekArg"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "dayOfWeekArg", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Wednesday", @Empty = false, @Image = "\"Wednesday\"", @Length = 9, @LiteralText = "\"Wednesday\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = false, @Name = "typeOfDay"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "typeOfDay", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -310,27 +310,27 @@ | +- ReturnStatement[] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "typeOfDay", @Name = "typeOfDay", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases17$MyClass", @CanonicalName = "ParserCornerCases17.MyClass", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "MyClass", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "X", @Name = "X", @TypeBound = false] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "MyClass", @Name = "MyClass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "typeInferenceForGenericInstanceCreation", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 6, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Map"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 2] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -344,7 +344,7 @@ | | | +- TypeArguments[@Diamond = true, @Empty = true, @Size = 0] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "List"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -360,7 +360,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "A", @Empty = false, @Image = "\"A\"", @Length = 1, @LiteralText = "\"A\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "List"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- WildcardType[@LowerBound = false, @UpperBound = true] @@ -377,7 +377,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "list2", @Name = "list2", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "MyClass"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] @@ -389,14 +389,14 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "", @Empty = true, @Image = "\"\"", @Length = 0, @LiteralText = "\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "theTryWithResourcesStatement", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- ThrowsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "IOException"] | +- Block[@Empty = false, @Size = 7, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "path"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "path", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -405,7 +405,7 @@ | | +- ResourceList[@Empty = false, @Size = 1, @TrailingSemiColon = false] | | | +- Resource[@ConciseResource = false, @StableName = "br"] | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "BufferedReader"] | | | +- VariableDeclarator[@Initializer = true, @Name = "br"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "br", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -418,7 +418,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "path", @Name = "path", @ParenthesisDepth = 0, @Parenthesized = false] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "first"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "first", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -426,19 +426,19 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "br", @Name = "br", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "outputFileName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "outputFileName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "/foo-out", @Empty = false, @Image = "\"/foo-out\"", @Length = 8, @LiteralText = "\"/foo-out\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "zipFileName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "zipFileName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "/foo.zip", @Empty = false, @Image = "\"/foo.zip\"", @Length = 8, @LiteralText = "\"/foo.zip\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = true, @SimpleName = "Charset"] | | +- VariableDeclarator[@Initializer = true, @Name = "charset"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "charset", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -448,7 +448,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "US-ASCII", @Empty = false, @Image = "\"US-ASCII\"", @Length = 8, @LiteralText = "\"US-ASCII\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = true, @SimpleName = "Path"] | | +- VariableDeclarator[@Initializer = true, @Name = "outputFilePath"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "outputFilePath", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -461,7 +461,7 @@ | +- ResourceList[@Empty = false, @Size = 2, @TrailingSemiColon = false] | | +- Resource[@ConciseResource = false, @StableName = "zf"] | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = true, @SimpleName = "ZipFile"] | | | +- VariableDeclarator[@Initializer = true, @Name = "zf"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "zf", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -471,7 +471,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "zipFileName", @Name = "zipFileName", @ParenthesisDepth = 0, @Parenthesized = false] | | +- Resource[@ConciseResource = false, @StableName = "writer"] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = true, @SimpleName = "BufferedWriter"] | | +- VariableDeclarator[@Initializer = true, @Name = "writer"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "writer", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -485,7 +485,7 @@ | +- ForStatement[] | +- ForInit[] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Enumeration"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- WildcardType[@LowerBound = false, @UpperBound = true] @@ -500,7 +500,7 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "newLine"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "newLine", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -510,7 +510,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "line.separator", @Empty = false, @Image = "\"line.separator\"", @Length = 14, @LiteralText = "\"line.separator\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "zipEntryName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "zipEntryName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -533,7 +533,7 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "zipEntryName", @Name = "zipEntryName", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "catchingMultipleExceptionTypes", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- ThrowsList[@Empty = false, @Size = 2] @@ -556,7 +556,7 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- CatchClause[] | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = true, @Name = "ex", @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- UnionType[] | | | +- ClassType[@FullyQualified = false, @SimpleName = "IOException"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "SQLException"] @@ -569,12 +569,12 @@ | +- ThrowStatement[] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "ex", @Name = "ex", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "expressionInCastExpression", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] +- VariableDeclarator[@Initializer = true, @Name = "initialSizeGlobal"] +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "initialSizeGlobal", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.txt index ea7fbaf5dd..5def9e475a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.txt @@ -10,22 +10,22 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.function.Supplier", @ImportedSimpleName = "Supplier", @PackageName = "java.util.function", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.stream.Stream", @ImportedSimpleName = "Stream", @PackageName = "java.util.stream", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases18", @CanonicalName = "ParserCornerCases18", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ParserCornerCases18", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassBody[@Empty = false, @Size = 30] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "lambdas", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 24, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "FileFilter"] | | | +- VariableDeclarator[@Initializer = true, @Name = "java"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "java", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "File"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "endsWith", @MethodName = "endsWith", @ParenthesisDepth = 0, @Parenthesized = false] @@ -35,14 +35,14 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = ".java", @Empty = false, @Image = "\".java\"", @Length = 5, @LiteralText = "\".java\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "FileFilter"] | | | +- VariableDeclarator[@Initializer = true, @Name = "java2"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "java2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "endsWith", @MethodName = "endsWith", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "getName", @MethodName = "getName", @ParenthesisDepth = 0, @Parenthesized = false] @@ -51,14 +51,14 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = ".java", @Empty = false, @Image = "\".java\"", @Length = 5, @LiteralText = "\".java\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "FileFilter"] | | | +- VariableDeclarator[@Initializer = true, @Name = "java3"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "java3", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "endsWith", @MethodName = "endsWith", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "getName", @MethodName = "getName", @ParenthesisDepth = 0, @Parenthesized = false] @@ -67,14 +67,14 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = ".java", @Empty = false, @Image = "\".java\"", @Length = 5, @LiteralText = "\".java\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "FileFilter"] | | | +- VariableDeclarator[@Initializer = true, @Name = "java4"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "java4", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 1, @Parenthesized = true] | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "endsWith", @MethodName = "endsWith", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "getName", @MethodName = "getName", @ParenthesisDepth = 0, @Parenthesized = false] @@ -96,7 +96,7 @@ | | | +- LambdaExpression[@Arity = 1, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | | +- ExpressionStatement[] @@ -109,7 +109,7 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ArrayType[@ArrayDepth = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "FileFilter"] | | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -125,7 +125,7 @@ | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- MethodCall[@CompileTimeConstant = false, @Image = "exists", @MethodName = "exists", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "f", @Name = "f", @ParenthesisDepth = 0, @Parenthesized = false] @@ -133,7 +133,7 @@ | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- MethodCall[@CompileTimeConstant = false, @Image = "canRead", @MethodName = "canRead", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "f", @Name = "f", @ParenthesisDepth = 0, @Parenthesized = false] @@ -141,7 +141,7 @@ | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "startsWith", @MethodName = "startsWith", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "getName", @MethodName = "getName", @ParenthesisDepth = 0, @Parenthesized = false] @@ -161,7 +161,7 @@ | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- MethodCall[@CompileTimeConstant = false, @Image = "exists", @MethodName = "exists", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "f", @Name = "f", @ParenthesisDepth = 0, @Parenthesized = false] @@ -169,7 +169,7 @@ | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- MethodCall[@CompileTimeConstant = false, @Image = "canRead", @MethodName = "canRead", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "f", @Name = "f", @ParenthesisDepth = 0, @Parenthesized = false] @@ -177,7 +177,7 @@ | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "startsWith", @MethodName = "startsWith", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "getName", @MethodName = "getName", @ParenthesisDepth = 0, @Parenthesized = false] @@ -186,7 +186,7 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "q", @Empty = false, @Image = "\"q\"", @Length = 1, @LiteralText = "\"q\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableDeclarator[@Initializer = true, @Name = "user"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "user", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -200,7 +200,7 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "user.name", @Empty = false, @Image = "\"user.name\"", @Length = 9, @LiteralText = "\"user.name\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Callable"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -210,7 +210,7 @@ | | | +- LambdaParameterList[@Empty = true, @Size = 0] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "done", @Empty = false, @Image = "\"done\"", @Length = 4, @LiteralText = "\"done\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | | | +- VariableDeclarator[@Initializer = true, @Name = "r"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -225,7 +225,7 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "done", @Empty = false, @Image = "\"done\"", @Length = 4, @LiteralText = "\"done\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Supplier"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] @@ -244,7 +244,7 @@ | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "hi", @Empty = false, @Image = "\"hi\"", @Length = 2, @LiteralText = "\"hi\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BOOLEAN] | | | +- VariableDeclarator[@Initializer = true, @Name = "flag"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "flag", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -252,7 +252,7 @@ | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Callable"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] @@ -267,7 +267,7 @@ | | | +- LambdaParameterList[@Empty = true, @Size = 0] | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "42", @IntLiteral = true, @Integral = true, @LiteralText = "42", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 42.0, @ValueAsFloat = 42.0, @ValueAsInt = 42, @ValueAsLong = 42] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | | +- VariableDeclarator[@Initializer = true, @Name = "o"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -291,7 +291,7 @@ | | | | +- ArgumentList[@Empty = true, @Size = 0] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Comparator"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -300,10 +300,10 @@ | | | +- LambdaExpression[@Arity = 2, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "compareToIgnoreCase", @MethodName = "compareToIgnoreCase", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s1", @Name = "s1", @ParenthesisDepth = 0, @Parenthesized = false] @@ -315,17 +315,17 @@ | | | +- LambdaExpression[@Arity = 2, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "compareToIgnoreCase", @MethodName = "compareToIgnoreCase", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s1", @Name = "s1", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s2", @Name = "s2", @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Button"] | | | +- VariableDeclarator[@Initializer = true, @Name = "button"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "button", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -339,7 +339,7 @@ | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "e", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] @@ -350,7 +350,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "e", @Name = "e", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "initialSizeGlobal"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "initialSizeGlobal", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -364,7 +364,7 @@ | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "150.0", @IntLiteral = false, @Integral = false, @LiteralText = "150.0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 150.0, @ValueAsFloat = 150.0, @ValueAsInt = 150, @ValueAsLong = 150] | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "0.30", @IntLiteral = false, @Integral = false, @LiteralText = "0.30", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.3, @ValueAsFloat = 0.3, @ValueAsInt = 0, @ValueAsLong = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "BiConsumer"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 2] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -374,11 +374,11 @@ | | | +- LambdaExpression[@Arity = 2, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -386,7 +386,7 @@ | | | +- UnaryExpression[@CompileTimeConstant = false, @Operator = UnaryOp.POST_INCREMENT, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "BiConsumer"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 2] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -396,17 +396,17 @@ | | | +- LambdaExpression[@Arity = 2, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | | +- ExpressionStatement[] | | | +- UnaryExpression[@CompileTimeConstant = false, @Operator = UnaryOp.POST_INCREMENT, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "TriConsumer"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 3] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -417,15 +417,15 @@ | | | +- LambdaExpression[@Arity = 3, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 3] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Double"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "d", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -434,7 +434,7 @@ | | | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "d", @Name = "d", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "TriConsumer"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 3] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -445,13 +445,13 @@ | | +- LambdaExpression[@Arity = 3, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- LambdaParameterList[@Empty = false, @Size = 3] | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "d", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ExpressionStatement[] @@ -459,7 +459,7 @@ | | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "d", @Name = "d", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases18$TriConsumer", @CanonicalName = "ParserCornerCases18.TriConsumer", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "TriConsumer", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, abstract, static}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- Annotation[@SimpleName = "FunctionalInterface"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "FunctionalInterface"] | | +- TypeParameters[@Empty = false, @Size = 3] @@ -468,23 +468,23 @@ | | | +- TypeParameter[@Image = "C", @Name = "C", @TypeBound = false] | | +- ClassBody[@Empty = false, @Size = 1] | | +- MethodDeclaration[@Abstract = true, @Arity = 3, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "accept", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = ()] | | +- VoidType[] | | +- FormalParameters[@Empty = false, @Size = 3] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "B"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "b", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "C"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PACKAGE, @Static = false, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | | +- VariableDeclarator[@Initializer = true, @Name = "r1"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "r1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] @@ -499,7 +499,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "toDoLater", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -515,11 +515,11 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "later", @Empty = false, @Image = "\"later\"", @Length = 5, @LiteralText = "\"later\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "doPrivileged", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "PrivilegedAction"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -530,11 +530,11 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "action", @Name = "action", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "filterFiles", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | | +- VoidType[] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ArrayType[@ArrayDepth = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "FileFilter"] | | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -542,7 +542,7 @@ | | | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "filters", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "comparingByKey", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | | +- TypeParameters[@Empty = false, @Size = 2] | | | +- TypeParameter[@Image = "K", @Name = "K", @TypeBound = true] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Comparable"] @@ -571,10 +571,10 @@ | | +- LambdaExpression[@Arity = 2, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "c1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "c2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | +- MethodCall[@CompileTimeConstant = false, @Image = "compareTo", @MethodName = "compareTo", @ParenthesisDepth = 0, @Parenthesized = false] | | +- MethodCall[@CompileTimeConstant = false, @Image = "getKey", @MethodName = "getKey", @ParenthesisDepth = 0, @Parenthesized = false] @@ -585,12 +585,12 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "c2", @Name = "c2", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "methodReferences", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 8, @containsComment = true] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | | | +- VariableDeclarator[@Initializer = true, @Name = "r"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -599,14 +599,14 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "ParserCornerCases18"] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | | | +- VariableDeclarator[@Initializer = true, @Name = "r1"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodReference[@CompileTimeConstant = false, @ConstructorReference = false, @MethodName = "toDoLater", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "ParserCornerCases18"] | | | +- VariableDeclarator[@Initializer = true, @Name = "pc"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "pc", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -614,14 +614,14 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "ParserCornerCases18"] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | | | +- VariableDeclarator[@Initializer = true, @Name = "r11"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r11", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodReference[@CompileTimeConstant = false, @ConstructorReference = false, @MethodName = "toDoLater", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "pc", @Name = "pc", @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Supplier"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -630,7 +630,7 @@ | | | +- MethodReference[@CompileTimeConstant = false, @ConstructorReference = false, @MethodName = "toString", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- SuperExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | | | +- VariableDeclarator[@Initializer = true, @Name = "r2"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -638,7 +638,7 @@ | | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @SimpleName = "ParserCornerCases18"] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "IntFunction"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ArrayType[@ArrayDepth = 1] @@ -654,7 +654,7 @@ | | | +- ArrayDimensions[@Empty = false, @Size = 1] | | | +- ArrayTypeDim[@Varargs = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -666,10 +666,10 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "10", @IntLiteral = true, @Integral = true, @LiteralText = "10", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 10.0, @ValueAsFloat = 10.0, @ValueAsInt = 10, @ValueAsLong = 10] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases18$PmdMethodReferenceTest", @CanonicalName = "ParserCornerCases18.PmdMethodReferenceTest", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "PmdMethodReferenceTest", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | | +- ClassBody[@Empty = false, @Size = 3] | | +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PACKAGE, @Static = false, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Function"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 2] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] @@ -677,7 +677,7 @@ | | | +- VariableDeclarator[@Initializer = false, @Name = "theFunction"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "theFunction", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "PmdTest", @Name = "PmdTest", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- FormalParameters[@Empty = true, @Size = 0] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | | +- ExpressionStatement[] @@ -686,18 +686,18 @@ | | | +- MethodReference[@CompileTimeConstant = false, @ConstructorReference = false, @MethodName = "foo", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "foo", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ReturnStatement[] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "staticMethod", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | | +- ClassType[@FullyQualified = false, @SimpleName = "Runnable"] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -711,12 +711,12 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "run", @Empty = false, @Image = "\"run\"", @Length = 3, @LiteralText = "\"run\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "typeAnnotations", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 2, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableDeclarator[@Initializer = true, @Name = "myString"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "myString", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -726,7 +726,7 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "NonNull"] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "str", @Name = "str", @ParenthesisDepth = 0, @Parenthesized = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableDeclarator[@Initializer = true, @Name = "o"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -736,7 +736,7 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "Interned"] | | +- ArgumentList[@Empty = true, @Size = 0] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases18$UnmodifiableList", @CanonicalName = "ParserCornerCases18.UnmodifiableList", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "UnmodifiableList", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- TypeParameters[@Empty = false, @Size = 1] | | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | | +- ImplementsList[@Empty = false, @Size = 1] @@ -749,7 +749,7 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "Readonly"] | | +- ClassBody[@Empty = true, @Size = 0] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "monitorTemperature", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- ThrowsList[@Empty = false, @Size = 1] @@ -758,10 +758,10 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "Critical"] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases18$X", @CanonicalName = "ParserCornerCases18.X", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "X", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | | +- ClassBody[@Empty = false, @Size = 3] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "lambaWithIf", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- VoidType[] | | | +- FormalParameters[@Empty = true, @Size = 0] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -779,14 +779,14 @@ | | | | +- LambdaExpression[@Arity = 2, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "b", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- Block[@Empty = false, @Size = 3, @containsComment = false] | | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -812,7 +812,7 @@ | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "lambaWithIf2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- VoidType[] | | | +- FormalParameters[@Empty = true, @Size = 0] | | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -830,16 +830,16 @@ | | | | +- LambdaExpression[@Arity = 2, @BlockBody = true, @CompileTimeConstant = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "b", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | | +- Block[@Empty = false, @Size = 3, @containsComment = false] | | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -865,7 +865,7 @@ | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "lambdaWithPropertyAssignment", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -877,7 +877,7 @@ | | +- LambdaParameterList[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 2, @containsComment = true] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Request"] | | | +- VariableDeclarator[@Initializer = true, @Name = "request"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "request", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -890,7 +890,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "request", @Name = "request", @ParenthesisDepth = 0, @Parenthesized = false] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "42", @IntLiteral = true, @Integral = true, @LiteralText = "42", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 42.0, @ValueAsFloat = 42.0, @ValueAsInt = 42, @ValueAsLong = 42] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testWildCardWithAnnotation", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- ClassType[@FullyQualified = false, @SimpleName = "List"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- WildcardType[@LowerBound = false, @UpperBound = true] @@ -901,7 +901,7 @@ | | +- ReturnStatement[] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testAnnotationsToArrayElements", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -913,7 +913,7 @@ | | +- ReturnStatement[] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "getBytes", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | | +- ArrayType[@ArrayDepth = 1] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -925,7 +925,7 @@ | | +- ReturnStatement[] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "getEnum", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | | +- TypeParameters[@Empty = false, @Size = 1] | | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = true] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Enum"] @@ -939,7 +939,7 @@ | | +- ReturnStatement[] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "getNullableEnum", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | | +- TypeParameters[@Empty = false, @Size = 1] | | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] @@ -950,7 +950,7 @@ | | +- ReturnStatement[] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "createNonNullArray", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -967,7 +967,7 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "NonNull"] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "check", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | | +- TypeParameters[@Empty = false, @Size = 1] | | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | | +- ArrayType[@ArrayDepth = 2] @@ -977,7 +977,7 @@ | | | +- ArrayTypeDim[@Varargs = false] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ArrayType[@ArrayDepth = 2] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | | | +- ArrayDimensions[@Empty = false, @Size = 2] @@ -1001,7 +1001,7 @@ | | +- ReturnStatement[] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "arr", @Name = "arr", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "func", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- ClassType[@FullyQualified = false, @SimpleName = "Function"] | | +- FormalParameters[@Empty = true, @Size = 0] | | | +- ReceiverParameter[] @@ -1015,11 +1015,11 @@ | | +- Annotation[@SimpleName = "A"] | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "max", @Overridden = false, @Static = true, @Varargs = true, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @Varargs = true, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | | | +- ArrayType[@ArrayDepth = 1] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -1031,7 +1031,7 @@ | | +- ReturnStatement[] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] | +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "ParserCornerCases18$Anno", @CanonicalName = "ParserCornerCases18.Anno", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Anno", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{abstract, static}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = ()] | | | +- Annotation[@SimpleName = "Retention"] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Retention"] | | | | +- AnnotationMemberList[@Empty = false, @Size = 1] @@ -1046,12 +1046,12 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "TYPE_USE", @Name = "TYPE_USE", @ParenthesisDepth = 0, @Parenthesized = false] | | +- AnnotationTypeBody[@Empty = true, @Size = 0] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "testMultiDimArrayWithAnnotations", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -1072,25 +1072,25 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "NonNull"] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "methodWithReceiverParameter", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | | +- ReceiverParameter[] | | | +- ClassType[@FullyQualified = false, @SimpleName = "ParserCornerCases18"] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "methodWithReceiverAndOtherParameters", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- ReceiverParameter[] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "ParserCornerCases18"] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "other", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "methodWithReceiverParameterWithAnnotation", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- ReceiverParameter[] @@ -1098,12 +1098,12 @@ | | | | +- Annotation[@SimpleName = "AnnotatedUsage"] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "AnnotatedUsage"] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "other", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "ParserCornerCases18$AnnotatedUsage", @CanonicalName = "ParserCornerCases18.AnnotatedUsage", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "AnnotatedUsage", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, abstract, static}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- Annotation[@SimpleName = "Target"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Target"] | | | +- AnnotationMemberList[@Empty = false, @Size = 1] @@ -1112,37 +1112,37 @@ | | | +- AmbiguousName[@CompileTimeConstant = false, @Image = "ElementType", @Name = "ElementType", @ParenthesisDepth = 0, @Parenthesized = false] | | +- AnnotationTypeBody[@Empty = true, @Size = 0] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases18$Inner", @CanonicalName = "ParserCornerCases18.Inner", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Inner", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Inner", @Name = "Inner", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- FormalParameters[@Empty = true, @Size = 0] | | +- ReceiverParameter[] | | +- ClassType[@FullyQualified = false, @SimpleName = "ParserCornerCases18"] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "DefaultIterator", @CanonicalName = "DefaultIterator", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "DefaultIterator", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{abstract}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (JModifier.ABSTRACT), @ExplicitModifiers = ()] +- TypeParameters[@Empty = false, @Size = 1] | +- TypeParameter[@Image = "E", @Name = "E", @TypeBound = false] +- ClassBody[@Empty = false, @Size = 5] +- MethodDeclaration[@Abstract = true, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "hasNext", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.BOOLEAN] | +- FormalParameters[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = true, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "next", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "E"] | +- FormalParameters[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = true, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "remove", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "skip", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public, default}", @ExplicitModifiers = "{default}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.DEFAULT), @ExplicitModifiers = (JModifier.DEFAULT)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -1161,7 +1161,7 @@ | +- MethodCall[@CompileTimeConstant = false, @Image = "next", @MethodName = "next", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "staticInterfaceMethods", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchStatements.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchStatements.txt index 81526b0f54..1ee0d5297d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchStatements.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchStatements.txt @@ -1,14 +1,14 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SwitchStatements", @CanonicalName = "SwitchStatements", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SwitchStatements", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "myMethod", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 4, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "a"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchWithFallthrough.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchWithFallthrough.txt index 8bbb9b14a6..610f877edb 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchWithFallthrough.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchWithFallthrough.txt @@ -1,14 +1,14 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SwitchWithFallthrough", @CanonicalName = "SwitchWithFallthrough", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SwitchWithFallthrough", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "myMethod", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 2, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "a"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SynchronizedStmts.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SynchronizedStmts.txt index 0c35bbbbb2..557f881ed2 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SynchronizedStmts.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SynchronizedStmts.txt @@ -1,9 +1,9 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Sync", @CanonicalName = "Sync", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Sync", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "getInstance", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] From ca7e15c114f3b4143ad678bdafa9d18c46bb8e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 01:55:54 -0300 Subject: [PATCH 047/142] update output to sequences --- .../pmd/lang/apex/ast/InnerClassLocations.txt | 14 ++++---- .../lang/apex/ast/NullCoalescingOperator.txt | 2 +- .../lang/apex/ast/SafeNavigationOperator.txt | 32 +++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt index d75cb639d9..095e8b8803 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt @@ -1,29 +1,29 @@ +- ApexFile[@DefiningType = "InnerClassLocations", @RealLoc = true] - +- UserClass[@DefiningType = "InnerClassLocations", @Image = "InnerClassLocations", @InterfaceNames = null, @RealLoc = true, @SimpleName = "InnerClassLocations", @SuperClassName = ""] + +- UserClass[@DefiningType = "InnerClassLocations", @Image = "InnerClassLocations", @InterfaceNames = (), @RealLoc = true, @SimpleName = "InnerClassLocations", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- UserClass[@DefiningType = "InnerClassLocations.bar1", @Image = "bar1", @InterfaceNames = null, @RealLoc = true, @SimpleName = "bar1", @SuperClassName = ""] + +- UserClass[@DefiningType = "InnerClassLocations.bar1", @Image = "bar1", @InterfaceNames = (), @RealLoc = true, @SimpleName = "bar1", @SuperClassName = ""] | +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar1", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- Method[@Arity = 0, @CanonicalName = "m", @Constructor = false, @DefiningType = "InnerClassLocations.bar1", @Image = "m", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] | +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar1", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @Names = ("System", "out"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @Names = ("System", "out"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] - +- UserClass[@DefiningType = "InnerClassLocations.bar2", @Image = "bar2", @InterfaceNames = null, @RealLoc = true, @SimpleName = "bar2", @SuperClassName = ""] + +- UserClass[@DefiningType = "InnerClassLocations.bar2", @Image = "bar2", @InterfaceNames = (), @RealLoc = true, @SimpleName = "bar2", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar2", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Method[@Arity = 0, @CanonicalName = "m", @Constructor = false, @DefiningType = "InnerClassLocations.bar2", @Image = "m", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar2", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar2", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar2", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @Names = ("System", "out"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar2", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @Names = ("System", "out"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt index c064bf5032..2d0eca99ed 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt @@ -1,5 +1,5 @@ +- ApexFile[@DefiningType = "NullCoalescingOperator", @RealLoc = true] - +- UserClass[@DefiningType = "NullCoalescingOperator", @Image = "NullCoalescingOperator", @InterfaceNames = null, @RealLoc = true, @SimpleName = "NullCoalescingOperator", @SuperClassName = ""] + +- UserClass[@DefiningType = "NullCoalescingOperator", @Image = "NullCoalescingOperator", @InterfaceNames = (), @RealLoc = true, @SimpleName = "NullCoalescingOperator", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "NullCoalescingOperator", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Method[@Arity = 2, @CanonicalName = "leftOrRight", @Constructor = false, @DefiningType = "NullCoalescingOperator", @Image = "leftOrRight", @RealLoc = true, @ReturnType = "String", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "NullCoalescingOperator", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt index a31ee20f8e..226b07f37a 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt @@ -1,26 +1,26 @@ +- ApexFile[@DefiningType = "Foo", @RealLoc = true] - +- UserClass[@DefiningType = "Foo", @Image = "Foo", @InterfaceNames = null, @RealLoc = true, @SimpleName = "Foo", @SuperClassName = ""] + +- UserClass[@DefiningType = "Foo", @Image = "Foo", @InterfaceNames = (), @RealLoc = true, @SimpleName = "Foo", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Field[@DefiningType = "Foo", @Image = "x", @Name = "x", @RealLoc = true, @Type = "Integer", @Value = null] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Field[@DefiningType = "Foo", @Image = "profileUrl", @Name = "profileUrl", @RealLoc = true, @Type = "String", @Value = null] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- FieldDeclarationStatements[@DefiningType = "Foo", @RealLoc = true, @TypeArguments = null, @TypeName = "Integer"] + +- FieldDeclarationStatements[@DefiningType = "Foo", @RealLoc = true, @TypeArguments = (), @TypeName = "Integer"] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- FieldDeclaration[@DefiningType = "Foo", @Image = "x", @Name = "x", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "anIntegerField", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "anObject", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "x", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] - +- FieldDeclarationStatements[@DefiningType = "Foo", @RealLoc = true, @TypeArguments = null, @TypeName = "String"] + +- FieldDeclarationStatements[@DefiningType = "Foo", @RealLoc = true, @TypeArguments = (), @TypeName = "String"] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- FieldDeclaration[@DefiningType = "Foo", @Image = "profileUrl", @Name = "profileUrl", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "toExternalForm", @InputParametersSize = 0, @MethodName = "toExternalForm", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "user.getProfileUrl", @InputParametersSize = 0, @MethodName = "getProfileUrl", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "user", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "user", @Names = ("user"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "profileUrl", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- Method[@Arity = 1, @CanonicalName = "bar1", @Constructor = false, @DefiningType = "Foo", @Image = "bar1", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] @@ -30,15 +30,15 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "Foo", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "b", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "c1", @InputParametersSize = 0, @MethodName = "c1", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | +- CastExpression[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "b1", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "a1", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- Method[@Arity = 2, @CanonicalName = "bar2", @Constructor = false, @DefiningType = "Foo", @Image = "bar2", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] @@ -50,9 +50,9 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "Foo", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "aField", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] | | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = 0, @MethodName = "aMethod", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | | +- ArrayLoadExpression[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] @@ -60,9 +60,9 @@ | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "aField", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = 0, @MethodName = "aMethod", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- ArrayLoadExpression[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] @@ -77,14 +77,14 @@ | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- VariableDeclaration[@DefiningType = "Foo", @Image = "s", @RealLoc = true, @Type = "String"] | +- VariableExpression[@DefiningType = "Foo", @Image = "BillingCity", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "Account", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "contact", @Names = null, @RealLoc = true, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "contact", @Names = ("contact"), @RealLoc = true, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "s", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- ReturnStatement[@DefiningType = "Foo", @RealLoc = true] +- VariableExpression[@DefiningType = "Foo", @Image = "Name", @RealLoc = true] - +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = null, @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] +- SoqlExpression[@CanonicalQuery = "SELECT Name FROM Account WHERE Id = :tmpVar1", @DefiningType = "Foo", @Query = "SELECT Name FROM Account WHERE Id = :accId", @RealLoc = true] +- BindExpressions[@DefiningType = "Foo", @RealLoc = true] +- VariableExpression[@DefiningType = "Foo", @Image = "accId", @RealLoc = true] From 0d32ac8aa1196ad602c9aab44760c3ba289316fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 02:02:49 -0300 Subject: [PATCH 048/142] Update more tree dump tests --- .../java14/MultipleCaseLabels.txt | 22 +-- .../java14/SimpleSwitchExpressions.txt | 32 ++-- .../java14/SwitchExpressions.txt | 50 +++---- .../jdkversiontests/java14/SwitchRules.txt | 22 +-- .../java14/YieldStatements.txt | 4 +- .../java15/NonSealedIdentifier.txt | 12 +- .../ast/jdkversiontests/java15/TextBlocks.txt | 42 +++--- .../LocalClassAndInterfaceDeclarations.txt | 16 +- .../jdkversiontests/java16/LocalRecords.txt | 58 ++++---- .../java16/NonSealedIdentifier.txt | 12 +- .../java16/PatternMatchingInstanceof.txt | 34 ++--- .../java/ast/jdkversiontests/java16/Point.txt | 12 +- .../ast/jdkversiontests/java16/Records.txt | 70 ++++----- .../ast/jdkversiontests/java17/LocalVars.txt | 6 +- .../java17/SealedInnerClasses.txt | 10 +- .../java17/expression/Expr.txt | 4 +- .../jdkversiontests/java17/geometry/Shape.txt | 4 +- .../java17/geometry/Square.txt | 4 +- .../java21/AnnotationValueInitializers.txt | 4 +- .../java21/DealingWithNull.txt | 40 ++--- .../java21/EnhancedTypeCheckingSwitch.txt | 34 ++--- .../java21/ExhaustiveSwitch.txt | 62 ++++---- .../java21/GuardedPatterns.txt | 54 +++---- .../java21/Jep440_RecordPatterns.txt | 102 ++++++------- .../Jep441_PatternMatchingForSwitch.txt | 88 +++++------ .../java21/PatternsInSwitchLabels.txt | 18 +-- .../jdkversiontests/java21/RecordPatterns.txt | 140 +++++++++--------- .../java21/RecordPatternsExhaustiveSwitch.txt | 56 +++---- .../java21/RefiningPatternsInSwitch.txt | 46 +++--- .../ScopeOfPatternVariableDeclarations.txt | 28 ++-- .../java21p/Jep430_StringTemplates.txt | 124 ++++++++-------- .../Jep443_UnnamedPatternsAndVariables.txt | 130 ++++++++-------- .../java21p/Jep445_UnnamedClasses1.txt | 2 +- .../java21p/Jep445_UnnamedClasses2.txt | 4 +- .../java21p/Jep445_UnnamedClasses3.txt | 4 +- .../Jep456_UnnamedPatternsAndVariables.txt | 130 ++++++++-------- .../java22p/Jep447_StatementsBeforeSuper.txt | 76 +++++----- .../java22p/Jep459_StringTemplates.txt | 124 ++++++++-------- .../java22p/Jep463_UnnamedClasses1.txt | 2 +- .../java22p/Jep463_UnnamedClasses2.txt | 4 +- .../java22p/Jep463_UnnamedClasses3.txt | 4 +- .../Jep463_UnnamedClasses4WithImports.txt | 4 +- 42 files changed, 847 insertions(+), 847 deletions(-) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/MultipleCaseLabels.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/MultipleCaseLabels.txt index 4018308d53..918c051e17 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/MultipleCaseLabels.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/MultipleCaseLabels.txt @@ -1,55 +1,55 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "MultipleCaseLabels", @CanonicalName = "MultipleCaseLabels", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "MultipleCaseLabels", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 8] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "MONDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "MONDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "TUESDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "TUESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "WEDNESDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "WEDNESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "THURSDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "THURSDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "4", @IntLiteral = true, @Integral = true, @LiteralText = "4", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 4.0, @ValueAsFloat = 4.0, @ValueAsInt = 4, @ValueAsLong = 4] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "FRIDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "FRIDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "5", @IntLiteral = true, @Integral = true, @LiteralText = "5", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 5.0, @ValueAsFloat = 5.0, @ValueAsInt = 5, @ValueAsLong = 5] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "SATURDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SATURDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "6", @IntLiteral = true, @Integral = true, @LiteralText = "6", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 6.0, @ValueAsFloat = 6.0, @ValueAsInt = 6, @ValueAsLong = 6] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "SUNDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SUNDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "7", @IntLiteral = true, @Integral = true, @LiteralText = "7", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 7.0, @ValueAsFloat = 7.0, @ValueAsInt = 7, @ValueAsLong = 7] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -57,7 +57,7 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 2, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "day"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "day", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SimpleSwitchExpressions.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SimpleSwitchExpressions.txt index cc10dae8d4..e60528906c 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SimpleSwitchExpressions.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SimpleSwitchExpressions.txt @@ -1,55 +1,55 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SimpleSwitchExpressions", @CanonicalName = "SimpleSwitchExpressions", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SimpleSwitchExpressions", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 9] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "MONDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "MONDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "TUESDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "TUESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "WEDNESDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "WEDNESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "THURSDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "THURSDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "4", @IntLiteral = true, @Integral = true, @LiteralText = "4", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 4.0, @ValueAsFloat = 4.0, @ValueAsInt = 4, @ValueAsLong = 4] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "FRIDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "FRIDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "5", @IntLiteral = true, @Integral = true, @LiteralText = "5", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 5.0, @ValueAsFloat = 5.0, @ValueAsInt = 5, @ValueAsLong = 5] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "SATURDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SATURDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "6", @IntLiteral = true, @Integral = true, @LiteralText = "6", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 6.0, @ValueAsFloat = 6.0, @ValueAsInt = 6, @ValueAsLong = 6] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "SUNDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SUNDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "7", @IntLiteral = true, @Integral = true, @LiteralText = "7", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 7.0, @ValueAsFloat = 7.0, @ValueAsInt = 7, @ValueAsLong = 7] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -57,13 +57,13 @@ | | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 3, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "day"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "day", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = true, @Image = "FRIDAY", @Name = "FRIDAY", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "numLetters"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "numLetters", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- SwitchExpression[@CompileTimeConstant = false, @DefaultCase = true, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = false, @ParenthesisDepth = 0, @Parenthesized = false] @@ -91,7 +91,7 @@ | | +- SwitchLabel[@Default = true] | | +- Block[@Empty = false, @Size = 3, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "k"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "k", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -99,7 +99,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "day", @Name = "day", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "result"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -117,11 +117,11 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "NumLetters: %d%n", @Empty = false, @Image = "\"NumLetters: %d%n\"", @Length = 16, @LiteralText = "\"NumLetters: %d%n\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "numLetters", @Name = "numLetters", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "f", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] - +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "k", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchExpressions.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchExpressions.txt index 43c635bcd7..408ae2734d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchExpressions.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchExpressions.txt @@ -1,43 +1,43 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SwitchExpressions", @CanonicalName = "SwitchExpressions", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SwitchExpressions", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 6] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SwitchExpressions$Day", @CanonicalName = "SwitchExpressions.Day", @EffectiveVisibility = Visibility.V_PRIVATE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Day", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE)] | +- EnumBody[@Empty = false, @SeparatorSemi = true, @Size = 7, @TrailingComma = false] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PRIVATE, @Image = "MONDAY", @MethodName = "new", @Name = "MONDAY", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "MONDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PRIVATE, @Image = "TUESDAY", @MethodName = "new", @Name = "TUESDAY", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "TUESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PRIVATE, @Image = "WEDNESDAY", @MethodName = "new", @Name = "WEDNESDAY", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "WEDNESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PRIVATE, @Image = "THURSDAY", @MethodName = "new", @Name = "THURSDAY", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "THURSDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PRIVATE, @Image = "FRIDAY", @MethodName = "new", @Name = "FRIDAY", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "FRIDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PRIVATE, @Image = "SATURDAY", @MethodName = "new", @Name = "SATURDAY", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SATURDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PRIVATE, @Image = "SUNDAY", @MethodName = "new", @Name = "SUNDAY", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SUNDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PUBLIC, @Static = true, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "BAZ"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PUBLIC, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "BAZ", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PUBLIC] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -45,7 +45,7 @@ | | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 15, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Day"] | | +- VariableDeclarator[@Initializer = true, @Name = "day"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "day", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -94,7 +94,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "9", @IntLiteral = true, @Integral = true, @LiteralText = "9", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 9.0, @ValueAsFloat = 9.0, @ValueAsInt = 9, @ValueAsLong = 9] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "numLetters"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "numLetters", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -152,7 +152,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "j"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "j", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -170,7 +170,7 @@ | | +- SwitchLabel[@Default = true] | | +- Block[@Empty = false, @Size = 3, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "k"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "k", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -180,7 +180,7 @@ | | | | +- ArgumentList[@Empty = true, @Size = 0] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "result"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -198,13 +198,13 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "j=%d%n", @Empty = false, @Image = "\"j=%d%n\"", @Length = 6, @LiteralText = "\"j=%d%n\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "j", @Name = "j", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Foo", @Empty = false, @Image = "\"Foo\"", @Length = 3, @LiteralText = "\"Foo\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "result"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -247,11 +247,11 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "result=%d%n", @Empty = false, @Image = "\"result=%d%n\"", @Length = 11, @LiteralText = "\"result=%d%n\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "result", @Name = "result", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "howMany", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "k", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -284,11 +284,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "many", @Empty = false, @Image = "\"many\"", @Length = 4, @LiteralText = "\"many\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "howManyExpr", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "k", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -312,11 +312,11 @@ | +- SwitchLabel[@Default = true] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "many", @Empty = false, @Image = "\"many\"", @Length = 4, @LiteralText = "\"many\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "f", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] - +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "k", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchRules.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchRules.txt index 6c25858d7a..f14d4f4dbd 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchRules.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchRules.txt @@ -1,55 +1,55 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SwitchRules", @CanonicalName = "SwitchRules", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SwitchRules", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 8] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "MONDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "MONDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "TUESDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "TUESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "WEDNESDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "WEDNESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "THURSDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "THURSDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "4", @IntLiteral = true, @Integral = true, @LiteralText = "4", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 4.0, @ValueAsFloat = 4.0, @ValueAsInt = 4, @ValueAsLong = 4] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "FRIDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "FRIDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "5", @IntLiteral = true, @Integral = true, @LiteralText = "5", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 5.0, @ValueAsFloat = 5.0, @ValueAsInt = 5, @ValueAsLong = 5] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "SATURDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SATURDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "6", @IntLiteral = true, @Integral = true, @LiteralText = "6", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 6.0, @ValueAsFloat = 6.0, @ValueAsInt = 6, @ValueAsLong = 6] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "SUNDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SUNDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "7", @IntLiteral = true, @Integral = true, @LiteralText = "7", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 7.0, @ValueAsFloat = 7.0, @ValueAsInt = 7, @ValueAsLong = 7] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -57,7 +57,7 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 2, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "day"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "day", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/YieldStatements.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/YieldStatements.txt index 6d34dc9515..e054f1877b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/YieldStatements.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/YieldStatements.txt @@ -1,11 +1,11 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "YieldStatements", @CanonicalName = "YieldStatements", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "YieldStatements", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- Initializer[@Static = false] +- Block[@Empty = false, @Size = 5, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "yield"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "yield", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/NonSealedIdentifier.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/NonSealedIdentifier.txt index 1abb1176b2..260983fffe 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/NonSealedIdentifier.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/NonSealedIdentifier.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "NonSealedIdentifier", @CanonicalName = "NonSealedIdentifier", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "NonSealedIdentifier", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -15,19 +15,19 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 5, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "result"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "non"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "non", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "sealed"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "sealed", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/TextBlocks.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/TextBlocks.txt index 82ad86c833..d1c329260a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/TextBlocks.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/TextBlocks.txt @@ -2,14 +2,14 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "javax.script.ScriptEngine", @ImportedSimpleName = "ScriptEngine", @PackageName = "javax.script", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "javax.script.ScriptEngineManager", @ImportedSimpleName = "ScriptEngineManager", @PackageName = "javax.script", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "TextBlocks", @CanonicalName = "TextBlocks", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "TextBlocks", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -19,7 +19,7 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "Exception"] +- Block[@Empty = false, @Size = 25, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "html"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "html", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -32,7 +32,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "html", @Name = "html", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "query"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "query", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -45,7 +45,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "query", @Name = "query", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "ScriptEngine"] | +- VariableDeclarator[@Initializer = true, @Name = "engine"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "engine", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -56,7 +56,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "js", @Empty = false, @Image = "\"js\"", @Length = 2, @LiteralText = "\"js\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | +- VariableDeclarator[@Initializer = true, @Name = "obj"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -65,7 +65,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "function hello() {\n print(\'\"Hello, world\"\');\n}\n\nhello();\n", @Empty = false, @Image = "\"\"\"\n function hello() {\n print(\'\"Hello, world\"\');\n }\n \n hello();\n \"\"\"", @Length = 60, @LiteralText = "\"\"\"\n function hello() {\n print(\'\"Hello, world\"\');\n }\n \n hello();\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "htmlWithEscapes"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "htmlWithEscapes", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -78,61 +78,61 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "htmlWithEscapes", @Name = "htmlWithEscapes", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "season"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "season", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "winter", @Empty = false, @Image = "\"\"\"\n winter\"\"\"", @Length = 6, @LiteralText = "\"\"\"\n winter\"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "period"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "period", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "winter\n", @Empty = false, @Image = "\"\"\"\n winter\n \"\"\"", @Length = 7, @LiteralText = "\"\"\"\n winter\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "greeting"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "greeting", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hi, \"Bob\"\n", @Empty = false, @Image = "\"\"\"\n Hi, \"Bob\"\n \"\"\"", @Length = 10, @LiteralText = "\"\"\"\n Hi, \"Bob\"\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "salutation"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "salutation", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hi,\n \"Bob\"\n", @Empty = false, @Image = "\"\"\"\n Hi,\n \"Bob\"\n \"\"\"", @Length = 11, @LiteralText = "\"\"\"\n Hi,\n \"Bob\"\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "empty"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "empty", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "", @Empty = true, @Image = "\"\"\"\n \"\"\"", @Length = 0, @LiteralText = "\"\"\"\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "quote"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "quote", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "\"\n", @Empty = false, @Image = "\"\"\"\n \"\n \"\"\"", @Length = 2, @LiteralText = "\"\"\"\n \"\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "backslash"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "backslash", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "\\\n", @Empty = false, @Image = "\"\"\"\n \\\\\n \"\"\"", @Length = 2, @LiteralText = "\"\"\"\n \\\\\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "normalStringLiteral"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "normalStringLiteral", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "test", @Empty = false, @Image = "\"test\"", @Length = 4, @LiteralText = "\"test\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "code"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "code", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "String text = \"\"\"\n A text block inside a text block\n\"\"\";\n", @Empty = false, @Image = "\"\"\"\n String text = \\\"\"\"\n A text block inside a text block\n \\\"\"\";\n \"\"\"", @Length = 60, @LiteralText = "\"\"\"\n String text = \\\"\"\"\n A text block inside a text block\n \\\"\"\";\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "text"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "text", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -145,7 +145,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "text", @Name = "text", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "colors"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "colors", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -158,7 +158,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "colors", @Name = "colors", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "emptyLine"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "emptyLine", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -175,7 +175,7 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "\n", @Empty = false, @Image = "\"\\n\"", @Length = 1, @LiteralText = "\"\\n\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "", @Empty = false, @Image = "\"\"", @Length = 4, @LiteralText = "\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "bs"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "bs", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalClassAndInterfaceDeclarations.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalClassAndInterfaceDeclarations.txt index c1283873bf..f92cdd9cbf 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalClassAndInterfaceDeclarations.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalClassAndInterfaceDeclarations.txt @@ -1,37 +1,37 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalClassAndInterfaceDeclarations", @CanonicalName = "LocalClassAndInterfaceDeclarations", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "LocalClassAndInterfaceDeclarations", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- Initializer[@Static = false] +- Block[@Empty = false, @Size = 3, @containsComment = true] +- LocalClassStatement[] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalClassAndInterfaceDeclarations$1MyLocalClass", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = false, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "MyLocalClass", @Static = false, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 3] | +- FieldDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Static = true, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{static, final}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "constantField"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "constantField", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] | +- FieldDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Static = true, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = false, @Name = "staticField"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "staticField", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Name = "staticMethod", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- LocalClassStatement[] | +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "LocalClassAndInterfaceDeclarations$1MyLocalInterface", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = false, @Interface = true, @Local = true, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "MyLocalInterface", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{abstract, static}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = ()] | +- ClassBody[@Empty = true, @Size = 0] +- LocalClassStatement[] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalClassAndInterfaceDeclarations$1MyLocalEnum", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = true, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "MyLocalEnum", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] +- EnumBody[@Empty = false, @SeparatorSemi = false, @Size = 1, @TrailingComma = false] +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_LOCAL, @Image = "A", @MethodName = "new", @Name = "A", @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "A", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalRecords.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalRecords.txt index bcdde4efd6..469d4d8963 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalRecords.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalRecords.txt @@ -2,53 +2,53 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.stream.Collectors", @ImportedSimpleName = "Collectors", @PackageName = "java.util.stream", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.List", @ImportedSimpleName = "List", @PackageName = "java.util", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalRecords", @CanonicalName = "LocalRecords", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "LocalRecords", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 6] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "LocalRecords$Merchant", @CanonicalName = "LocalRecords.Merchant", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "Merchant", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, abstract, static}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 2, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "computeSales", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | +- FormalParameters[@Empty = false, @Size = 2] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Merchant"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "merchant", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "month", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "month", @Name = "month", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 2, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "findTopMerchants", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "List"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Merchant"] | +- FormalParameters[@Empty = false, @Size = 2] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "List"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Merchant"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "merchants", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "month", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalClassStatement[] | | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalRecords$1MerchantSales", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "MerchantSales", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Merchant"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "merchant", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "sales", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = true, @Size = 0] @@ -64,7 +64,7 @@ | | | | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "merchant", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "MerchantSales"] @@ -78,10 +78,10 @@ | | | +- LambdaExpression[@Arity = 2, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "m1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "m2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "compare", @MethodName = "compare", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] @@ -103,78 +103,78 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Collectors"] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "methodWithLocalRecordAndModifiers", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 4, @containsComment = false] | +- LocalClassStatement[] | | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalRecords$1MyRecord1", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "MyRecord1", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{final}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = true, @Size = 0] | +- LocalClassStatement[] | | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalRecords$1MyRecord2", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "MyRecord2", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{static, final}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] | | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = true, @Size = 0] | +- LocalClassStatement[] | | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalRecords$1MyRecord3", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "MyRecord3", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- Annotation[@SimpleName = "Deprecated"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Deprecated"] | | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = true, @Size = 0] | +- LocalClassStatement[] | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalRecords$1MyRecord4", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "MyRecord4", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] | | +- Annotation[@SimpleName = "Deprecated"] | | +- ClassType[@FullyQualified = false, @SimpleName = "Deprecated"] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "methodWithLocalClass", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- LocalClassStatement[] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalRecords$1MyLocalClass", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = false, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "MyLocalClass", @Static = false, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "methodWithLocalVarsNamedSealed", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 5, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "result"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "non"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "non", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "sealed"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "sealed", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/NonSealedIdentifier.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/NonSealedIdentifier.txt index 1abb1176b2..260983fffe 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/NonSealedIdentifier.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/NonSealedIdentifier.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "NonSealedIdentifier", @CanonicalName = "NonSealedIdentifier", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "NonSealedIdentifier", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -15,19 +15,19 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 5, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "result"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "non"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "non", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "sealed"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "sealed", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt index 542a7e19ae..8194cb8681 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt @@ -10,21 +10,21 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.lang.annotation.ElementType", @ImportedSimpleName = "ElementType", @PackageName = "java.lang.annotation", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.lang.annotation.Target", @ImportedSimpleName = "Target", @PackageName = "java.lang.annotation", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "PatternMatchingInstanceof", @CanonicalName = "PatternMatchingInstanceof", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "PatternMatchingInstanceof", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 5] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = false, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "s"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "other string", @Empty = false, @Image = "\"other string\"", @Length = 12, @LiteralText = "\"other string\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "test", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 8, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableDeclarator[@Initializer = true, @Name = "obj"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -34,7 +34,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 3, @containsComment = false] @@ -86,7 +86,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = true] @@ -119,7 +119,7 @@ | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false] @@ -145,7 +145,7 @@ | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false] @@ -170,7 +170,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = true] @@ -202,7 +202,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- Annotation[@SimpleName = "Deprecated"] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Deprecated"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -236,7 +236,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | | | +- Annotation[@SimpleName = "Deprecated"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Deprecated"] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -266,11 +266,11 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -284,18 +284,18 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- ArgumentList[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "PatternMatchingInstanceof$Foo", @CanonicalName = "PatternMatchingInstanceof.Foo", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Foo", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = false, @Size = 1] | +- Initializer[@Static = false] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableDeclarator[@Initializer = true, @Name = "f"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | +- VariableDeclarator[@Initializer = true, @Name = "o"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -306,7 +306,7 @@ | +- Annotation[@SimpleName = "Nullable"] | +- ClassType[@FullyQualified = false, @SimpleName = "Nullable"] +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "PatternMatchingInstanceof$Nullable", @CanonicalName = "PatternMatchingInstanceof.Nullable", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Nullable", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{abstract, static}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = ()] | +- Annotation[@SimpleName = "Target"] | +- ClassType[@FullyQualified = false, @SimpleName = "Target"] | +- AnnotationMemberList[@Empty = false, @Size = 1] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt index 9adda51364..f7a424ed09 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt @@ -1,22 +1,22 @@ +- CompilationUnit[@PackageName = ""] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Point", @CanonicalName = "Point", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Point", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, final}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] +- RecordBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -24,7 +24,7 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 2, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | +- VariableDeclarator[@Initializer = true, @Name = "p"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "p", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt index 5a8b4f6a10..a06d3dde50 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt @@ -4,10 +4,10 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.lang.annotation.ElementType", @ImportedSimpleName = "ElementType", @PackageName = "java.lang.annotation", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.Objects", @ImportedSimpleName = "Objects", @PackageName = "java.util", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records", @CanonicalName = "Records", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Records", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 10] +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "Records$Nullable", @CanonicalName = "Records.Nullable", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Nullable", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{abstract, static}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = ()] | | +- Annotation[@SimpleName = "Target"] | | +- ClassType[@FullyQualified = false, @SimpleName = "Target"] | | +- AnnotationMemberList[@Empty = false, @Size = 1] @@ -17,7 +17,7 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "ElementType"] | +- AnnotationTypeBody[@Empty = true, @Size = 0] +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "Records$MyAnnotation", @CanonicalName = "Records.MyAnnotation", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "MyAnnotation", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{abstract, static}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = ()] | | +- Annotation[@SimpleName = "Target"] | | +- ClassType[@FullyQualified = false, @SimpleName = "Target"] | | +- AnnotationMemberList[@Empty = false, @Size = 1] @@ -31,32 +31,32 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "ElementType"] | +- AnnotationTypeBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$MyComplex", @CanonicalName = "Records.MyComplex", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "MyComplex", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "real", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- Annotation[@SimpleName = "Deprecated"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Deprecated"] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "imaginary", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = false, @Size = 3] | +- ConstructorDeclaration[@Abstract = false, @Arity = 2, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "MyComplex", @Name = "MyComplex", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- Annotation[@SimpleName = "MyAnnotation"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "MyAnnotation"] | | +- FormalParameters[@Empty = false, @Size = 2] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- Annotation[@SimpleName = "MyAnnotation"] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "MyAnnotation"] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "real", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "imaginary", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 3, @containsComment = false] @@ -80,30 +80,30 @@ | | | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "imaginary", @Name = "imaginary", @ParenthesisDepth = 0, @Parenthesized = false] | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$MyComplex$Nested", @CanonicalName = "Records.MyComplex.Nested", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Nested", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = true, @Size = 0] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$MyComplex$NestedClass", @CanonicalName = "Records.MyComplex.NestedClass", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "NestedClass", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- ClassBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$Range", @CanonicalName = "Records.Range", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Range", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lo", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "hi", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = false, @Size = 2] | +- CompactConstructorDeclaration[@EffectiveVisibility = Visibility.V_PUBLIC, @Image = "Range", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- Annotation[@SimpleName = "MyAnnotation"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "MyAnnotation"] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -123,20 +123,20 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "lo", @Name = "lo", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "hi", @Name = "hi", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "foo", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$RecordWithLambdaInCompactConstructor", @CanonicalName = "Records.RecordWithLambdaInCompactConstructor", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "RecordWithLambdaInCompactConstructor", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "foo", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = false, @Size = 1] | +- CompactConstructorDeclaration[@EffectiveVisibility = Visibility.V_PUBLIC, @Image = "RecordWithLambdaInCompactConstructor", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExpressionStatement[] | +- MethodCall[@CompileTimeConstant = false, @Image = "requireNonNull", @MethodName = "requireNonNull", @ParenthesisDepth = 0, @Parenthesized = false] @@ -148,10 +148,10 @@ | +- LambdaParameterList[@Empty = true, @Size = 0] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "foo", @Empty = false, @Image = "\"foo\"", @Length = 3, @LiteralText = "\"foo\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$VarRec", @CanonicalName = "Records.VarRec", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "VarRec", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = true] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = true, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- Annotation[@SimpleName = "Nullable"] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Nullable"] | | | +- Annotation[@SimpleName = "Deprecated"] @@ -165,10 +165,10 @@ | | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$ArrayRec", @CanonicalName = "Records.ArrayRec", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "ArrayRec", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -176,30 +176,30 @@ | | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$EmptyRec", @CanonicalName = "Records.EmptyRec", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "EmptyRec", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "Type", @Name = "Type", @TypeBound = false] | +- RecordComponentList[@Empty = true, @Size = 0, @Varargs = false] | +- RecordBody[@Empty = false, @Size = 3] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "foo", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "bar", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- ClassType[@FullyQualified = false, @SimpleName = "Type"] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ReturnStatement[] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "baz", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "EmptyRec"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -217,25 +217,25 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "r", @Name = "r", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "Records$Person", @CanonicalName = "Records.Person", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "Person", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, abstract, static}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassBody[@Empty = false, @Size = 2] | +- MethodDeclaration[@Abstract = true, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "firstName", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- FormalParameters[@Empty = true, @Size = 0] | +- MethodDeclaration[@Abstract = true, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "lastName", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public, abstract}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- FormalParameters[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Records$PersonRecord", @CanonicalName = "Records.PersonRecord", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "PersonRecord", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "firstName", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lastName", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] +- ImplementsList[@Empty = false, @Size = 2] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt index f1dab975b5..55a5d5f606 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt @@ -1,14 +1,14 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "LocalVars", @CanonicalName = "LocalVars", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "LocalVars", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "aMethod", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 2, @containsComment = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "sealed"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "sealed", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/SealedInnerClasses.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/SealedInnerClasses.txt index 1ca67aec27..03417524db 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/SealedInnerClasses.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/SealedInnerClasses.txt @@ -1,24 +1,24 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SealedInnerClasses", @CanonicalName = "SealedInnerClasses", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SealedInnerClasses", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 2] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SealedInnerClasses$Square", @CanonicalName = "SealedInnerClasses.Square", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Square", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{sealed}", @ExplicitModifiers = "{sealed}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED), @ExplicitModifiers = (JModifier.SEALED)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Squircle"] | +- ClassBody[@Empty = false, @Size = 2] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SealedInnerClasses$Square$OtherSquare", @CanonicalName = "SealedInnerClasses.Square.OtherSquare", @EffectiveVisibility = Visibility.V_PRIVATE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "OtherSquare", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, non-sealed}", @ExplicitModifiers = "{private, non-sealed}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.NON_SEALED), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.NON_SEALED)] | | +- ExtendsList[@Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Square"] | | +- ClassBody[@Empty = true, @Size = 0] | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SealedInnerClasses$Square$StaticClass", @CanonicalName = "SealedInnerClasses.Square.StaticClass", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "StaticClass", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{non-sealed, static}", @ExplicitModifiers = "{non-sealed, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.NON_SEALED, JModifier.STATIC), @ExplicitModifiers = (JModifier.NON_SEALED, JModifier.STATIC)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Squircle"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "SealedInnerClasses$Squircle", @CanonicalName = "SealedInnerClasses.Squircle", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "Squircle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{sealed, abstract, static}", @ExplicitModifiers = "{sealed}"] + +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.SEALED)] +- PermitsList[@Empty = false, @Size = 2] | +- ClassType[@FullyQualified = false, @SimpleName = "Square"] | +- ClassType[@FullyQualified = false, @SimpleName = "StaticClass"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.txt index 51c3723317..016661bb86 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/expression/Expr.txt @@ -1,8 +1,8 @@ +- CompilationUnit[@PackageName = "com.example.expression"] +- PackageDeclaration[@Name = "com.example.expression"] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "com.example.expression.Expr", @CanonicalName = "com.example.expression.Expr", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = false, @PackageName = "com.example.expression", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "Expr", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, sealed, abstract}", @ExplicitModifiers = "{public, sealed}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.SEALED, JModifier.ABSTRACT), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.SEALED)] +- PermitsList[@Empty = false, @Size = 4] | +- ClassType[@FullyQualified = false, @SimpleName = "ConstantExpr"] | +- ClassType[@FullyQualified = false, @SimpleName = "PlusExpr"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt index 75e751d3a5..f66d9db66f 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt @@ -1,8 +1,8 @@ +- CompilationUnit[@PackageName = "com.example.geometry"] +- PackageDeclaration[@Name = "com.example.geometry"] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.example.geometry.Shape", @CanonicalName = "com.example.geometry.Shape", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "com.example.geometry", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Shape", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, sealed}", @ExplicitModifiers = "{public, sealed}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.SEALED), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.SEALED)] +- PermitsList[@Empty = false, @Size = 3] | +- ClassType[@FullyQualified = false, @SimpleName = "Circle"] | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.txt index 35eac43c54..f5fe375c73 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Square.txt @@ -1,8 +1,8 @@ +- CompilationUnit[@PackageName = "com.example.geometry"] +- PackageDeclaration[@Name = "com.example.geometry"] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.example.geometry.Square", @CanonicalName = "com.example.geometry.Square", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "com.example.geometry", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Square", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, non-sealed}", @ExplicitModifiers = "{public, non-sealed}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.NON_SEALED), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.NON_SEALED)] +- ExtendsList[@Empty = false, @Size = 1] | +- ClassType[@FullyQualified = false, @SimpleName = "Shape"] +- ClassBody[@Empty = true, @Size = 0] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/AnnotationValueInitializers.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/AnnotationValueInitializers.txt index c28bf13143..ac3fa81e26 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/AnnotationValueInitializers.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/AnnotationValueInitializers.txt @@ -1,6 +1,6 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "AnnotationValueInitializers", @CanonicalName = "AnnotationValueInitializers", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "AnnotationValueInitializers", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- Annotation[@SimpleName = "MyAnnotation"] | | +- ClassType[@FullyQualified = false, @SimpleName = "MyAnnotation"] | | +- AnnotationMemberList[@Empty = false, @Size = 2] @@ -11,7 +11,7 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "b", @Empty = false, @Image = "\"b\"", @Length = 1, @LiteralText = "\"b\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "AnnotationValueInitializers2", @CanonicalName = "AnnotationValueInitializers2", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "AnnotationValueInitializers2", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- Annotation[@SimpleName = "MyAnnotation"] | +- ClassType[@FullyQualified = false, @SimpleName = "MyAnnotation"] | +- AnnotationMemberList[@Empty = false, @Size = 2] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/DealingWithNull.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/DealingWithNull.txt index 2aeb8ee6fb..09c4c440bc 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/DealingWithNull.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/DealingWithNull.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "DealingWithNull", @CanonicalName = "DealingWithNull", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "DealingWithNull", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 6] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testFooBar", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -41,11 +41,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Ok", @Empty = false, @Image = "\"Ok\"", @Length = 2, @LiteralText = "\"Ok\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testStringOrNull", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -54,7 +54,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -83,11 +83,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "default case", @Empty = false, @Image = "\"default case\"", @Length = 12, @LiteralText = "\"default case\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testStringOrDefaultNull", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -96,7 +96,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -117,11 +117,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "null or default case", @Empty = false, @Image = "\"null or default case\"", @Length = 20, @LiteralText = "\"null or default case\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test2", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -137,7 +137,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -151,7 +151,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -169,11 +169,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "default", @Empty = false, @Image = "\"default\"", @Length = 7, @LiteralText = "\"default\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test3", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 4, @containsComment = false] @@ -193,7 +193,7 @@ | | +- SwitchFallthroughBranch[@Default = false] | | | +- SwitchLabel[@Default = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- ExpressionStatement[] @@ -228,7 +228,7 @@ | | +- SwitchArrowBranch[@Default = false] | | | +- SwitchLabel[@Default = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -271,11 +271,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "The rest (including null)", @Empty = false, @Image = "\"The rest (including null)\"", @Length = 25, @LiteralText = "\"The rest (including null)\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -298,7 +298,7 @@ | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- CatchClause[] | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = false, @Name = "e", @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "NullPointerException"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = true, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "e", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/EnhancedTypeCheckingSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/EnhancedTypeCheckingSwitch.txt index cd6a3c0a40..2bc4a023cf 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/EnhancedTypeCheckingSwitch.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/EnhancedTypeCheckingSwitch.txt @@ -1,37 +1,37 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "EnhancedTypeCheckingSwitch", @CanonicalName = "EnhancedTypeCheckingSwitch", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "EnhancedTypeCheckingSwitch", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 4] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "EnhancedTypeCheckingSwitch$Point", @CanonicalName = "EnhancedTypeCheckingSwitch.Point", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Point", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "j", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "EnhancedTypeCheckingSwitch$Color", @CanonicalName = "EnhancedTypeCheckingSwitch.Color", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Color", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- EnumBody[@Empty = false, @SeparatorSemi = true, @Size = 3, @TrailingComma = false] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "RED", @MethodName = "new", @Name = "RED", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "RED", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "GREEN", @MethodName = "new", @Name = "GREEN", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "GREEN", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "BLUE", @MethodName = "new", @Name = "BLUE", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "BLUE", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "typeTester", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -49,7 +49,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -61,7 +61,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -77,7 +77,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -93,7 +93,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ArrayType[@ArrayDepth = 1] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -117,11 +117,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Something else", @Empty = false, @Image = "\"Something else\"", @Length = 14, @LiteralText = "\"Something else\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -129,7 +129,7 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 9, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | +- VariableDeclarator[@Initializer = true, @Name = "o"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ExhaustiveSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ExhaustiveSwitch.txt index 87d5c24cf7..5b58423b5a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ExhaustiveSwitch.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ExhaustiveSwitch.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ExhaustiveSwitch", @CanonicalName = "ExhaustiveSwitch", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ExhaustiveSwitch", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 13] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "coverage", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -17,7 +17,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "length", @MethodName = "length", @ParenthesisDepth = 0, @Parenthesized = false] @@ -26,7 +26,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] @@ -34,11 +34,11 @@ | +- SwitchLabel[@Default = true] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "coverageStatement", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -47,7 +47,7 @@ | +- SwitchFallthroughBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ExpressionStatement[] @@ -61,7 +61,7 @@ | +- SwitchFallthroughBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ExpressionStatement[] @@ -76,38 +76,38 @@ | +- SwitchLabel[@Default = true] | +- BreakStatement[@Label = null] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "ExhaustiveSwitch$S", @CanonicalName = "ExhaustiveSwitch.S", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "S", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{sealed, abstract, static}", @ExplicitModifiers = "{sealed}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.SEALED)] | +- PermitsList[@Empty = false, @Size = 3] | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | +- ClassType[@FullyQualified = false, @SimpleName = "B"] | | +- ClassType[@FullyQualified = false, @SimpleName = "C"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ExhaustiveSwitch$A", @CanonicalName = "ExhaustiveSwitch.A", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "A", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "S"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ExhaustiveSwitch$B", @CanonicalName = "ExhaustiveSwitch.B", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "B", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "S"] | +- ClassBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ExhaustiveSwitch$C", @CanonicalName = "ExhaustiveSwitch.C", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "C", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "S"] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testSealedExhaustive", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "S"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -117,30 +117,30 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "B"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "b", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] | +- SwitchArrowBranch[@Default = false] | +- SwitchLabel[@Default = false] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "C"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "switchStatementExhaustive", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "S"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 2, @containsComment = false] @@ -149,7 +149,7 @@ | | +- SwitchFallthroughBranch[@Default = false] | | | +- SwitchLabel[@Default = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- ExpressionStatement[] @@ -163,7 +163,7 @@ | | +- SwitchFallthroughBranch[@Default = false] | | | +- SwitchLabel[@Default = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "C"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- ExpressionStatement[] @@ -186,7 +186,7 @@ | | +- BreakStatement[@Label = null] | +- EmptyStatement[] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "ExhaustiveSwitch$I", @CanonicalName = "ExhaustiveSwitch.I", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "I", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{sealed, abstract, static}", @ExplicitModifiers = "{sealed}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.SEALED)] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | +- PermitsList[@Empty = false, @Size = 2] @@ -194,7 +194,7 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "F"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ExhaustiveSwitch$E", @CanonicalName = "ExhaustiveSwitch.E", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "E", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "X", @Name = "X", @TypeBound = false] | +- ImplementsList[@Empty = false, @Size = 1] @@ -203,7 +203,7 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ExhaustiveSwitch$F", @CanonicalName = "ExhaustiveSwitch.F", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "F", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "Y", @Name = "Y", @TypeBound = false] | +- ImplementsList[@Empty = false, @Size = 1] @@ -212,11 +212,11 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Y"] | +- ClassBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testGenericSealedExhaustive", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] @@ -228,18 +228,18 @@ | +- SwitchArrowBranch[@Default = false] | +- SwitchLabel[@Default = false] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "F"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "bi", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "42", @IntLiteral = true, @Integral = true, @LiteralText = "42", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 42.0, @ValueAsFloat = 42.0, @ValueAsInt = 42, @ValueAsLong = 42] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt index 54d9d2c408..a09c9ddbae 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GuardedPatterns", @CanonicalName = "GuardedPatterns", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GuardedPatterns", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 8] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -16,7 +16,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -34,7 +34,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -46,7 +46,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -70,11 +70,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "default case", @Empty = false, @Image = "\"default case\"", @Length = 12, @LiteralText = "\"default case\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testIdentifierWhen", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "when", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -86,12 +86,12 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "when", @Name = "when", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testIdentifierWhen", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "when"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "when", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -104,14 +104,14 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "when", @Name = "when", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GuardedPatterns$when", @CanonicalName = "GuardedPatterns.when", @EffectiveVisibility = Visibility.V_PRIVATE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "when", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] | +- ClassBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testWithNull", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -120,7 +120,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -138,7 +138,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -150,7 +150,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -183,11 +183,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "default case", @Empty = false, @Image = "\"default case\"", @Length = 12, @LiteralText = "\"default case\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "instanceOfPattern", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 3, @containsComment = false] @@ -197,7 +197,7 @@ | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "o", @Name = "o", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false] @@ -223,7 +223,7 @@ | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "o", @Name = "o", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false] @@ -245,7 +245,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "o", @Name = "o", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.GT, @ParenthesisDepth = 1, @Parenthesized = true] @@ -262,11 +262,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "A string containing at least four characters", @Empty = false, @Image = "\"A string containing at least four characters\"", @Length = 44, @LiteralText = "\"A string containing at least four characters\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testScopeOfPatternVariableDeclarations", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -276,7 +276,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.GT, @ParenthesisDepth = 0, @Parenthesized = false] @@ -301,11 +301,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Not a string", @Empty = false, @Image = "\"Not a string\"", @Length = 12, @LiteralText = "\"Not a string\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -340,7 +340,7 @@ | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- CatchClause[] | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = false, @Name = "e", @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "NullPointerException"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = true, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "e", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep440_RecordPatterns.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep440_RecordPatterns.txt index 2e2cb11e5a..6e0d10978e 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep440_RecordPatterns.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep440_RecordPatterns.txt @@ -1,25 +1,25 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep440_RecordPatterns", @CanonicalName = "Jep440_RecordPatterns", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Jep440_RecordPatterns", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 15] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep440_RecordPatterns$Point", @CanonicalName = "Jep440_RecordPatterns.Point", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Point", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "printSum", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -31,11 +31,11 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -49,47 +49,47 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "y", @Name = "y", @ParenthesisDepth = 0, @Parenthesized = false] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep440_RecordPatterns$Color", @CanonicalName = "Jep440_RecordPatterns.Color", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Color", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- EnumBody[@Empty = false, @SeparatorSemi = false, @Size = 3, @TrailingComma = false] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "RED", @MethodName = "new", @Name = "RED", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "RED", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "GREEN", @MethodName = "new", @Name = "GREEN", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "GREEN", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "BLUE", @MethodName = "new", @Name = "BLUE", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "BLUE", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep440_RecordPatterns$ColoredPoint", @CanonicalName = "Jep440_RecordPatterns.ColoredPoint", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "ColoredPoint", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep440_RecordPatterns$Rectangle", @CanonicalName = "Jep440_RecordPatterns.Rectangle", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Rectangle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "upperLeft", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lowerRight", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "printColorOfUpperLeftPoint", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -104,15 +104,15 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lr", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -124,11 +124,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "c", @Name = "c", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "printXCoordOfUpperLeftPointWithPatterns", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -146,19 +146,19 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | | +- PatternList[@Empty = false, @Size = 2] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lr", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -172,24 +172,24 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Upper-left corner: ", @Empty = false, @Image = "\"Upper-left corner: \"", @Length = 19, @LiteralText = "\"Upper-left corner: \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep440_RecordPatterns$Pair", @CanonicalName = "Jep440_RecordPatterns.Pair", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Pair", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "patternsCanFailToMatch", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Pair"] | | +- VariableDeclarator[@Initializer = true, @Name = "p"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "p", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -206,11 +206,11 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Pair"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -234,27 +234,27 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Not a pair of strings", @Empty = false, @Image = "\"Not a pair of strings\"", @Length = 21, @LiteralText = "\"Not a pair of strings\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep440_RecordPatterns$MyPair", @CanonicalName = "Jep440_RecordPatterns.MyPair", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "MyPair", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 2] | | +- TypeParameter[@Image = "S", @Name = "S", @TypeBound = false] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "S"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "fst", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "snd", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- EmptyDeclaration[] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "recordInference", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "MyPair"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 2] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -269,11 +269,11 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "MyPair"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "f", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -283,21 +283,21 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "matched", @Empty = false, @Image = "\"matched\"", @Length = 7, @LiteralText = "\"matched\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep440_RecordPatterns$Box", @CanonicalName = "Jep440_RecordPatterns.Box", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Box", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test1", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] @@ -320,7 +320,7 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | +- PatternList[@Empty = false, @Size = 1] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -334,11 +334,11 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "String ", @Empty = false, @Image = "\"String \"", @Length = 7, @LiteralText = "\"String \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test2", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] @@ -357,7 +357,7 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | +- PatternList[@Empty = false, @Size = 1] | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep441_PatternMatchingForSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep441_PatternMatchingForSwitch.txt index a8536752f3..3e64a5beb7 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep441_PatternMatchingForSwitch.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/Jep441_PatternMatchingForSwitch.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep441_PatternMatchingForSwitch", @CanonicalName = "Jep441_PatternMatchingForSwitch", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Jep441_PatternMatchingForSwitch", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 13] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "formatterPatternSwitch", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -17,7 +17,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] @@ -29,7 +29,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Long"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "l", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] @@ -41,7 +41,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Double"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "d", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] @@ -53,7 +53,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] @@ -68,11 +68,11 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "obj", @Name = "obj", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testFooBarNew", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -106,11 +106,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Ok", @Empty = false, @Image = "\"Ok\"", @Length = 2, @LiteralText = "\"Ok\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testStringNew", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "response", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -123,7 +123,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -142,7 +142,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -161,7 +161,7 @@ | +- SwitchArrowBranch[@Default = false] | +- SwitchLabel[@Default = false] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -173,11 +173,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Sorry?", @Empty = false, @Image = "\"Sorry?\"", @Length = 6, @LiteralText = "\"Sorry?\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testStringEnhanced", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "response", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -214,7 +214,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -233,7 +233,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -252,7 +252,7 @@ | +- SwitchArrowBranch[@Default = false] | +- SwitchLabel[@Default = false] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -264,39 +264,39 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Sorry?", @Empty = false, @Image = "\"Sorry?\"", @Length = 6, @LiteralText = "\"Sorry?\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "Jep441_PatternMatchingForSwitch$CardClassification", @CanonicalName = "Jep441_PatternMatchingForSwitch.CardClassification", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "CardClassification", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{sealed, abstract, static}", @ExplicitModifiers = "{sealed}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.SEALED)] | +- PermitsList[@Empty = false, @Size = 2] | | +- ClassType[@FullyQualified = false, @SimpleName = "Suit"] | | +- ClassType[@FullyQualified = false, @SimpleName = "Tarot"] | +- ClassBody[@Empty = true, @Size = 0] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep441_PatternMatchingForSwitch$Suit", @CanonicalName = "Jep441_PatternMatchingForSwitch.Suit", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Suit", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "CardClassification"] | +- EnumBody[@Empty = false, @SeparatorSemi = false, @Size = 4, @TrailingComma = false] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "CLUBS", @MethodName = "new", @Name = "CLUBS", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "CLUBS", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "DIAMONDS", @MethodName = "new", @Name = "DIAMONDS", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "DIAMONDS", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "HEARTS", @MethodName = "new", @Name = "HEARTS", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "HEARTS", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "SPADES", @MethodName = "new", @Name = "SPADES", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SPADES", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep441_PatternMatchingForSwitch$Tarot", @CanonicalName = "Jep441_PatternMatchingForSwitch.Tarot", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Tarot", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "CardClassification"] | +- ClassBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "exhaustiveSwitchWithoutEnumSupport", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "CardClassification"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -305,7 +305,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Suit"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -325,7 +325,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Suit"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -345,7 +345,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Suit"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -365,7 +365,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Suit"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -379,7 +379,7 @@ | +- SwitchArrowBranch[@Default = false] | +- SwitchLabel[@Default = false] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Tarot"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -391,11 +391,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "It\'s a tarot", @Empty = false, @Image = "\"It\'s a tarot\"", @Length = 12, @LiteralText = "\"It\'s a tarot\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "exhaustiveSwitchWithBetterEnumSupport", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "CardClassification"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -456,7 +456,7 @@ | +- SwitchArrowBranch[@Default = false] | +- SwitchLabel[@Default = false] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Tarot"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -468,27 +468,27 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "It\'s a tarot", @Empty = false, @Image = "\"It\'s a tarot\"", @Length = 12, @LiteralText = "\"It\'s a tarot\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "Jep441_PatternMatchingForSwitch$Currency", @CanonicalName = "Jep441_PatternMatchingForSwitch.Currency", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "Currency", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{sealed, abstract, static}", @ExplicitModifiers = "{sealed}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.SEALED)] | +- PermitsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Coin"] | +- ClassBody[@Empty = true, @Size = 0] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep441_PatternMatchingForSwitch$Coin", @CanonicalName = "Jep441_PatternMatchingForSwitch.Coin", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Coin", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Currency"] | +- EnumBody[@Empty = false, @SeparatorSemi = false, @Size = 2, @TrailingComma = false] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "HEADS", @MethodName = "new", @Name = "HEADS", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "HEADS", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "TAILS", @MethodName = "new", @Name = "TAILS", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "TAILS", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "goodEnumSwitch1", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Currency"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -521,11 +521,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Tails", @Empty = false, @Image = "\"Tails\"", @Length = 5, @LiteralText = "\"Tails\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "goodEnumSwitch2", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Coin"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/PatternsInSwitchLabels.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/PatternsInSwitchLabels.txt index ae159ed7ae..26347cab9b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/PatternsInSwitchLabels.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/PatternsInSwitchLabels.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "PatternsInSwitchLabels", @CanonicalName = "PatternsInSwitchLabels", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "PatternsInSwitchLabels", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -15,13 +15,13 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 3, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | +- VariableDeclarator[@Initializer = true, @Name = "o"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "123L", @IntLiteral = false, @Integral = true, @LiteralText = "123L", @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 123.0, @ValueAsFloat = 123.0, @ValueAsInt = 123, @ValueAsLong = 123] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "formatted"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "formatted", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -30,7 +30,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] @@ -42,7 +42,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Long"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "l", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] @@ -54,7 +54,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Double"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "d", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] @@ -66,7 +66,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatterns.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatterns.txt index 7603475c02..bdd1ce8066 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatterns.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatterns.txt @@ -1,61 +1,61 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatterns", @CanonicalName = "RecordPatterns", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "RecordPatterns", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 18] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatterns$Point", @CanonicalName = "RecordPatterns.Point", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Point", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatterns$Color", @CanonicalName = "RecordPatterns.Color", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Color", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- EnumBody[@Empty = false, @SeparatorSemi = false, @Size = 3, @TrailingComma = false] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "RED", @MethodName = "new", @Name = "RED", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "RED", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "GREEN", @MethodName = "new", @Name = "GREEN", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "GREEN", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "BLUE", @MethodName = "new", @Name = "BLUE", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "BLUE", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatterns$ColoredPoint", @CanonicalName = "RecordPatterns.ColoredPoint", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "ColoredPoint", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatterns$Rectangle", @CanonicalName = "RecordPatterns.Rectangle", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Rectangle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "upperLeft", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lowerRight", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "printSum1", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -64,12 +64,12 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "o", @Name = "o", @ParenthesisDepth = 0, @Parenthesized = false] | | +- PatternExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 3, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -77,7 +77,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "p", @Name = "p", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "y"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "y", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -94,11 +94,11 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "y", @Name = "y", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "printSum2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -110,11 +110,11 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -128,11 +128,11 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "y", @Name = "y", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "printUpperLeftColoredPoint", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -144,11 +144,11 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "ul", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lr", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -162,11 +162,11 @@ | +- AmbiguousName[@CompileTimeConstant = false, @Image = "ul", @Name = "ul", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "printColorOfUpperLeftPoint", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -181,15 +181,15 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lr", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -201,36 +201,36 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "c", @Name = "c", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 6, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "createRectangle", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | +- FormalParameters[@Empty = false, @Size = 6] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "x1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "y1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "c1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "x2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "y2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "c2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | +- VariableDeclarator[@Initializer = true, @Name = "r"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -258,11 +258,11 @@ | +- ReturnStatement[] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "r", @Name = "r", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "printXCoordOfUpperLeftPointWithPatterns", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -280,19 +280,19 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | | +- PatternList[@Empty = false, @Size = 2] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lr", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -306,24 +306,24 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Upper-left corner: ", @Empty = false, @Image = "\"Upper-left corner: \"", @Length = 19, @LiteralText = "\"Upper-left corner: \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatterns$Pair", @CanonicalName = "RecordPatterns.Pair", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Pair", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "nestedPatternsCanFailToMatch", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Pair"] | | +- VariableDeclarator[@Initializer = true, @Name = "p"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "p", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -340,11 +340,11 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Pair"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -368,21 +368,21 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Not a pair of strings", @Empty = false, @Image = "\"Not a pair of strings\"", @Length = 21, @LiteralText = "\"Not a pair of strings\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatterns$Box", @CanonicalName = "RecordPatterns.Box", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Box", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test1a", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] @@ -398,7 +398,7 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- PatternList[@Empty = false, @Size = 1] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -412,11 +412,11 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "String ", @Empty = false, @Image = "\"String \"", @Length = 7, @LiteralText = "\"String \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test1", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -432,7 +432,7 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- PatternList[@Empty = false, @Size = 1] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -446,11 +446,11 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "String ", @Empty = false, @Image = "\"String \"", @Length = 7, @LiteralText = "\"String \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] @@ -464,7 +464,7 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | +- PatternList[@Empty = false, @Size = 1] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -478,11 +478,11 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "String ", @Empty = false, @Image = "\"String \"", @Length = 7, @LiteralText = "\"String \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test3", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] @@ -505,7 +505,7 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | +- PatternList[@Empty = false, @Size = 1] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -519,11 +519,11 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "String ", @Empty = false, @Image = "\"String \"", @Length = 7, @LiteralText = "\"String \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test4", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] @@ -542,7 +542,7 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | +- PatternList[@Empty = false, @Size = 1] | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "var"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatternsExhaustiveSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatternsExhaustiveSwitch.txt index 8f22b50ebf..1d0d121f32 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatternsExhaustiveSwitch.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatternsExhaustiveSwitch.txt @@ -1,52 +1,52 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch", @CanonicalName = "RecordPatternsExhaustiveSwitch", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "RecordPatternsExhaustiveSwitch", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 7] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch$A", @CanonicalName = "RecordPatternsExhaustiveSwitch.A", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "A", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch$B", @CanonicalName = "RecordPatternsExhaustiveSwitch.B", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "B", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch$I", @CanonicalName = "RecordPatternsExhaustiveSwitch.I", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = true, @SimpleName = "I", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{sealed, abstract, static}", @ExplicitModifiers = "{sealed}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.SEALED)] | +- PermitsList[@Empty = false, @Size = 2] | | +- ClassType[@FullyQualified = false, @SimpleName = "C"] | | +- ClassType[@FullyQualified = false, @SimpleName = "D"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch$C", @CanonicalName = "RecordPatternsExhaustiveSwitch.C", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "C", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch$D", @CanonicalName = "RecordPatternsExhaustiveSwitch.D", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "D", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | +- ClassBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch$Pair", @CanonicalName = "RecordPatternsExhaustiveSwitch.Pair", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Pair", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 5, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Pair"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] @@ -54,7 +54,7 @@ | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "p1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Pair"] | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] @@ -71,11 +71,11 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "B"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "b", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -92,11 +92,11 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "B"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "b", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -113,11 +113,11 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a1", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "A"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "a2", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -136,11 +136,11 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "C"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -157,11 +157,11 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "D"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "d", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -180,11 +180,11 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "C"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -201,11 +201,11 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "D"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "d", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "C"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -222,11 +222,11 @@ | | +- ClassType[@FullyQualified = false, @SimpleName = "I"] | +- PatternList[@Empty = false, @Size = 2] | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "D"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "d1", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "D"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "d2", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt index d91c4f8546..058cbaefed 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt @@ -1,30 +1,30 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RefiningPatternsInSwitch", @CanonicalName = "RefiningPatternsInSwitch", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "RefiningPatternsInSwitch", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 7] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RefiningPatternsInSwitch$Shape", @CanonicalName = "RefiningPatternsInSwitch.Shape", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Shape", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RefiningPatternsInSwitch$Rectangle", @CanonicalName = "RefiningPatternsInSwitch.Rectangle", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Rectangle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Shape"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RefiningPatternsInSwitch$Triangle", @CanonicalName = "RefiningPatternsInSwitch.Triangle", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Triangle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Shape"] | +- ClassBody[@Empty = false, @Size = 3] | +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = false, @Name = "area"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "area", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Triangle", @Name = "Triangle", @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @containsComment = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "area", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -34,18 +34,18 @@ | | | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "area", @Name = "area", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "calculateArea", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "area", @Name = "area", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testTriangle", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Shape"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -58,7 +58,7 @@ | +- SwitchFallthroughBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Triangle"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- IfStatement[@Else = false] @@ -86,11 +86,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "A shape, possibly a small triangle", @Empty = false, @Image = "\"A shape, possibly a small triangle\"", @Length = 34, @LiteralText = "\"A shape, possibly a small triangle\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testTriangleRefined", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Shape"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -104,7 +104,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Triangle"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -128,11 +128,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "A shape, possibly a small triangle", @Empty = false, @Image = "\"A shape, possibly a small triangle\"", @Length = 34, @LiteralText = "\"A shape, possibly a small triangle\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testTriangleRefined2", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Shape"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -146,7 +146,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Triangle"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -164,7 +164,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Triangle"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "t", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -182,11 +182,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Non-triangle", @Empty = false, @Image = "\"Non-triangle\"", @Length = 12, @LiteralText = "\"Non-triangle\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -194,7 +194,7 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 12, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Triangle"] | +- VariableDeclarator[@Initializer = true, @Name = "large"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "large", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -203,7 +203,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "200", @IntLiteral = true, @Integral = true, @LiteralText = "200", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 200.0, @ValueAsFloat = 200.0, @ValueAsInt = 200, @ValueAsLong = 200] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Triangle"] | +- VariableDeclarator[@Initializer = true, @Name = "small"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "small", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -212,7 +212,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "10", @IntLiteral = true, @Integral = true, @LiteralText = "10", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 10.0, @ValueAsFloat = 10.0, @ValueAsInt = 10, @ValueAsLong = 10] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | +- VariableDeclarator[@Initializer = true, @Name = "rect"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "rect", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ScopeOfPatternVariableDeclarations.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ScopeOfPatternVariableDeclarations.txt index 3c1ff573aa..bcce204419 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ScopeOfPatternVariableDeclarations.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/ScopeOfPatternVariableDeclarations.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ScopeOfPatternVariableDeclarations", @CanonicalName = "ScopeOfPatternVariableDeclarations", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ScopeOfPatternVariableDeclarations", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 4] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testSwitchBlock", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "obj", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -16,7 +16,7 @@ | +- SwitchFallthroughBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Character"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -37,11 +37,11 @@ | +- SwitchLabel[@Default = true] | +- BreakStatement[@Label = null] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testSwitchRule", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -50,7 +50,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Character"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 2, @containsComment = false] @@ -78,7 +78,7 @@ | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ThrowStatement[] @@ -95,11 +95,11 @@ | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- BreakStatement[@Label = null] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "test2", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Object"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "o", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -108,7 +108,7 @@ | +- SwitchFallthroughBranch[@Default = false] | | +- SwitchLabel[@Default = false] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Character"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- IfStatement[@Else = false] @@ -156,11 +156,11 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "fall-through", @Empty = false, @Image = "\"fall-through\"", @Length = 12, @LiteralText = "\"fall-through\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -183,7 +183,7 @@ | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "42", @IntLiteral = true, @Integral = true, @LiteralText = "42", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 42.0, @ValueAsFloat = 42.0, @ValueAsInt = 42, @ValueAsLong = 42] | +- CatchClause[] | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = false, @Name = "e", @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "IllegalStateException"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = true, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "e", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep430_StringTemplates.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep430_StringTemplates.txt index a1124094d6..dff0ab9939 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep430_StringTemplates.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep430_StringTemplates.txt @@ -5,43 +5,43 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.time.format.DateTimeFormatter", @ImportedSimpleName = "DateTimeFormatter", @PackageName = "java.time.format", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.time.LocalTime", @ImportedSimpleName = "LocalTime", @PackageName = "java.time", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep430_StringTemplates", @CanonicalName = "Jep430_StringTemplates", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Jep430_StringTemplates", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 9] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep430_StringTemplates$Request", @CanonicalName = "Jep430_StringTemplates.Request", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Request", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 3, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "date", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "time", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "ipAddress", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "STRTemplateProcessor", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 19, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "firstName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "firstName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Bill", @Empty = false, @Image = "\"Bill\"", @Length = 4, @LiteralText = "\"Bill\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "lastName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "lastName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Duck", @Empty = false, @Image = "\"Duck\"", @Length = 4, @LiteralText = "\"Duck\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "fullName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "fullName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -54,7 +54,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "lastName", @Name = "lastName", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "sortName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "sortName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -67,7 +67,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "firstName", @Name = "firstName", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -76,7 +76,7 @@ | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "y", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "20", @IntLiteral = true, @Integral = true, @LiteralText = "20", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 20.0, @ValueAsFloat = 20.0, @ValueAsInt = 20, @ValueAsLong = 20] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s1"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -93,7 +93,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "y", @Name = "y", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s2"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -105,7 +105,7 @@ | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- TemplateFragment[@Content = "} waiting for you!\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Request"] | | +- VariableDeclarator[@Initializer = true, @Name = "req"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "req", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -116,7 +116,7 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "15:34", @Empty = false, @Image = "\"15:34\"", @Length = 5, @LiteralText = "\"15:34\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "8.8.8.8", @Empty = false, @Image = "\"8.8.8.8\"", @Length = 7, @LiteralText = "\"8.8.8.8\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "t"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "t", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -134,13 +134,13 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "req", @Name = "req", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "filePath"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "filePath", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "tmp.dat", @Empty = false, @Image = "\"tmp.dat\"", @Length = 7, @LiteralText = "\"tmp.dat\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "File"] | | +- VariableDeclarator[@Initializer = true, @Name = "file"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "file", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -149,7 +149,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "filePath", @Name = "filePath", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "old"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "old", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -168,7 +168,7 @@ | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "does not", @Empty = false, @Image = "\"does not\"", @Length = 8, @LiteralText = "\"does not\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = " exist", @Empty = false, @Image = "\" exist\"", @Length = 6, @LiteralText = "\" exist\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "msg"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "msg", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -186,7 +186,7 @@ | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "does not", @Empty = false, @Image = "\"does not\"", @Length = 8, @LiteralText = "\"does not\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- TemplateFragment[@Content = "} exist\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "time"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "time", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -207,13 +207,13 @@ | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- TemplateFragment[@Content = "} right now\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "index"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "index", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "data"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "data", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -234,7 +234,7 @@ | | | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "index", @Name = "index", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -246,7 +246,7 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "oranges", @Empty = false, @Image = "\"oranges\"", @Length = 7, @LiteralText = "\"oranges\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "peaches", @Empty = false, @Image = "\"peaches\"", @Length = 7, @LiteralText = "\"peaches\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s3"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s3", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -272,7 +272,7 @@ | | | +- TemplateFragment[@Content = "}\""] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "s4"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s4", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -298,31 +298,31 @@ | | +- TemplateFragment[@Content = "}\""] | +- TemplateFragment[@Content = "}\""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "getOfferType", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "_getOfferType_", @Empty = false, @Image = "\"_getOfferType_\"", @Length = 14, @LiteralText = "\"_getOfferType_\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "multilineTemplateExpressions", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 10, @containsComment = true] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "title"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "title", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "My Web Page", @Empty = false, @Image = "\"My Web Page\"", @Length = 11, @LiteralText = "\"My Web Page\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "text"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "text", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hello, world", @Empty = false, @Image = "\"Hello, world\"", @Length = 12, @LiteralText = "\"Hello, world\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "html"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "html", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -335,25 +335,25 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "text", @Name = "text", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}

\n \n \n \"\"\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "name"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "name", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Joan Smith", @Empty = false, @Image = "\"Joan Smith\"", @Length = 10, @LiteralText = "\"Joan Smith\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "phone"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "phone", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "555-123-4567", @Empty = false, @Image = "\"555-123-4567\"", @Length = 12, @LiteralText = "\"555-123-4567\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "address"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "address", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "1 Maple Drive, Anytown", @Empty = false, @Image = "\"1 Maple Drive, Anytown\"", @Length = 22, @LiteralText = "\"1 Maple Drive, Anytown\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "json"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "json", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -369,23 +369,23 @@ | | +- TemplateFragment[@Content = "}\"\n }\n \"\"\""] | +- LocalClassStatement[] | | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep430_StringTemplates$1Rectangle", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Rectangle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- RecordComponentList[@Empty = false, @Size = 3, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "name", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "width", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "height", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = false, @Size = 1] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Name = "area", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -394,7 +394,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "width", @Name = "width", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "height", @Name = "height", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -426,7 +426,7 @@ | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "7.1", @IntLiteral = false, @Integral = false, @LiteralText = "7.1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 7.1, @ValueAsFloat = 7.1, @ValueAsInt = 7, @ValueAsLong = 7] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "11.23", @IntLiteral = false, @Integral = false, @LiteralText = "11.23", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 11.23, @ValueAsFloat = 11.23, @ValueAsInt = 11, @ValueAsLong = 11] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "table"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "table", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -516,29 +516,29 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- TemplateFragment[@Content = "}\n \"\"\""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "FMTTemplateProcessor", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 4, @containsComment = true] | +- LocalClassStatement[] | | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep430_StringTemplates$2Rectangle", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Rectangle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- RecordComponentList[@Empty = false, @Size = 3, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "name", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "width", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "height", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = false, @Size = 1] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Name = "area", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -548,7 +548,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "height", @Name = "height", @ParenthesisDepth = 0, @Parenthesized = false] | +- EmptyStatement[] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -580,7 +580,7 @@ | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "7.1", @IntLiteral = false, @Integral = false, @LiteralText = "7.1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 7.1, @ValueAsFloat = 7.1, @ValueAsInt = 7, @ValueAsLong = 7] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "11.23", @IntLiteral = false, @Integral = false, @LiteralText = "11.23", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 11.23, @ValueAsFloat = 11.23, @ValueAsInt = 11, @ValueAsLong = 11] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "table"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "table", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -675,18 +675,18 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- TemplateFragment[@Content = "}\n \"\"\""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "ensuringSafety", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "name"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "name", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Joan", @Empty = false, @Image = "\"Joan\"", @Length = 4, @LiteralText = "\"Joan\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "StringTemplate"] | | +- VariableDeclarator[@Initializer = true, @Name = "st"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "st", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -697,7 +697,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "name", @Name = "name", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "info"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "info", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -706,24 +706,24 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "st", @Name = "st", @ParenthesisDepth = 0, @Parenthesized = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep430_StringTemplates$User", @CanonicalName = "Jep430_StringTemplates.User", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "User", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "firstName", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "accountNumber", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "literalsInsideTemplateExpressions", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = true] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s1"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -732,7 +732,7 @@ | | +- Template[] | | +- TemplateFragment[@Content = "\"Welcome to your account\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "User"] | | +- VariableDeclarator[@Initializer = true, @Name = "user"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "user", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -742,7 +742,7 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Lisa", @Empty = false, @Image = "\"Lisa\"", @Length = 4, @LiteralText = "\"Lisa\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "12345", @IntLiteral = true, @Integral = true, @LiteralText = "12345", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 12345.0, @ValueAsFloat = 12345.0, @ValueAsInt = 12345, @ValueAsLong = 12345] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "s2"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -759,12 +759,12 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- TemplateFragment[@Content = "}\""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "emptyEmbeddedExpression", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassType[@FullyQualified = false, @SimpleName = "String"] +- VariableDeclarator[@Initializer = true, @Name = "s1"] +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt index 6429a5a730..7b39af7263 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt @@ -4,51 +4,51 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.Queue", @ImportedSimpleName = "Queue", @PackageName = "java.util", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.stream.Collectors", @ImportedSimpleName = "Collectors", @PackageName = "java.util.stream", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables", @CanonicalName = "Jep443_UnamedPatternsAndVariables", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Jep443_UnamedPatternsAndVariables", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 19] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$Point", @CanonicalName = "Jep443_UnamedPatternsAndVariables.Point", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Point", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$Color", @CanonicalName = "Jep443_UnamedPatternsAndVariables.Color", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Color", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- EnumBody[@Empty = false, @SeparatorSemi = false, @Size = 3, @TrailingComma = false] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "RED", @MethodName = "new", @Name = "RED", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "RED", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "GREEN", @MethodName = "new", @Name = "GREEN", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "GREEN", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "BLUE", @MethodName = "new", @Name = "BLUE", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "BLUE", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$ColoredPoint", @CanonicalName = "Jep443_UnamedPatternsAndVariables.ColoredPoint", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "ColoredPoint", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unnamedPatterns1", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | +- VariableDeclarator[@Initializer = true, @Name = "r"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -71,11 +71,11 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -105,11 +105,11 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- UnnamedPattern[] @@ -126,45 +126,45 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = " ", @Empty = false, @Image = "\" \"", @Length = 1, @LiteralText = "\" \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "y", @Name = "y", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$Ball", @CanonicalName = "Jep443_UnamedPatternsAndVariables.Ball", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Ball", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{sealed, abstract}", @ExplicitModifiers = "{sealed, abstract}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT), @ExplicitModifiers = (JModifier.SEALED, JModifier.ABSTRACT)] | +- PermitsList[@Empty = false, @Size = 3] | | +- ClassType[@FullyQualified = false, @SimpleName = "RedBall"] | | +- ClassType[@FullyQualified = false, @SimpleName = "BlueBall"] | | +- ClassType[@FullyQualified = false, @SimpleName = "GreenBall"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$RedBall", @CanonicalName = "Jep443_UnamedPatternsAndVariables.RedBall", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "RedBall", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Ball"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$BlueBall", @CanonicalName = "Jep443_UnamedPatternsAndVariables.BlueBall", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "BlueBall", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Ball"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$GreenBall", @CanonicalName = "Jep443_UnamedPatternsAndVariables.GreenBall", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GreenBall", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Ball"] | +- ClassBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$Box", @CanonicalName = "Jep443_UnamedPatternsAndVariables.Box", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Box", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = true] | | +- ClassType[@FullyQualified = false, @SimpleName = "Ball"] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "content", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unnamedPatterns2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 5, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- WildcardType[@LowerBound = false, @UpperBound = true] @@ -186,7 +186,7 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "RedBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "processBox", @MethodName = "processBox", @ParenthesisDepth = 0, @Parenthesized = false] @@ -198,7 +198,7 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "BlueBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "processBox", @MethodName = "processBox", @ParenthesisDepth = 0, @Parenthesized = false] @@ -210,7 +210,7 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- PatternList[@Empty = false, @Size = 1] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "GreenBall"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "stopProcessing", @MethodName = "stopProcessing", @ParenthesisDepth = 0, @Parenthesized = false] @@ -223,14 +223,14 @@ | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | | +- PatternList[@Empty = false, @Size = 1] | | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "RedBall"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | | +- RecordPattern[] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "BlueBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "processBox", @MethodName = "processBox", @ParenthesisDepth = 0, @Parenthesized = false] @@ -242,7 +242,7 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "GreenBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "stopProcessing", @MethodName = "stopProcessing", @ParenthesisDepth = 0, @Parenthesized = false] @@ -256,7 +256,7 @@ | | +- MethodCall[@CompileTimeConstant = false, @Image = "pickAnotherBox", @MethodName = "pickAnotherBox", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -269,14 +269,14 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "RedBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- RecordPattern[] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "BlueBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -295,11 +295,11 @@ | +- MethodCall[@CompileTimeConstant = false, @Image = "pickAnotherBox", @MethodName = "pickAnotherBox", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "processBox", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- WildcardType[@LowerBound = false, @UpperBound = true] @@ -307,51 +307,51 @@ | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "b", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "stopProcessing", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "pickAnotherBox", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$Order", @CanonicalName = "Jep443_UnamedPatternsAndVariables.Order", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Order", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = true, @Size = 0] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "LIMIT"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "LIMIT", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "10", @IntLiteral = true, @Integral = true, @LiteralText = "10", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 10.0, @ValueAsFloat = 10.0, @ValueAsInt = 10, @ValueAsLong = 10] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "sideEffect", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unnamedVariables", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "List"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Order"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "orders", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 7, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "total"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "total", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] | +- ForeachStatement[] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Order"] | | | +- VariableDeclarator[@Initializer = false, @Name = "_"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = true, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -377,7 +377,7 @@ | +- ForStatement[] | | +- ForInit[] | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "i"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = true, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -402,7 +402,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Queue"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] @@ -420,7 +420,7 @@ | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] | | +- Block[@Empty = false, @Size = 4, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -428,7 +428,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "y"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "y", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -436,7 +436,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "_"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -444,7 +444,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | +- VariableDeclarator[@Initializer = true, @Name = "p"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "p", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -461,28 +461,28 @@ | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] | +- Block[@Empty = false, @Size = 4, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "remove", @MethodName = "remove", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "remove", @MethodName = "remove", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "remove", @MethodName = "remove", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | +- VariableDeclarator[@Initializer = true, @Name = "p"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "p", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -492,19 +492,19 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep443_UnamedPatternsAndVariables$ScopedContext", @CanonicalName = "Jep443_UnamedPatternsAndVariables.ScopedContext", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ScopedContext", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "AutoCloseable"] | +- ClassBody[@Empty = false, @Size = 2] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "close", @Overridden = true, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- Annotation[@SimpleName = "Override"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Override"] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "acquire", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "ScopedContext"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -513,7 +513,7 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "ScopedContext"] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unusedVariables2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 4, @containsComment = false] @@ -521,7 +521,7 @@ | +- ResourceList[@Empty = false, @Size = 1, @TrailingSemiColon = false] | | +- Resource[@ConciseResource = false, @StableName = "_"] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "acquire", @MethodName = "acquire", @ParenthesisDepth = 0, @Parenthesized = false] @@ -530,7 +530,7 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "s"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -538,7 +538,7 @@ +- TryStatement[@TryWithResources = false] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "i"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -556,7 +556,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | +- CatchClause[] | | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = false, @Name = "_", @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "NumberFormatException"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = true, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -571,7 +571,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] | +- CatchClause[] | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = false, @Name = "_", @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Exception"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = true, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -603,6 +603,6 @@ +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] +- LambdaParameterList[@Empty = false, @Size = 1] | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "NO_DATA", @Empty = false, @Image = "\"NO_DATA\"", @Length = 7, @LiteralText = "\"NO_DATA\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses1.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses1.txt index 8bafb59ab5..4826a0bcb2 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses1.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses1.txt @@ -1,6 +1,6 @@ +- CompilationUnit[@PackageName = ""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses2.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses2.txt index 200582f309..95f5757567 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses2.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses2.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "greeting", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hello, World!", @Empty = false, @Image = "\"Hello, World!\"", @Length = 13, @LiteralText = "\"Hello, World!\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses3.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses3.txt index aa91140674..66f34f82b4 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses3.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep445_UnnamedClasses3.txt @@ -1,12 +1,12 @@ +- CompilationUnit[@PackageName = ""] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PACKAGE, @Static = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "greeting"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "greeting", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hello, World!", @Empty = false, @Image = "\"Hello, World!\"", @Length = 13, @LiteralText = "\"Hello, World!\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt index 3de46269b6..da6abec815 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt @@ -4,51 +4,51 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.Queue", @ImportedSimpleName = "Queue", @PackageName = "java.util", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.stream.Collectors", @ImportedSimpleName = "Collectors", @PackageName = "java.util.stream", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables", @CanonicalName = "Jep456_UnamedPatternsAndVariables", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Jep456_UnamedPatternsAndVariables", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 19] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$Point", @CanonicalName = "Jep456_UnamedPatternsAndVariables.Point", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Point", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$Color", @CanonicalName = "Jep456_UnamedPatternsAndVariables.Color", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Color", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- EnumBody[@Empty = false, @SeparatorSemi = false, @Size = 3, @TrailingComma = false] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "RED", @MethodName = "new", @Name = "RED", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "RED", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "GREEN", @MethodName = "new", @Name = "GREEN", @Visibility = Visibility.V_PUBLIC] - | | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "GREEN", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "BLUE", @MethodName = "new", @Name = "BLUE", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "BLUE", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$ColoredPoint", @CanonicalName = "Jep456_UnamedPatternsAndVariables.ColoredPoint", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "ColoredPoint", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unnamedPatterns1", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | +- VariableDeclarator[@Initializer = true, @Name = "r"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "r", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -71,11 +71,11 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "ColoredPoint"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "p", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Color"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -105,11 +105,11 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | | +- PatternList[@Empty = false, @Size = 2] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "y", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- UnnamedPattern[] @@ -126,45 +126,45 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = " ", @Empty = false, @Image = "\" \"", @Length = 1, @LiteralText = "\" \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "y", @Name = "y", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = true, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$Ball", @CanonicalName = "Jep456_UnamedPatternsAndVariables.Ball", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Ball", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{sealed, abstract}", @ExplicitModifiers = "{sealed, abstract}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT), @ExplicitModifiers = (JModifier.SEALED, JModifier.ABSTRACT)] | +- PermitsList[@Empty = false, @Size = 3] | | +- ClassType[@FullyQualified = false, @SimpleName = "RedBall"] | | +- ClassType[@FullyQualified = false, @SimpleName = "BlueBall"] | | +- ClassType[@FullyQualified = false, @SimpleName = "GreenBall"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$RedBall", @CanonicalName = "Jep456_UnamedPatternsAndVariables.RedBall", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "RedBall", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Ball"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$BlueBall", @CanonicalName = "Jep456_UnamedPatternsAndVariables.BlueBall", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "BlueBall", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Ball"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$GreenBall", @CanonicalName = "Jep456_UnamedPatternsAndVariables.GreenBall", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GreenBall", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Ball"] | +- ClassBody[@Empty = true, @Size = 0] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$Box", @CanonicalName = "Jep456_UnamedPatternsAndVariables.Box", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Box", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- TypeParameters[@Empty = false, @Size = 1] | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = true] | | +- ClassType[@FullyQualified = false, @SimpleName = "Ball"] | +- RecordComponentList[@Empty = false, @Size = 1, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "T"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "content", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unnamedPatterns2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 5, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- WildcardType[@LowerBound = false, @UpperBound = true] @@ -186,7 +186,7 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "RedBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "processBox", @MethodName = "processBox", @ParenthesisDepth = 0, @Parenthesized = false] @@ -198,7 +198,7 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "BlueBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "processBox", @MethodName = "processBox", @ParenthesisDepth = 0, @Parenthesized = false] @@ -210,7 +210,7 @@ | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- PatternList[@Empty = false, @Size = 1] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "GreenBall"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "stopProcessing", @MethodName = "stopProcessing", @ParenthesisDepth = 0, @Parenthesized = false] @@ -223,14 +223,14 @@ | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | | +- PatternList[@Empty = false, @Size = 1] | | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- ClassType[@FullyQualified = false, @SimpleName = "RedBall"] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | | +- RecordPattern[] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "BlueBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "processBox", @MethodName = "processBox", @ParenthesisDepth = 0, @Parenthesized = false] @@ -242,7 +242,7 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "GreenBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "stopProcessing", @MethodName = "stopProcessing", @ParenthesisDepth = 0, @Parenthesized = false] @@ -256,7 +256,7 @@ | | +- MethodCall[@CompileTimeConstant = false, @Image = "pickAnotherBox", @MethodName = "pickAnotherBox", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -269,14 +269,14 @@ | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "RedBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- RecordPattern[] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "BlueBall"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- Guard[] @@ -295,11 +295,11 @@ | +- MethodCall[@CompileTimeConstant = false, @Image = "pickAnotherBox", @MethodName = "pickAnotherBox", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "processBox", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Box"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- WildcardType[@LowerBound = false, @UpperBound = true] @@ -307,51 +307,51 @@ | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "b", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "stopProcessing", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "pickAnotherBox", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$Order", @CanonicalName = "Jep456_UnamedPatternsAndVariables.Order", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Order", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassBody[@Empty = true, @Size = 0] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] - | +- ModifierList[@EffectiveModifiers = "{private, static, final}", @ExplicitModifiers = "{private, static, final}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "LIMIT"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "LIMIT", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "10", @IntLiteral = true, @Integral = true, @LiteralText = "10", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 10.0, @ValueAsFloat = 10.0, @ValueAsInt = 10, @ValueAsLong = 10] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "sideEffect", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unnamedVariables", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "List"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Order"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "orders", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 7, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "total"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "total", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] | +- ForeachStatement[] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Order"] | | | +- VariableDeclarator[@Initializer = false, @Name = "_"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = true, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -377,7 +377,7 @@ | +- ForStatement[] | | +- ForInit[] | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "i"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = true, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -402,7 +402,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Queue"] | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Integer"] @@ -420,7 +420,7 @@ | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] | | +- Block[@Empty = false, @Size = 4, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -428,7 +428,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "y"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "y", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -436,7 +436,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "_"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -444,7 +444,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | | +- VariableDeclarator[@Initializer = true, @Name = "p"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "p", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -461,28 +461,28 @@ | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] | +- Block[@Empty = false, @Size = 4, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "remove", @MethodName = "remove", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "remove", @MethodName = "remove", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "remove", @MethodName = "remove", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "q", @Name = "q", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArgumentList[@Empty = true, @Size = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "Point"] | +- VariableDeclarator[@Initializer = true, @Name = "p"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "p", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -492,19 +492,19 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "x", @Name = "x", @ParenthesisDepth = 0, @Parenthesized = false] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep456_UnamedPatternsAndVariables$ScopedContext", @CanonicalName = "Jep456_UnamedPatternsAndVariables.ScopedContext", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ScopedContext", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ImplementsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "AutoCloseable"] | +- ClassBody[@Empty = false, @Size = 2] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "close", @Overridden = true, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] - | | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | | +- Annotation[@SimpleName = "Override"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Override"] | | +- VoidType[] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = true, @Size = 0, @containsComment = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "acquire", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "ScopedContext"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -513,7 +513,7 @@ | +- ClassType[@FullyQualified = false, @SimpleName = "ScopedContext"] | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unusedVariables2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 4, @containsComment = false] @@ -521,7 +521,7 @@ | +- ResourceList[@Empty = false, @Size = 1, @TrailingSemiColon = false] | | +- Resource[@ConciseResource = false, @StableName = "_"] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "acquire", @MethodName = "acquire", @ParenthesisDepth = 0, @Parenthesized = false] @@ -530,7 +530,7 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "s"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -538,7 +538,7 @@ +- TryStatement[@TryWithResources = false] | +- Block[@Empty = false, @Size = 2, @containsComment = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableDeclarator[@Initializer = true, @Name = "i"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -556,7 +556,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | +- CatchClause[] | | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = false, @Name = "_", @Visibility = Visibility.V_PACKAGE] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "NumberFormatException"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = true, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -571,7 +571,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] | +- CatchClause[] | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = false, @Name = "_", @Visibility = Visibility.V_PACKAGE] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Exception"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = true, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -603,6 +603,6 @@ +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] +- LambdaParameterList[@Empty = false, @Size = 1] | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "NO_DATA", @Empty = false, @Image = "\"NO_DATA\"", @Length = 7, @LiteralText = "\"NO_DATA\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep447_StatementsBeforeSuper.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep447_StatementsBeforeSuper.txt index aad782bbad..acd50b8006 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep447_StatementsBeforeSuper.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep447_StatementsBeforeSuper.txt @@ -5,27 +5,27 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.security.interfaces.DSAPublicKey", @ImportedSimpleName = "DSAPublicKey", @PackageName = "java.security.interfaces", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.security.interfaces.RSAKey", @ImportedSimpleName = "RSAKey", @PackageName = "java.security.interfaces", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper", @CanonicalName = "Jep447_StatementsBeforeSuper", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Jep447_StatementsBeforeSuper", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 9] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$Old", @CanonicalName = "Jep447_StatementsBeforeSuper.Old", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Old", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Old", @Name = "Old", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExplicitConstructorInvocation[@ArgumentCount = 0, @MethodName = "new", @Qualified = false, @Super = true, @This = false] | +- ArgumentList[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$PositiveBigInteger", @CanonicalName = "Jep447_StatementsBeforeSuper.PositiveBigInteger", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "PositiveBigInteger", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "BigInteger"] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "PositiveBigInteger", @Name = "PositiveBigInteger", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "value", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 3, @containsComment = false] @@ -39,7 +39,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "non-positive value", @Empty = false, @Image = "\"non-positive value\"", @Length = 18, @LiteralText = "\"non-positive value\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "valueAsString"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "valueAsString", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -52,13 +52,13 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "valueAsString", @Name = "valueAsString", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$Super", @CanonicalName = "Jep447_StatementsBeforeSuper.Super", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Super", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Super", @Name = "Super", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -66,20 +66,20 @@ | | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "bytes", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$Sub", @CanonicalName = "Jep447_StatementsBeforeSuper.Sub", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Sub", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Super"] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Sub", @Name = "Sub", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Certificate"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "certificate", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 4, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "publicKey"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "publicKey", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "getPublicKey", @MethodName = "getPublicKey", @ParenthesisDepth = 0, @Parenthesized = false] @@ -95,7 +95,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "null certificate", @Empty = false, @Image = "\"null certificate\"", @Length = 16, @LiteralText = "\"null certificate\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{final}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] | | +- ArrayType[@ArrayDepth = 1] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -107,7 +107,7 @@ | | +- SwitchArrowBranch[@Default = false] | | | +- SwitchLabel[@Default = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "RSAKey"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "rsaKey", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "getBytes", @MethodName = "getBytes", @ParenthesisDepth = 0, @Parenthesized = false] @@ -121,7 +121,7 @@ | | +- SwitchArrowBranch[@Default = false] | | | +- SwitchLabel[@Default = false] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] - | | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "DSAPublicKey"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "dsaKey", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "getBytes", @MethodName = "getBytes", @ParenthesisDepth = 0, @Parenthesized = false] @@ -144,38 +144,38 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "byteArray", @Name = "byteArray", @ParenthesisDepth = 0, @Parenthesized = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$F", @CanonicalName = "Jep447_StatementsBeforeSuper.F", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "F", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$Super2", @CanonicalName = "Jep447_StatementsBeforeSuper.Super2", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Super2", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 2, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Super2", @Name = "Super2", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = false, @Size = 2] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "F"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "f1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "F"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "f2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$Sub2", @CanonicalName = "Jep447_StatementsBeforeSuper.Sub2", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Sub2", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @SimpleName = "Super2"] | +- ClassBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Sub2", @Name = "Sub2", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = true] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 2, @containsComment = true] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableDeclarator[@Initializer = true, @Name = "f"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] @@ -186,30 +186,30 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "f", @Name = "f", @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "f", @Name = "f", @ParenthesisDepth = 0, @Parenthesized = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$Range", @CanonicalName = "Jep447_StatementsBeforeSuper.Range", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Range", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "lo", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "hi", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = false, @Size = 1] | +- ConstructorDeclaration[@Abstract = false, @Arity = 3, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "Range", @Name = "Range", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = false, @Size = 3] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "lo", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "hi", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "maxDistance", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 3, @containsComment = false] @@ -251,22 +251,22 @@ | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "lo", @Name = "lo", @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "hi", @Name = "hi", @ParenthesisDepth = 0, @Parenthesized = false] +- EnumDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep447_StatementsBeforeSuper$Color", @CanonicalName = "Jep447_StatementsBeforeSuper.Color", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = true, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Color", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{public}"] + +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PUBLIC)] +- EnumBody[@Empty = false, @SeparatorSemi = true, @Size = 4, @TrailingComma = false] +- EnumConstant[@AnonymousClass = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Image = "BLUE", @MethodName = "new", @Name = "BLUE", @Visibility = Visibility.V_PUBLIC] - | +- ModifierList[@EffectiveModifiers = "{public, static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = true, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "BLUE", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = true, @Visibility = Visibility.V_PUBLIC] | +- ArgumentList[@Empty = false, @Size = 1] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Image = "Color", @Name = "Color", @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- ConstructorDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Image = "Color", @Name = "Color", @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @containsComment = false] - | +- ModifierList[@EffectiveModifiers = "{private}", @ExplicitModifiers = "{private}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 2, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep459_StringTemplates.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep459_StringTemplates.txt index c65df30abd..969a8c9b36 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep459_StringTemplates.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep459_StringTemplates.txt @@ -5,43 +5,43 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.time.format.DateTimeFormatter", @ImportedSimpleName = "DateTimeFormatter", @PackageName = "java.time.format", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.time.LocalTime", @ImportedSimpleName = "LocalTime", @PackageName = "java.time", @Static = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep459_StringTemplates", @CanonicalName = "Jep459_StringTemplates", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Jep459_StringTemplates", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassBody[@Empty = false, @Size = 9] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep459_StringTemplates$Request", @CanonicalName = "Jep459_StringTemplates.Request", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Request", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 3, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "date", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "time", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "ipAddress", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "STRTemplateProcessor", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 19, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "firstName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "firstName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Bill", @Empty = false, @Image = "\"Bill\"", @Length = 4, @LiteralText = "\"Bill\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "lastName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "lastName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Duck", @Empty = false, @Image = "\"Duck\"", @Length = 4, @LiteralText = "\"Duck\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "fullName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "fullName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -54,7 +54,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "lastName", @Name = "lastName", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "sortName"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "sortName", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -67,7 +67,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "firstName", @Name = "firstName", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "x"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "x", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -76,7 +76,7 @@ | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "y", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "20", @IntLiteral = true, @Integral = true, @LiteralText = "20", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 20.0, @ValueAsFloat = 20.0, @ValueAsInt = 20, @ValueAsLong = 20] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s1"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -93,7 +93,7 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "y", @Name = "y", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s2"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -105,7 +105,7 @@ | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- TemplateFragment[@Content = "} waiting for you!\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "Request"] | | +- VariableDeclarator[@Initializer = true, @Name = "req"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "req", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -116,7 +116,7 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "15:34", @Empty = false, @Image = "\"15:34\"", @Length = 5, @LiteralText = "\"15:34\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "8.8.8.8", @Empty = false, @Image = "\"8.8.8.8\"", @Length = 7, @LiteralText = "\"8.8.8.8\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "t"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "t", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -134,13 +134,13 @@ | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "req", @Name = "req", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "filePath"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "filePath", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "tmp.dat", @Empty = false, @Image = "\"tmp.dat\"", @Length = 7, @LiteralText = "\"tmp.dat\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "File"] | | +- VariableDeclarator[@Initializer = true, @Name = "file"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "file", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -149,7 +149,7 @@ | | +- ArgumentList[@Empty = false, @Size = 1] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "filePath", @Name = "filePath", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "old"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "old", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -168,7 +168,7 @@ | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "does not", @Empty = false, @Image = "\"does not\"", @Length = 8, @LiteralText = "\"does not\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = " exist", @Empty = false, @Image = "\" exist\"", @Length = 6, @LiteralText = "\" exist\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "msg"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "msg", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -186,7 +186,7 @@ | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "does not", @Empty = false, @Image = "\"does not\"", @Length = 8, @LiteralText = "\"does not\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- TemplateFragment[@Content = "} exist\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "time"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "time", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -207,13 +207,13 @@ | | | +- ArgumentList[@Empty = true, @Size = 0] | | +- TemplateFragment[@Content = "} right now\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableDeclarator[@Initializer = true, @Name = "index"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "index", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "data"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "data", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -234,7 +234,7 @@ | | | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "index", @Name = "index", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -246,7 +246,7 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "oranges", @Empty = false, @Image = "\"oranges\"", @Length = 7, @LiteralText = "\"oranges\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "peaches", @Empty = false, @Image = "\"peaches\"", @Length = 7, @LiteralText = "\"peaches\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s3"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s3", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -272,7 +272,7 @@ | | | +- TemplateFragment[@Content = "}\""] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "s4"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s4", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -298,31 +298,31 @@ | | +- TemplateFragment[@Content = "}\""] | +- TemplateFragment[@Content = "}\""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "getOfferType", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "_getOfferType_", @Empty = false, @Image = "\"_getOfferType_\"", @Length = 14, @LiteralText = "\"_getOfferType_\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "multilineTemplateExpressions", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 10, @containsComment = true] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "title"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "title", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "My Web Page", @Empty = false, @Image = "\"My Web Page\"", @Length = 11, @LiteralText = "\"My Web Page\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "text"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "text", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hello, world", @Empty = false, @Image = "\"Hello, world\"", @Length = 12, @LiteralText = "\"Hello, world\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "html"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "html", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -335,25 +335,25 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "text", @Name = "text", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}

\n \n \n \"\"\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "name"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "name", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Joan Smith", @Empty = false, @Image = "\"Joan Smith\"", @Length = 10, @LiteralText = "\"Joan Smith\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "phone"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "phone", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "555-123-4567", @Empty = false, @Image = "\"555-123-4567\"", @Length = 12, @LiteralText = "\"555-123-4567\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "address"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "address", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "1 Maple Drive, Anytown", @Empty = false, @Image = "\"1 Maple Drive, Anytown\"", @Length = 22, @LiteralText = "\"1 Maple Drive, Anytown\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "json"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "json", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -369,23 +369,23 @@ | | +- TemplateFragment[@Content = "}\"\n }\n \"\"\""] | +- LocalClassStatement[] | | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep459_StringTemplates$1Rectangle", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Rectangle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- RecordComponentList[@Empty = false, @Size = 3, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "name", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "width", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "height", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = false, @Size = 1] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Name = "area", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -394,7 +394,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "width", @Name = "width", @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "height", @Name = "height", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -426,7 +426,7 @@ | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "7.1", @IntLiteral = false, @Integral = false, @LiteralText = "7.1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 7.1, @ValueAsFloat = 7.1, @ValueAsInt = 7, @ValueAsLong = 7] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "11.23", @IntLiteral = false, @Integral = false, @LiteralText = "11.23", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 11.23, @ValueAsFloat = 11.23, @ValueAsInt = 11, @ValueAsLong = 11] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "table"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "table", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -516,29 +516,29 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- TemplateFragment[@Content = "}\n \"\"\""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "FMTTemplateProcessor", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 4, @containsComment = true] | +- LocalClassStatement[] | | +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep459_StringTemplates$2Rectangle", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = true, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "Rectangle", @Static = true, @TopLevel = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | | +- RecordComponentList[@Empty = false, @Size = 3, @Varargs = false] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "name", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "width", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | | +- RecordComponent[@EffectiveVisibility = Visibility.V_LOCAL, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "height", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = false, @Size = 1] | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Name = "area", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | +- FormalParameters[@Empty = true, @Size = 0] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] @@ -548,7 +548,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "height", @Name = "height", @ParenthesisDepth = 0, @Parenthesized = false] | +- EmptyStatement[] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @SimpleName = "Rectangle"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -580,7 +580,7 @@ | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "7.1", @IntLiteral = false, @Integral = false, @LiteralText = "7.1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 7.1, @ValueAsFloat = 7.1, @ValueAsInt = 7, @ValueAsLong = 7] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "11.23", @IntLiteral = false, @Integral = false, @LiteralText = "11.23", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 11.23, @ValueAsFloat = 11.23, @ValueAsInt = 11, @ValueAsLong = 11] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "table"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "table", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -675,18 +675,18 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- TemplateFragment[@Content = "}\n \"\"\""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "ensuringSafety", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "name"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "name", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Joan", @Empty = false, @Image = "\"Joan\"", @Length = 4, @LiteralText = "\"Joan\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "StringTemplate"] | | +- VariableDeclarator[@Initializer = true, @Name = "st"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "st", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -697,7 +697,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "name", @Name = "name", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TemplateFragment[@Content = "}\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "info"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "info", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -706,24 +706,24 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "st", @Name = "st", @ParenthesisDepth = 0, @Parenthesized = false] +- RecordDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Jep459_StringTemplates$User", @CanonicalName = "Jep459_StringTemplates.User", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = true, @RegularClass = false, @RegularInterface = false, @SimpleName = "User", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{static, final}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = ()] | +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "firstName", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] - | | +- ModifierList[@EffectiveModifiers = "{private, final}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "accountNumber", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "literalsInsideTemplateExpressions", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - | +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = true] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s1"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -732,7 +732,7 @@ | | +- Template[] | | +- TemplateFragment[@Content = "\"Welcome to your account\""] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @SimpleName = "User"] | | +- VariableDeclarator[@Initializer = true, @Name = "user"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "user", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -742,7 +742,7 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Lisa", @Empty = false, @Image = "\"Lisa\"", @Length = 4, @LiteralText = "\"Lisa\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "12345", @IntLiteral = true, @Integral = true, @LiteralText = "12345", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 12345.0, @ValueAsFloat = 12345.0, @ValueAsInt = 12345, @ValueAsLong = 12345] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "s2"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s2", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -759,12 +759,12 @@ | | +- ArgumentList[@Empty = true, @Size = 0] | +- TemplateFragment[@Content = "}\""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "emptyEmbeddedExpression", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{static}", @ExplicitModifiers = "{static}"] + +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassType[@FullyQualified = false, @SimpleName = "String"] +- VariableDeclarator[@Initializer = true, @Name = "s1"] +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses1.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses1.txt index 8bafb59ab5..4826a0bcb2 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses1.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses1.txt @@ -1,6 +1,6 @@ +- CompilationUnit[@PackageName = ""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses2.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses2.txt index 200582f309..95f5757567 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses2.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses2.txt @@ -1,13 +1,13 @@ +- CompilationUnit[@PackageName = ""] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "greeting", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ReturnStatement[] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hello, World!", @Empty = false, @Image = "\"Hello, World!\"", @Length = 13, @LiteralText = "\"Hello, World!\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses3.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses3.txt index aa91140674..66f34f82b4 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses3.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses3.txt @@ -1,12 +1,12 @@ +- CompilationUnit[@PackageName = ""] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PACKAGE, @Static = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "greeting"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "greeting", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hello, World!", @Empty = false, @Image = "\"Hello, World!\"", @Length = 13, @LiteralText = "\"Hello, World!\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses4WithImports.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses4WithImports.txt index bca2c8a46c..5b20d948df 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses4WithImports.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep463_UnnamedClasses4WithImports.txt @@ -2,7 +2,7 @@ +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.Arrays", @ImportedSimpleName = "Arrays", @PackageName = "java.util", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "java.util.stream.Collectors", @ImportedSimpleName = "Collectors", @PackageName = "java.util.stream", @Static = false] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PACKAGE, @Static = false, @Visibility = Visibility.V_PACKAGE] - | +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "greeting"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "greeting", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] @@ -22,7 +22,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = ", ", @Empty = false, @Image = "\", \"", @Length = 2, @LiteralText = "\", \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"] + +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 1, @containsComment = false] From 62443a4c339eba94adf1d941b4b591e283a61355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 02:12:24 -0300 Subject: [PATCH 049/142] Update tree export test --- .../net/sourceforge/pmd/cli/TreeExportCliTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pmd-cli/src/test/java/net/sourceforge/pmd/cli/TreeExportCliTest.java b/pmd-cli/src/test/java/net/sourceforge/pmd/cli/TreeExportCliTest.java index f446439516..6e7ba26db4 100644 --- a/pmd-cli/src/test/java/net/sourceforge/pmd/cli/TreeExportCliTest.java +++ b/pmd-cli/src/test/java/net/sourceforge/pmd/cli/TreeExportCliTest.java @@ -31,9 +31,9 @@ class TreeExportCliTest extends BaseCliTest { final CliExecutionResult output = runCliSuccessfully("-i", "-f", "xml", "-PlineSeparator=LF"); output.checkStdOut(equalTo("\n" - + "\n" - + " \n" - + " \n" + + "\n" + + " \n" + + " \n" + " \n" + "\n")); }); @@ -44,9 +44,9 @@ class TreeExportCliTest extends BaseCliTest { File file = newFileWithContents("(a(b))"); final CliExecutionResult result = runCliSuccessfully("--file", file.getAbsolutePath(), "-f", "xml", "-PlineSeparator=LF"); result.checkStdOut(equalTo("\n" - + "\n" - + " \n" - + " \n" + + "\n" + + " \n" + + " \n" + " \n" + "\n")); } From 1231a54300c086d65932e7b70540ebe8e38607fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 08:56:48 -0300 Subject: [PATCH 050/142] Remove unsused imports --- .../sourceforge/pmd/lang/java/JavaAttributesPrinter.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaAttributesPrinter.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaAttributesPrinter.java index 9353eb5336..bb93d65c76 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaAttributesPrinter.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/JavaAttributesPrinter.java @@ -4,17 +4,11 @@ package net.sourceforge.pmd.lang.java; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - import org.checkerframework.checker.nullness.qual.NonNull; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.java.ast.ASTExpression; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; -import net.sourceforge.pmd.lang.java.ast.ASTModifierList; -import net.sourceforge.pmd.lang.java.ast.JModifier; import net.sourceforge.pmd.lang.java.ast.ModifierOwner; import net.sourceforge.pmd.lang.rule.xpath.Attribute; import net.sourceforge.pmd.lang.test.ast.RelevantAttributePrinter; From 346d7fd0dcde6398e55673bd4abe52c25c1d488b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 09:02:16 -0300 Subject: [PATCH 051/142] Do not warn for List being deprecated by default --- .../net/sourceforge/pmd/lang/rule/xpath/Attribute.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java index 3b032e558f..54edbcb3d9 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java @@ -106,16 +106,11 @@ public final class Attribute { return null; } else { DeprecatedAttribute annot = method.getAnnotation(DeprecatedAttribute.class); - String result = annot != null + return annot != null ? annot.replaceWith() : method.isAnnotationPresent(Deprecated.class) ? DeprecatedAttribute.NO_REPLACEMENT : null; - if (result == null && List.class.isAssignableFrom(method.getReturnType())) { - // Lists are generally deprecated, see #2451 - result = DeprecatedAttribute.NO_REPLACEMENT; - } - return result; } } From 3650622645f70b358aecbbb5f8482e232abae4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 19 Apr 2024 09:08:21 -0300 Subject: [PATCH 052/142] Remove unused imports --- .../main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java | 1 - 1 file changed, 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java index 54edbcb3d9..3bf41f5f4e 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java @@ -7,7 +7,6 @@ package net.sourceforge.pmd.lang.rule.xpath; import java.lang.invoke.MethodHandle; import java.lang.reflect.Method; import java.lang.reflect.Type; -import java.util.List; import java.util.Objects; import org.checkerframework.checker.nullness.qual.NonNull; From 46cfe3c7df1d3aea41127de781130d57570a3e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 20 Apr 2024 12:19:20 +0200 Subject: [PATCH 053/142] Handle array allocations in try block better --- .../lang/java/rule/internal/DataflowPass.java | 45 ++++++++++++++----- .../bestpractices/xml/UnusedAssignment.xml | 30 +++++++++++++ 2 files changed, 64 insertions(+), 11 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index eb8baf099d..416652e456 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -25,6 +25,7 @@ import org.pcollections.PSet; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.NodeStream; +import net.sourceforge.pmd.lang.java.ast.ASTArrayAllocation; import net.sourceforge.pmd.lang.java.ast.ASTAssignableExpr.ASTNamedReferenceExpr; import net.sourceforge.pmd.lang.java.ast.ASTAssignableExpr.AccessType; import net.sourceforge.pmd.lang.java.ast.ASTAssignmentExpression; @@ -614,14 +615,13 @@ public final class DataflowPass { }); if (finallyClause != null) { - if (finalState.abruptCompletionTargets.contains(finalState.global.abruptCompletionTarget)) { + if (finalState.abruptCompletionTargets.contains(finalState.returnOrThrowTarget)) { // this represents the finally clause when it was entered // because of abrupt completion // since we don't know when it terminated we must join it with before SpanInfo abruptFinally = before.myFinally.absorb(before); acceptOpt(finallyClause, abruptFinally); before.myFinally = null; - // fixme this should be handled another way. Not all try blocks may throw. abruptFinally.abruptCompletionByThrow(false); // propagate to enclosing catch/finallies } @@ -629,6 +629,11 @@ public final class DataflowPass { finalState = acceptOpt(finallyClause, finalState); // then all break targets are successors of the finally for (SpanInfo target : finalState.abruptCompletionTargets) { + // Then there is a return or throw within the try or catch blocks. + // Control first passes to the finally, then tries to get out of the function + // (stopping on finally). + // before.myFinally = null; + //finalState.abruptCompletionByThrow(false); // propagate to enclosing catch/finallies target.absorb(finalState); } } @@ -871,7 +876,7 @@ public final class DataflowPass { @Override public SpanInfo visit(ASTReturnStatement node, SpanInfo data) { super.visit(node, data); - return data.abruptCompletion(data.global.abruptCompletionTarget); + return data.abruptCompletion(data.returnOrThrowTarget); } // following deals with assignment @@ -1036,6 +1041,16 @@ public final class DataflowPass { return state; } + @Override + public SpanInfo visit(ASTArrayAllocation node, SpanInfo state) { + state = acceptOpt(node.getArrayInitializer(), state); + state = acceptOpt(node.getTypeNode().getDimensions(), state); + // May throw OOM error for instance. This abrupt completion routine is + // noop if we are outside a try block. + state.abruptCompletionByThrow(true); + return state; + } + private SpanInfo visitInvocationExpr(T node, SpanInfo state) { state = acceptOpt(node.getQualifier(), state); state = acceptOpt(node.getArguments(), state); @@ -1176,9 +1191,6 @@ public final class DataflowPass { // continue jumps to the condition check, while break jumps to after the loop final TargetStack continueTargets = new TargetStack(); - /** Sentinel to represent the target of a throw or return statement. */ - final SpanInfo abruptCompletionTarget = new SpanInfo(this); - private GlobalAlgoState(Set allAssignments, Set usedAssignments, Map> killRecord) { @@ -1268,21 +1280,27 @@ public final class DataflowPass { /** * Collects the abrupt completion targets of the current span. - * The value {@link GlobalAlgoState#abruptCompletionTarget} + * The value {@link #returnOrThrowTarget} * represents a return statement or a throw that * is not followed by an enclosing finally block. */ private PSet abruptCompletionTargets = HashTreePSet.empty(); + /** + * Sentinel to represent the target of a throw or return statement. + */ + private final SpanInfo returnOrThrowTarget; + private SpanInfo(GlobalAlgoState global) { this(null, global, new LinkedHashMap<>()); } - private SpanInfo(SpanInfo parent, + private SpanInfo(@Nullable SpanInfo parent, GlobalAlgoState global, Map symtable) { this.parent = parent; + this.returnOrThrowTarget = parent == null ? this : parent.returnOrThrowTarget; this.global = global; this.symtable = symtable; this.myCatches = Collections.emptyList(); @@ -1456,16 +1474,21 @@ public final class DataflowPass { abruptCompletionTargets = abruptCompletionTargets.plus(target); SpanInfo parent = this; - while (parent != target && parent != null) { // NOPMD CompareObjectsWithEqual this is what we want + while (parent != null) { if (parent.myFinally != null) { parent.myFinally.absorb(this); // stop on the first finally, its own end state will // be merged into the nearest enclosing finally - return this; + break; + } + if (parent == target) { // NOPMD CompareObjectsWithEqual this is what we want + break; } parent = parent.parent; + } + // rest of this block is dead code so we don't track declarations this.symtable.clear(); return this; } @@ -1489,7 +1512,7 @@ public final class DataflowPass { if (!byMethodCall) { hasCompletedAbruptly = OptionalBool.YES; } - abruptCompletionTargets = abruptCompletionTargets.plus(global.abruptCompletionTarget); + abruptCompletionTargets = abruptCompletionTargets.plus(returnOrThrowTarget); SpanInfo parent = this; while (parent != null) { diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml index 12e5878463..c1b48c170d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml @@ -2858,6 +2858,36 @@ public class Test { ]]>
+ + Try with nested finally + 0 + + From af4ed5951f19297661a8e49c1ed6827d047d4f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 20 Apr 2024 12:53:10 +0200 Subject: [PATCH 054/142] Replace usages of deprecated methods --- .../lang/java/ast/ASTLambdaExpression.java | 33 ++++++++++--------- .../java/ast/internal/PrettyPrintingUtil.java | 2 +- .../LambdaCanBeMethodReferenceRule.java | 4 +-- .../internal/infer/ast/LambdaMirrorImpl.java | 10 +++--- .../pmd/lang/java/ast/TestExtensions.kt | 10 +++--- .../types/internal/infer/TypeInferenceTest.kt | 2 +- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTLambdaExpression.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTLambdaExpression.java index b068b1929a..dcf14f021d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTLambdaExpression.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTLambdaExpression.java @@ -7,7 +7,6 @@ package net.sourceforge.pmd.lang.java.ast; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import net.sourceforge.pmd.lang.ast.NodeStream; import net.sourceforge.pmd.lang.java.types.JMethodSig; import net.sourceforge.pmd.lang.java.types.JTypeMirror; @@ -75,35 +74,39 @@ public final class ASTLambdaExpression extends AbstractJavaExpr implements Funct return !isBlockBody(); } - /** Returns the body of this expression, if it is a block. */ + /** + * Returns the body of this expression, if it is a block. + * + * @deprecated Use {@link #getBlockBody()} + */ + @Deprecated public @Nullable ASTBlock getBlock() { - return AstImplUtil.getChildAs(this, 1, ASTBlock.class); + return getBlockBody(); } - /** Returns the body of this expression, if it is an expression. */ + /** + * Returns the body of this expression, if it is an expression. + * + * @deprecated Use {@link #getExpressionBody()} + */ + @Deprecated public @Nullable ASTExpression getExpression() { - return AstImplUtil.getChildAs(this, 1, ASTExpression.class); + return getExpressionBody(); } /** * Returns the body of this lambda if it is a block. - * @deprecated Use {@link #getBlock()} */ - @Nullable - @Deprecated - public ASTBlock getBlockBody() { - return NodeStream.of(getLastChild()).filterIs(ASTBlock.class).first(); + public @Nullable ASTBlock getBlockBody() { + return AstImplUtil.getChildAs(this, 1, ASTBlock.class); } /** * Returns the body of this lambda if it is an expression. - * @deprecated Use {@link #getExpression()} */ - @Nullable - @Deprecated - public ASTExpression getExpressionBody() { - return NodeStream.of(getLastChild()).filterIs(ASTExpression.class).first(); + public @Nullable ASTExpression getExpressionBody() { + return AstImplUtil.getChildAs(this, 1, ASTExpression.class); } @Override diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java index 43464c046d..7d28a03cad 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java @@ -383,7 +383,7 @@ public final class PrettyPrintingUtil { public Void visit(ASTLambdaExpression node, StringBuilder sb) { node.getParameters().acceptVisitor(this, sb); sb.append(" -> "); - ASTExpression exprBody = node.getExpression(); + ASTExpression exprBody = node.getExpressionBody(); if (exprBody != null) { exprBody.acceptVisitor(this, sb); } else { diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index f3bda21466..2bf8bf47b2 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -61,10 +61,10 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { @Override public Object visit(ASTLambdaExpression node, Object data) { if (node.isExpressionBody()) { - ASTExpression expression = node.getExpression(); + ASTExpression expression = node.getExpressionBody(); processLambdaWithBody(node, asCtx(data), expression); } else { - ASTStatement onlyStmt = ASTList.singleOrNull(node.getBlock()); + ASTStatement onlyStmt = ASTList.singleOrNull(node.getBlockBody()); if (onlyStmt instanceof ASTReturnStatement) { processLambdaWithBody(node, asCtx(data), ((ASTReturnStatement) onlyStmt).getExpr()); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ast/LambdaMirrorImpl.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ast/LambdaMirrorImpl.java index 69f6fa1da2..d354acb4e4 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ast/LambdaMirrorImpl.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ast/LambdaMirrorImpl.java @@ -91,9 +91,9 @@ class LambdaMirrorImpl extends BaseFunctionalMirror impleme @Override public List getResultExpressions() { - ASTBlock block = myNode.getBlock(); + ASTBlock block = myNode.getBlockBody(); if (block == null) { - return Collections.singletonList(createSubexpression(myNode.getExpression())); + return Collections.singletonList(createSubexpression(myNode.getExpressionBody())); } else { return block.descendants(ASTReturnStatement.class) .map(ASTReturnStatement::getExpr) @@ -111,15 +111,15 @@ class LambdaMirrorImpl extends BaseFunctionalMirror impleme @Override public boolean isValueCompatible() { - ASTBlock block = myNode.getBlock(); + ASTBlock block = myNode.getBlockBody(); return block == null || isLambdaBodyCompatible(block, false); } @Override public boolean isVoidCompatible() { - ASTBlock block = myNode.getBlock(); + ASTBlock block = myNode.getBlockBody(); if (block == null) { - return isExpressionStatement(myNode.getExpression()); + return isExpressionStatement(myNode.getExpressionBody()); } else { return isLambdaBodyCompatible(block, true); } diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/TestExtensions.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/TestExtensions.kt index 220b3c8f77..89b76f3f48 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/TestExtensions.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/TestExtensions.kt @@ -13,12 +13,12 @@ import io.kotest.matchers.shouldNotBe import io.kotest.matchers.types.shouldBeInstanceOf import net.sourceforge.pmd.lang.ast.Node import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken -import net.sourceforge.pmd.lang.test.ast.NodeSpec -import net.sourceforge.pmd.lang.test.ast.ValuedNodeSpec -import net.sourceforge.pmd.lang.test.ast.shouldBe import net.sourceforge.pmd.lang.java.ast.internal.PrettyPrintingUtil import net.sourceforge.pmd.lang.java.types.JPrimitiveType.PrimitiveTypeKind import net.sourceforge.pmd.lang.java.types.JPrimitiveType.PrimitiveTypeKind.* +import net.sourceforge.pmd.lang.test.ast.NodeSpec +import net.sourceforge.pmd.lang.test.ast.ValuedNodeSpec +import net.sourceforge.pmd.lang.test.ast.shouldBe fun > C?.shouldContainAtMostOneOf(vararg expected: T) { this shouldNotBe null @@ -521,7 +521,7 @@ fun TreeNodeWrapper.blockLambda(assertions: ValuedNodeSpec.exprLambda(assertions: ValuedNodeSpec { + it::getExpressionBody shouldBe child { it shouldHaveType it.typeSystem.BOOLEAN it::getQualifier shouldBe variableAccess("it") { it shouldHaveType it.typeSystem.STRING From 653c3bfb79756e0a6cf98aeae942ee80e2ffe476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 20 Apr 2024 13:01:38 +0200 Subject: [PATCH 055/142] Ignore annotated lambdas --- .../LambdaCanBeMethodReferenceRule.java | 3 ++ .../xml/LambdaCanBeMethodReference.xml | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java index 2bf8bf47b2..e2c9bd56ec 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/LambdaCanBeMethodReferenceRule.java @@ -73,6 +73,9 @@ public class LambdaCanBeMethodReferenceRule extends AbstractJavaRulechainRule { } private void processLambdaWithBody(ASTLambdaExpression lambda, RuleContext data, ASTExpression expression) { + if (lambda.getParameters().toStream().any(it -> it.getDeclaredAnnotations().nonEmpty())) { + return; + } if (expression instanceof ASTMethodCall) { ASTMethodCall call = (ASTMethodCall) expression; if (canBeTransformed(lambda, call) && argumentsListMatches(call, lambda.getParameters())) { diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml index fab395cf60..48f0f2d328 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/LambdaCanBeMethodReference.xml @@ -173,6 +173,36 @@ } ]]> + + Test annotated lambda + 0 + Integer.valueOf(x)); + } + + public boolean correct(int a) { + return false; + } + } + + @Target(ElementType.TYPE_USE) + @interface Annot { + } + + interface ALambda { + boolean doSomething(int a); + } + ]]> + test when method call is invalid 0 From 3f667eab04853d62dab3701fc693668a983fe771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 20 Apr 2024 13:04:19 +0200 Subject: [PATCH 056/142] Add rule to quickstart ruleset --- docs/pages/release_notes.md | 3 ++- pmd-java/src/main/resources/rulesets/java/quickstart.xml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index c9a5ea51a2..f031e84c8d 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -20,7 +20,8 @@ This is a {{ site.pmd.release_type }} release. when a varargs is expected. This is more heavy to read and could be simplified. - The new Java rule {% rule "java/codestyle/LambdaCanBeMethodReference" %} reports lambda expressions that can be replaced - with a method reference. Please read the documentation of the rule for more info. + with a method reference. Please read the documentation of the rule for more info. This rule is now part of the Quickstart + ruleset. ### 🌟 Rule Changes diff --git a/pmd-java/src/main/resources/rulesets/java/quickstart.xml b/pmd-java/src/main/resources/rulesets/java/quickstart.xml index be41ab2da7..5cb3a7f905 100644 --- a/pmd-java/src/main/resources/rulesets/java/quickstart.xml +++ b/pmd-java/src/main/resources/rulesets/java/quickstart.xml @@ -62,6 +62,7 @@ + From ad9ff650795fc4466851be84c3a5501b405bb946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 20 Apr 2024 16:18:00 +0200 Subject: [PATCH 057/142] Fix FN with empty switch --- .../lang/java/rule/internal/DataflowPass.java | 2 +- .../xml/ImplicitSwitchFallThrough.xml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index 416652e456..9f0ab39fa0 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -395,7 +395,7 @@ public final class DataflowPass { // If switch non-total then there is a path where the switch completes normally // (value not matched). boolean isTotal = switchLike.hasDefaultCase() - || !switchLike.isFallthroughSwitch() + || !switchLike.isFallthroughSwitch() && switchLike.getBranches().nonEmpty() || switchLike.isExhaustiveEnumSwitch(); PSet successors = HashTreePSet.empty(); diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml index 80ea0e8411..8a0efa2aee 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml @@ -477,4 +477,23 @@ record MyRecord(boolean b) { } ]]> + + Switch with loop with break + 1 + 6 + + From 60f03d75bfb9cb34b5fe5152916baddd05638737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 20 Apr 2024 16:22:07 +0200 Subject: [PATCH 058/142] Blocks can also be labeled (fp in jdk sources) --- .../lang/java/rule/internal/DataflowPass.java | 32 ++++++++++--------- .../bestpractices/xml/UnusedAssignment.xml | 19 +++++++++++ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index 9f0ab39fa0..73ce8c3ecb 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -352,27 +352,29 @@ public final class DataflowPass { @Override public SpanInfo visit(ASTBlock node, final SpanInfo data) { - // variables local to a loop iteration must be killed before the - // next iteration + return processBreakableStmt(node, data, () -> { + // variables local to a loop iteration must be killed before the + // next iteration - SpanInfo state = data; - List localsToKill = new ArrayList<>(0); + SpanInfo state = data; + List localsToKill = new ArrayList<>(0); - for (JavaNode child : node.children()) { - // each output is passed as input to the next (most relevant for blocks) - state = acceptOpt(child, state); - if (child instanceof ASTLocalVariableDeclaration) { - for (ASTVariableId id : (ASTLocalVariableDeclaration) child) { - localsToKill.add(id); + for (JavaNode child : node.children()) { + // each output is passed as input to the next (most relevant for blocks) + state = acceptOpt(child, state); + if (child instanceof ASTLocalVariableDeclaration) { + for (ASTVariableId id : (ASTLocalVariableDeclaration) child) { + localsToKill.add(id); + } } } - } - for (ASTVariableId var : localsToKill) { - state.deleteVar(var.getSymbol()); - } + for (ASTVariableId var : localsToKill) { + state.deleteVar(var.getSymbol()); + } - return state; + return state; + }); } @Override diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml index c1b48c170d..8d58a2daf9 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml @@ -2958,6 +2958,25 @@ class Foo { ]]> + + Labeled block + 0 + + + From 25dfc2d72808004284da3e9cf71407eb6ef82c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 20 Apr 2024 21:51:13 +0200 Subject: [PATCH 059/142] Fix some things --- .../lang/java/rule/internal/DataflowPass.java | 52 ++++++------ .../bestpractices/xml/UnusedAssignment.xml | 30 +++++++ .../xml/ImplicitSwitchFallThrough.xml | 85 +++++++++++++++++++ 3 files changed, 142 insertions(+), 25 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index 73ce8c3ecb..6e0925a46e 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -393,11 +393,13 @@ public final class DataflowPass { SpanInfo breakTarget = before.fork(); global.breakTargets.push(breakTarget); + accLabels(switchLike, global, breakTarget, null); // If switch non-total then there is a path where the switch completes normally // (value not matched). + // Todo make that an attribute of ASTSwitchLike, check for totality when pattern matching is involved boolean isTotal = switchLike.hasDefaultCase() - || !switchLike.isFallthroughSwitch() && switchLike.getBranches().nonEmpty() + || switchLike instanceof ASTSwitchExpression || switchLike.isExhaustiveEnumSwitch(); PSet successors = HashTreePSet.empty(); @@ -428,7 +430,7 @@ public final class DataflowPass { if (isTotal && allBranchesCompleteAbruptly && externalTargets.equals(successors)) { // then all branches complete abruptly, and none of them because of a break to this switch switchCompletesAbruptly = OptionalBool.YES; - } else if (successors.isEmpty() || asSingle(successors) == before) { // NOPMD CompareObjectsWithEqual this is what we want + } else if (successors.isEmpty() || asSingle(successors) == breakTarget) { // NOPMD CompareObjectsWithEqual this is what we want // then the branches complete normally, or they just break the switch switchCompletesAbruptly = OptionalBool.NO; } else { @@ -774,8 +776,8 @@ public final class DataflowPass { } // These targets are now obsolete - result.abruptCompletionTargets = result.abruptCompletionTargets.minus(breakTarget); - result.abruptCompletionTargets = result.abruptCompletionTargets.minus(continueTarget); + result.abruptCompletionTargets = + result.abruptCompletionTargets.minus(breakTarget).minus(continueTarget); return result; } @@ -790,41 +792,41 @@ public final class DataflowPass { */ private SpanInfo processBreakableStmt(ASTStatement statement, SpanInfo input, Supplier processFun) { GlobalAlgoState globalState = input.global; - Node parent = statement.getParent(); - // in most cases this will remain empty - PSet labels = HashTreePSet.empty(); // this will be filled with the reaching defs of the break statements, then merged with the actual exit state SpanInfo placeholderForExitState = input.forkEmpty(); - // collect labels and give a name to the exit state. - while (parent instanceof ASTLabeledStatement) { - String label = ((ASTLabeledStatement) parent).getLabel(); - labels = labels.plus(label); - globalState.breakTargets.namedTargets.put(label, placeholderForExitState); - parent = parent.getParent(); - } + PSet labels = accLabels(statement, globalState, placeholderForExitState, null); SpanInfo endState = processFun.get(); // remove the labels globalState.breakTargets.namedTargets.keySet().removeAll(labels); + SpanInfo result = endState.absorb(placeholderForExitState); + result.abruptCompletionTargets = result.abruptCompletionTargets.minus(placeholderForExitState); + return result; + } - // todo edit the break targets - - return endState.absorb(placeholderForExitState); + private static PSet accLabels(JavaNode statement, GlobalAlgoState globalState, SpanInfo breakTarget, @Nullable SpanInfo continueTarget) { + Node parent = statement.getParent(); + // in most cases this will remain empty + PSet labels = HashTreePSet.empty(); + // collect labels and give a name to the exit state. + while (parent instanceof ASTLabeledStatement) { + String label = ((ASTLabeledStatement) parent).getLabel(); + labels = labels.plus(label); + globalState.breakTargets.namedTargets.put(label, breakTarget); + if (continueTarget != null) { + globalState.continueTargets.namedTargets.put(label, continueTarget); + } + parent = parent.getParent(); + } + return labels; } private void pushTargets(ASTLoopStatement loop, SpanInfo breakTarget, SpanInfo continueTarget) { GlobalAlgoState globalState = breakTarget.global; + accLabels(loop, globalState, breakTarget, continueTarget); globalState.breakTargets.unnamedTargets.push(breakTarget); globalState.continueTargets.unnamedTargets.push(continueTarget); - - Node parent = loop.getParent(); - while (parent instanceof ASTLabeledStatement) { - String label = ((ASTLabeledStatement) parent).getLabel(); - globalState.breakTargets.namedTargets.put(label, breakTarget); - globalState.continueTargets.namedTargets.put(label, continueTarget); - parent = parent.getParent(); - } } private SpanInfo popTargets(ASTLoopStatement loop, SpanInfo breakTarget, SpanInfo continueTarget) { diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml index 8d58a2daf9..0d36b80ef7 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedAssignment.xml @@ -3895,6 +3895,36 @@ record TestRecord(int foo) { this.foo = foo; // explicit } } +]]> + + + Label on switch + 0 + diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml index 8a0efa2aee..6d86131b0d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ImplicitSwitchFallThrough.xml @@ -496,4 +496,89 @@ record MyRecord(boolean b) { } ]]> + + Switch with break to enclosing block + 0 + + + + Switch expr + 0 + 0) { + if (k == 5) { + k--; + continue; + } + break LOP; + } + Supplier getter = () -> { return "2-X-5"; }; + yield getter.get(); + default: + yield "X"; + }; + } +} + ]]> + From 75e284075b0f3e0550e69ac3af7ab34244ef4c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 21 Apr 2024 13:31:27 +0200 Subject: [PATCH 060/142] Fix violations of UnnecessaryVarargsArrayCreation --- .../rule/design/CognitiveComplexityRule.java | 2 +- .../rule/design/CyclomaticComplexityRule.java | 2 +- .../AccessorMethodGenerationRule.java | 2 +- .../codestyle/IdenticalCatchBranchesRule.java | 2 +- .../rule/codestyle/UnnecessaryImportRule.java | 2 +- .../codestyle/UnnecessaryModifierRule.java | 10 ++++------ .../codestyle/UseDiamondOperatorRule.java | 2 +- .../rule/design/CognitiveComplexityRule.java | 8 ++++---- .../rule/design/CyclomaticComplexityRule.java | 8 ++------ .../java/rule/design/NPathComplexityRule.java | 8 ++++---- .../lang/java/rule/design/NcssCountRule.java | 5 ++--- .../ConsecutiveLiteralAppendsRule.java | 3 +-- ...sufficientStringBufferDeclarationRule.java | 2 +- .../rule/design/CyclomaticComplexityRule.java | 20 +++++++++---------- 14 files changed, 34 insertions(+), 42 deletions(-) diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/CognitiveComplexityRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/CognitiveComplexityRule.java index 37112180d7..28a2110917 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/CognitiveComplexityRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/CognitiveComplexityRule.java @@ -75,7 +75,7 @@ public class CognitiveComplexityRule extends AbstractApexRule { String.valueOf(classLevelThreshold), }; - asCtx(data).addViolation(node, messageParams); + asCtx(data).addViolation(node, (Object[]) messageParams); } } return data; diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/CyclomaticComplexityRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/CyclomaticComplexityRule.java index 9318666fa5..e1af8663df 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/CyclomaticComplexityRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/design/CyclomaticComplexityRule.java @@ -78,7 +78,7 @@ public class CyclomaticComplexityRule extends AbstractApexRule { " total", classWmc + " (highest " + classHighest + ")", }; - asCtx(data).addViolation(node, messageParams); + asCtx(data).addViolation(node, (Object[]) messageParams); } } return data; diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AccessorMethodGenerationRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AccessorMethodGenerationRule.java index 0313d95be8..33e8e96c41 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AccessorMethodGenerationRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AccessorMethodGenerationRule.java @@ -76,7 +76,7 @@ public class AccessorMethodGenerationRule extends AbstractJavaRulechainRule { JavaNode node = sym.tryGetNode(); assert node != null : "Node should be in the same compilation unit"; if (reportedNodes.add(node)) { - ruleContext.addViolation(node, new String[] {stripPackageName(refExpr.getEnclosingType().getSymbol())}); + ruleContext.addViolation(node, stripPackageName(refExpr.getEnclosingType().getSymbol())); } } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/IdenticalCatchBranchesRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/IdenticalCatchBranchesRule.java index 00228a569b..9be54e90ab 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/IdenticalCatchBranchesRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/IdenticalCatchBranchesRule.java @@ -91,7 +91,7 @@ public class IdenticalCatchBranchesRule extends AbstractJavaRulechainRule { // By convention, lower catch blocks are collapsed into the highest one // The first node of the equivalence class is thus the block that should be transformed for (int i = 1; i < identicalStmts.size(); i++) { - asCtx(data).addViolation(identicalStmts.get(i), new String[]{identicalBranchName, }); + asCtx(data).addViolation(identicalStmts.get(i), identicalBranchName); } } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryImportRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryImportRule.java index 2b1bcf356e..b2049fa1fc 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryImportRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryImportRule.java @@ -220,7 +220,7 @@ public class UnnecessaryImportRule extends AbstractJavaRule { } private void reportWithMessage(ASTImportDeclaration node, Object data, String message) { - asCtx(data).addViolationWithMessage(node, message, new String[] { PrettyPrintingUtil.prettyImport(node) }); + asCtx(data).addViolationWithMessage(node, message, PrettyPrintingUtil.prettyImport(node)); } @Override diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java index 358ce5719c..97c9a263b8 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java @@ -54,12 +54,10 @@ public class UnnecessaryModifierRule extends AbstractJavaRulechainRule { if (unnecessaryModifiers.isEmpty()) { return; } - asCtx(data).addViolation(node, new String[]{ - formatUnnecessaryModifiers(unnecessaryModifiers), - PrettyPrintingUtil.getPrintableNodeKind(node), - PrettyPrintingUtil.getNodeName(node), - explanation.isEmpty() ? "" : ": " + explanation, - }); + asCtx(data).addViolation(node, formatUnnecessaryModifiers(unnecessaryModifiers), + PrettyPrintingUtil.getPrintableNodeKind(node), + PrettyPrintingUtil.getNodeName(node), + explanation.isEmpty() ? "" : ": " + explanation); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UseDiamondOperatorRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UseDiamondOperatorRule.java index a2ae464eae..d73916d580 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UseDiamondOperatorRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UseDiamondOperatorRule.java @@ -85,7 +85,7 @@ public class UseDiamondOperatorRule extends AbstractJavaRulechainRule { JavaNode reportNode = targs == null ? newTypeNode : targs; String message = targs == null ? RAW_TYPE_MESSAGE : REPLACE_TYPE_ARGS_MESSAGE; String replaceWith = produceSuggestedExprImage(ctorCall); - asCtx(data).addViolationWithMessage(reportNode, message, new String[] { replaceWith }); + asCtx(data).addViolationWithMessage(reportNode, message, replaceWith); } return null; } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CognitiveComplexityRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CognitiveComplexityRule.java index fe5fd9eafe..7a7978f0f5 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CognitiveComplexityRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CognitiveComplexityRule.java @@ -56,10 +56,10 @@ public class CognitiveComplexityRule extends AbstractJavaRulechainRule { int cognitive = MetricsUtil.computeMetric(COGNITIVE_COMPLEXITY, node); final int reportLevel = getReportLevel(); if (cognitive >= reportLevel) { - asCtx(data).addViolation(node, new String[] { node instanceof ASTMethodDeclaration ? "method" : "constructor", - PrettyPrintingUtil.displaySignature(node), - String.valueOf(cognitive), - String.valueOf(reportLevel) }); + asCtx(data).addViolation(node, node instanceof ASTMethodDeclaration ? "method" : "constructor", + PrettyPrintingUtil.displaySignature(node), + String.valueOf(cognitive), + String.valueOf(reportLevel)); } return data; diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CyclomaticComplexityRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CyclomaticComplexityRule.java index 349921ac12..52359d8439 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CyclomaticComplexityRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/CyclomaticComplexityRule.java @@ -89,7 +89,7 @@ public class CyclomaticComplexityRule extends AbstractJavaRulechainRule { " total", classWmc + " (highest " + classHighest + ")", }; - asCtx(data).addViolation(node, messageParams); + asCtx(data).addViolation(node, (Object[]) messageParams); } } return data; @@ -120,11 +120,7 @@ public class CyclomaticComplexityRule extends AbstractJavaRulechainRule { String kindname = node instanceof ASTConstructorDeclaration ? "constructor" : "method"; - - asCtx(data).addViolation(node, new String[] {kindname, - opname, - "", - "" + cyclo, }); + asCtx(data).addViolation(node, kindname, opname, "", "" + cyclo); } } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NPathComplexityRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NPathComplexityRule.java index fa1237ad4e..6c1f566dfe 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NPathComplexityRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NPathComplexityRule.java @@ -51,10 +51,10 @@ public class NPathComplexityRule extends AbstractJavaRulechainRule { BigInteger npath = MetricsUtil.computeMetric(JavaMetrics.NPATH, node); if (npath.compareTo(BigInteger.valueOf(reportLevel)) >= 0) { - asCtx(data).addViolation(node, new String[] {node instanceof ASTMethodDeclaration ? "method" : "constructor", - PrettyPrintingUtil.displaySignature(node), - String.valueOf(npath), - String.valueOf(reportLevel)}); + asCtx(data).addViolation(node, node instanceof ASTMethodDeclaration ? "method" : "constructor", + PrettyPrintingUtil.displaySignature(node), + String.valueOf(npath), + String.valueOf(reportLevel)); } return data; diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NcssCountRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NcssCountRule.java index fe252338f1..492d2474e4 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NcssCountRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NcssCountRule.java @@ -115,9 +115,8 @@ public final class NcssCountRule extends AbstractJavaRulechainRule { if (JavaMetrics.NCSS.supports(node)) { int methodSize = MetricsUtil.computeMetric(JavaMetrics.NCSS, node, ncssOptions); if (methodSize >= level) { - asCtx(data).addViolation(node, new String[] { - node instanceof ASTMethodDeclaration ? "method" : "constructor", - PrettyPrintingUtil.displaySignature(node), "" + methodSize, }); + asCtx(data).addViolation(node, node instanceof ASTMethodDeclaration ? "method" : "constructor", + PrettyPrintingUtil.displaySignature(node), "" + methodSize); } } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/ConsecutiveLiteralAppendsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/ConsecutiveLiteralAppendsRule.java index 8f100a88af..367c2e7be0 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/ConsecutiveLiteralAppendsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/ConsecutiveLiteralAppendsRule.java @@ -258,8 +258,7 @@ public class ConsecutiveLiteralAppendsRule extends AbstractJavaRulechainRule { private void checkForViolation(Object data) { if (counter.isViolation()) { assert counter.getReportNode() != null; - String[] param = { String.valueOf(counter.getCounter()) }; - asCtx(data).addViolation(counter.getReportNode(), param); + asCtx(data).addViolation(counter.getReportNode(), String.valueOf(counter.getCounter())); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationRule.java index 7f1905577f..a6fabf91a2 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationRule.java @@ -72,7 +72,7 @@ public class InsufficientStringBufferDeclarationRule extends AbstractJavaRulecha } - public String[] getParamsForViolation() { + public Object[] getParamsForViolation() { return new String[] { getTypeName(variable), String.valueOf(capacity), String.valueOf(anticipatedLength) }; } diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/design/CyclomaticComplexityRule.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/design/CyclomaticComplexityRule.java index ca79a806a2..c35c9b1752 100644 --- a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/design/CyclomaticComplexityRule.java +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/design/CyclomaticComplexityRule.java @@ -210,8 +210,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule { classEntry.getComplexityAverage(), classEntry.highestDecisionPoints); if (showClassesComplexity) { if (classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel) { - asCtx(data).addViolation(node, new String[] { "class", node.getImage(), - classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')', }); + asCtx(data).addViolation(node, "class", node.getImage(), + classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')'); } } return data; @@ -227,8 +227,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule { classEntry.highestDecisionPoints); if (showClassesComplexity) { if (classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel) { - asCtx(data).addViolation(node, new String[] { "class", node.getImage(), - classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')', }); + asCtx(data).addViolation(node, "class", node.getImage(), + classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')'); } } return data; @@ -276,8 +276,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule { ASTMethodDeclarator methodDeclarator = node.firstChild(ASTMethodDeclarator.class); if (methodEntry.decisionPoints >= reportLevel) { asCtx(data).addViolation(node, - new String[] { "method", methodDeclarator == null ? "" : methodDeclarator.getImage(), - String.valueOf(methodEntry.decisionPoints), }); + "method", methodDeclarator == null ? "" : methodDeclarator.getImage(), + String.valueOf(methodEntry.decisionPoints)); } } return data; @@ -306,8 +306,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule { ASTMethodDeclarator methodDeclarator = node.firstChild(ASTMethodDeclarator.class); if (methodEntry.decisionPoints >= reportLevel) { asCtx(data).addViolation(node, - new String[] { "method", methodDeclarator == null ? "" : methodDeclarator.getImage(), - String.valueOf(methodEntry.decisionPoints), }); + "method", methodDeclarator == null ? "" : methodDeclarator.getImage(), + String.valueOf(methodEntry.decisionPoints)); } } return data; @@ -334,8 +334,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule { ASTMethodDeclarator methodDeclarator = node.firstChild(ASTMethodDeclarator.class); if (methodEntry.decisionPoints >= reportLevel) { asCtx(data).addViolation(node, - new String[] { "method", methodDeclarator == null ? "" : methodDeclarator.getImage(), - String.valueOf(methodEntry.decisionPoints), }); + "method", methodDeclarator == null ? "" : methodDeclarator.getImage(), + String.valueOf(methodEntry.decisionPoints)); } } return data; From 29b12bcbd33961574f7f98ef1e1d77a6c4077914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 21 Apr 2024 13:37:20 +0200 Subject: [PATCH 061/142] Fix more violations --- .../rule/bestpractices/MissingOverrideRule.java | 2 +- .../bestpractices/UnusedFormalParameterRule.java | 2 +- .../codestyle/AbstractNamingConventionRule.java | 8 +++----- .../codestyle/FieldNamingConventionsRule.java | 8 +++----- .../rule/codestyle/LinguisticNamingRule.java | 14 +++++++------- .../UnnecessaryFullyQualifiedNameRule.java | 6 +++--- .../pmd/lang/java/rule/design/DataClassRule.java | 6 +++--- .../pmd/lang/java/rule/design/GodClassRule.java | 6 +++--- .../lang/java/rule/design/LawOfDemeterRule.java | 16 ++++++---------- .../rule/design/LoosePackageCouplingRule.java | 4 ++-- .../java/rule/errorprone/CloseResourceRule.java | 6 +++--- 11 files changed, 35 insertions(+), 43 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java index 74aed90913..da2fba47ea 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java @@ -24,7 +24,7 @@ public class MissingOverrideRule extends AbstractJavaRulechainRule { @Override public Object visit(ASTMethodDeclaration node, Object data) { if (node.isOverridden() && !node.isAnnotationPresent(Override.class)) { - asCtx(data).addViolation(node, new Object[] { PrettyPrintingUtil.displaySignature(node) }); + asCtx(data).addViolation(node, PrettyPrintingUtil.displaySignature(node)); } return data; } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedFormalParameterRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedFormalParameterRule.java index 4962c3e415..76dd7645f7 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedFormalParameterRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedFormalParameterRule.java @@ -52,7 +52,7 @@ public class UnusedFormalParameterRule extends AbstractJavaRulechainRule { for (ASTFormalParameter formal : node.getFormalParameters()) { ASTVariableId varId = formal.getVarId(); if (JavaAstUtils.isNeverUsed(varId) && !JavaRuleUtil.isExplicitUnusedVarName(varId.getName())) { - asCtx(data).addViolation(varId, new Object[] { node instanceof ASTMethodDeclaration ? "method" : "constructor", varId.getName(), }); + asCtx(data).addViolation(varId, node instanceof ASTMethodDeclaration ? "method" : "constructor", varId.getName()); } } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/AbstractNamingConventionRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/AbstractNamingConventionRule.java index ae98020f5e..4c1503392d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/AbstractNamingConventionRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/AbstractNamingConventionRule.java @@ -60,11 +60,9 @@ abstract class AbstractNamingConventionRule extends Abstract void checkMatches(T node, PropertyDescriptor regex, Object data) { String name = nameExtractor(node); if (!getProperty(regex).matcher(name).matches()) { - asCtx(data).addViolation(node, new Object[]{ - kindDisplayName(node, regex), - name, - getProperty(regex).toString(), - }); + asCtx(data).addViolation(node, kindDisplayName(node, regex), + name, + getProperty(regex).toString()); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/FieldNamingConventionsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/FieldNamingConventionsRule.java index 8ebab9356d..7b0f65506a 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/FieldNamingConventionsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/FieldNamingConventionsRule.java @@ -90,11 +90,9 @@ public class FieldNamingConventionsRule extends AbstractNamingConventionRule= WMC_VERY_HIGH && atfd > FEW_ATFD_THRESHOLD && tcc < TCC_THRESHOLD) { - asCtx(data).addViolation(node, new Object[] {wmc, - StringUtil.percentageString(tcc, 3), - atfd, }); + asCtx(data).addViolation(node, wmc, + StringUtil.percentageString(tcc, 3), + atfd); } return data; } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/LawOfDemeterRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/LawOfDemeterRule.java index c3907702b9..a2d9840b7e 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/LawOfDemeterRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/LawOfDemeterRule.java @@ -132,11 +132,9 @@ public class LawOfDemeterRule extends AbstractJavaRule { asCtx(data).addViolationWithMessage( node, FIELD_ACCESS_ON_FOREIGN_VALUE, - new Object[] { - node.getName(), - PrettyPrintingUtil.prettyPrint(node.getQualifier()), - foreignDegree(node.getQualifier()), - }); + node.getName(), + PrettyPrintingUtil.prettyPrint(node.getQualifier()), + foreignDegree(node.getQualifier())); } return null; } @@ -147,11 +145,9 @@ public class LawOfDemeterRule extends AbstractJavaRule { asCtx(data).addViolationWithMessage( node, METHOD_CALL_ON_FOREIGN_VALUE, - new Object[] { - node.getMethodName(), - PrettyPrintingUtil.prettyPrint(node.getQualifier()), - foreignDegree(node.getQualifier()), - }); + node.getMethodName(), + PrettyPrintingUtil.prettyPrint(node.getQualifier()), + foreignDegree(node.getQualifier())); } return null; } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/LoosePackageCouplingRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/LoosePackageCouplingRule.java index 0d48c33ef4..1e71a21117 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/LoosePackageCouplingRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/LoosePackageCouplingRule.java @@ -86,11 +86,11 @@ public class LoosePackageCouplingRule extends AbstractJavaRule { // On demand imports automatically fail because they include // everything if (node.isImportOnDemand()) { - asCtx(data).addViolation(node, new Object[] { node.getImportedName(), pkg }); + asCtx(data).addViolation(node, node.getImportedName(), pkg); break; } else { if (!isAllowedClass(node)) { - asCtx(data).addViolation(node, new Object[] { node.getImportedName(), pkg }); + asCtx(data).addViolation(node, node.getImportedName(), pkg); break; } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/CloseResourceRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/CloseResourceRule.java index ab9829d6cd..c3aa18a459 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/CloseResourceRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/CloseResourceRule.java @@ -176,7 +176,7 @@ public class CloseResourceRule extends AbstractJavaRule { if (isWrappingResourceSpecifiedInTry(resVar)) { reportedVarNames.add(resVar.getName()); asCtx(data).addViolationWithMessage(resVar, WRAPPING_TRY_WITH_RES_VAR_MESSAGE, - new Object[] { resVar.getName() }); + resVar.getName()); } else if (shouldVarOfTypeBeClosedInMethod(resVar, resVarType, methodOrConstructor)) { reportedVarNames.add(resVar.getName()); addCloseResourceViolation(resVar, runtimeType, data); @@ -185,7 +185,7 @@ public class CloseResourceRule extends AbstractJavaRule { if (reassigningStatement != null) { reportedVarNames.add(resVar.getName()); asCtx(data).addViolationWithMessage(reassigningStatement, REASSIGN_BEFORE_CLOSED_MESSAGE, - new Object[] { resVar.getName() }); + resVar.getName()); } } } @@ -696,7 +696,7 @@ public class CloseResourceRule extends AbstractJavaRule { ASTVariableAccess closedVar = (ASTVariableAccess) node.getQualifier(); if (isNotInFinallyBlock(closedVar) && !reportedVarNames.contains(closedVar.getName())) { asCtx(data).addViolationWithMessage(closedVar, CLOSE_IN_FINALLY_BLOCK_MESSAGE, - new Object[] { closedVar.getName() }); + closedVar.getName()); } } From 52c4f435a07d8cf0eaf98e40e39481e3f10b8a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 21 Apr 2024 14:05:01 +0200 Subject: [PATCH 062/142] Split UnnecessaryVarargsArrayCreation into two rules The new errorprone rule catches more cases (it doesn't only care about array allocations). --- docs/pages/release_notes.md | 3 + .../UnnecessaryVarargsArrayCreationRule.java | 18 +-- .../ConfusingArgumentToVarargsMethodRule.java | 62 ++++++++++ .../resources/category/java/bestpractices.xml | 26 +---- .../resources/category/java/errorprone.xml | 54 +++++++++ .../ConfusingArgumentToVarargsMethodTest.java | 11 ++ .../xml/UnnecessaryVarargsArrayCreation.xml | 7 +- .../xml/ConfusingArgumentToVarargsMethod.xml | 109 ++++++++++++++++++ 8 files changed, 247 insertions(+), 43 deletions(-) create mode 100644 pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConfusingArgumentToVarargsMethodRule.java create mode 100644 pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConfusingArgumentToVarargsMethodTest.java create mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/ConfusingArgumentToVarargsMethod.xml diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2857b638e9..0e9761e62b 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -18,6 +18,9 @@ This is a {{ site.pmd.release_type }} release. - The new Java rule {%rule java/bestpractices/UnnecessaryVarargsArrayCreation %} reports explicit array creation when a varargs is expected. This is more heavy to read and could be simplified. +- The new Java rule {%rule java/errorprone/ConfusingArgumentToVarargsMethod %} reports some confusing situations + where a varargs method is called with an inexact argument type. These may end up in a mismatch between the expected + parameter type and the actual value. ### 🌟 Rule Changes diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnnecessaryVarargsArrayCreationRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnnecessaryVarargsArrayCreationRule.java index 9ecb6e5374..153ac864db 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnnecessaryVarargsArrayCreationRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnnecessaryVarargsArrayCreationRule.java @@ -11,10 +11,8 @@ import net.sourceforge.pmd.lang.java.ast.ASTArrayAllocation; import net.sourceforge.pmd.lang.java.ast.InvocationNode; import net.sourceforge.pmd.lang.java.ast.JavaNode; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; -import net.sourceforge.pmd.lang.java.types.JArrayType; import net.sourceforge.pmd.lang.java.types.JTypeMirror; import net.sourceforge.pmd.lang.java.types.OverloadSelectionResult; -import net.sourceforge.pmd.lang.java.types.TypePrettyPrint; public class UnnecessaryVarargsArrayCreationRule extends AbstractJavaRulechainRule { @@ -26,6 +24,7 @@ public class UnnecessaryVarargsArrayCreationRule extends AbstractJavaRulechainRu @Override public Object visit(ASTArrayAllocation array, Object data) { + if (array.getArrayInitializer() == null)return null; JavaNode parent = array.getParent(); if (parent instanceof ASTArgumentList && array.getIndexInParent() == parent.getNumChildren() - 1) { @@ -39,19 +38,10 @@ public class UnnecessaryVarargsArrayCreationRule extends AbstractJavaRulechainRu List formals = info.getMethodType().getFormalParameters(); JTypeMirror lastFormal = formals.get(formals.size() - 1); - JTypeMirror expectedComponent = ((JArrayType) lastFormal).getComponentType(); - if (array.getTypeMirror().isSubtypeOf(expectedComponent) - && !array.getTypeMirror().equals(lastFormal)) { - // confusing - asCtx(data) - .addViolationWithMessage( - array, - "Unclear if a varargs or non-varargs call is intended. Cast to {0} or {0}[], or pass varargs parameters separately to clarify intent.", - TypePrettyPrint.prettyPrintWithSimpleNames(expectedComponent) - ); - } else if (array.getArrayInitializer() != null) { - // just regular unnecessary + if (array.getTypeMirror().equals(lastFormal)) { + // If type not equal, then it would not actually be equivalent to remove the array creation. + // That case may be caught by ConfusingArgumentToVarargsMethod asCtx(data).addViolation(array); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConfusingArgumentToVarargsMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConfusingArgumentToVarargsMethodRule.java new file mode 100644 index 0000000000..0bd64ef259 --- /dev/null +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/ConfusingArgumentToVarargsMethodRule.java @@ -0,0 +1,62 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.java.rule.errorprone; + +import java.util.List; + +import net.sourceforge.pmd.lang.java.ast.ASTArgumentList; +import net.sourceforge.pmd.lang.java.ast.ASTArrayAllocation; +import net.sourceforge.pmd.lang.java.ast.ASTExpression; +import net.sourceforge.pmd.lang.java.ast.InvocationNode; +import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; +import net.sourceforge.pmd.lang.java.types.JArrayType; +import net.sourceforge.pmd.lang.java.types.JTypeMirror; +import net.sourceforge.pmd.lang.java.types.OverloadSelectionResult; +import net.sourceforge.pmd.lang.java.types.TypePrettyPrint; + +public class ConfusingArgumentToVarargsMethodRule extends AbstractJavaRulechainRule { + + public ConfusingArgumentToVarargsMethodRule() { + super(ASTArgumentList.class); + } + + @Override + public Object visit(ASTArgumentList argList, Object data) { + if (argList.isEmpty()) { + return null; + } + + // node is the last param in an arguments list + InvocationNode call = (InvocationNode) argList.getParent(); + OverloadSelectionResult info = call.getOverloadSelectionInfo(); + if (info.isFailed() + || info.isVarargsCall() + || !info.getMethodType().isVarargs()) { + return null; + } + + List formals = info.getMethodType().getFormalParameters(); + JTypeMirror lastFormal = formals.get(formals.size() - 1); + JTypeMirror expectedComponent = ((JArrayType) lastFormal).getComponentType(); + + // since we know this is not a varargs call the last arg has an array type + ASTExpression varargsArg = argList.getLastChild(); + assert varargsArg != null; + if (varargsArg.getTypeMirror().isSubtypeOf(expectedComponent) + && !varargsArg.getTypeMirror().equals(lastFormal)) { + // confusing + + String message; + if (varargsArg instanceof ASTArrayAllocation && ((ASTArrayAllocation) varargsArg).getArrayInitializer() != null) { + message = "Unclear if a varargs or non-varargs call is intended. Cast to {0} or {0}[], or pass varargs parameters separately to clarify intent."; + } else { + message = "Unclear if a varargs or non-varargs call is intended. Cast to {0} or {0}[] to clarify intent."; + } + asCtx(data).addViolationWithMessage(varargsArg, message, TypePrettyPrint.prettyPrintWithSimpleNames(expectedComponent)); + } + + return null; + } +} diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 19beaf3d79..881f6b4995 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -1438,7 +1438,7 @@ class Foo{ @@ -1451,30 +1451,6 @@ class Foo{ ```java Arrays.asList("foo", "bar"); ``` - - This rule also reports such array creations when they are confusing, because the array is a subtype of the component type of the expected array type. - For instance if you have - ```java - void varargs(Object... parm); - ``` - and call it like so - ```java - varargs(new String[]{"a"}); - ``` - it is not clear whether you intended the method to receive the value `new Object[]{ new String[] {"a"} }` or just `new String[] {"a"}` (the latter happens). This confusion occurs because `String[]` is both a subtype of `Object[]` and of `Object`. To clarify your intent in this case, use a cast or pass individual elements like so: - ```java - // varargs call - // parm will be `new Object[] { "a" }` - varargs("a"); - - // non-varargs call - // parm will be `new String[] { "a" }` - varargs((Object[]) new String[]{"a"}); - - // varargs call - // parm will be `new Object[] { new String[] { "a" } }` - varargs((Object) new String[]{"a"}); - ``` 3 + + + Reports a confusing argument passed to a varargs method. + + This can occur when an array is passed as a single varargs argument, when the array type is not exactly the + type of array that the varargs method expects. If, that array is a subtype of the component type of the expected + array type, then it might not be clear what value the called varargs method will receive. + For instance if you have: + ```java + void varargs(Object... parm); + ``` + and call it like so: + ```java + varargs(new String[]{"a"}); + ``` + it is not clear whether you intended the method to receive the value `new Object[]{ new String[] {"a"} }` or + just `new String[] {"a"}` (the latter happens). This confusion occurs because `String[]` is both a subtype + of `Object[]` and of `Object`. To clarify your intent in this case, use a cast or pass individual elements like so: + ```java + // varargs call + // parm will be `new Object[] { "a" }` + varargs("a"); + + // non-varargs call + // parm will be `new String[] { "a" }` + varargs((Object[]) new String[]{"a"}); + + // varargs call + // parm will be `new Object[] { new String[] { "a" } }` + varargs((Object) new String[]{"a"}); + ``` + + Another confusing case is when you pass `null` as the varargs argument. Here it is not clear whether you intended + to pass an array with a single null element, or a null array (the latter happens). This can similarly be clarified + with a cast. + + 3 + + Confusing argument - 2 + 1 - Unnecessary explicit varargs array creation - Unclear if a varargs or non-varargs call is intended. Cast to Object or Object[], or pass varargs parameters separately to clarify intent. + Unnecessary explicit array creation for varargs method call + + + + Unnecessary in asList + 0 + + + + + Necessary array creation + 0 + + + + + + Confusing argument + 1 + + Unclear if a varargs or non-varargs call is intended. Cast to Object or Object[], or pass varargs parameters separately to clarify intent. + + + + + Confusing null argument + 1 + + Unclear if a varargs or non-varargs call is intended. Cast to Object or Object[] to clarify intent. + + + + + Confusing argument, not an array allocation + 1 + + Unclear if a varargs or non-varargs call is intended. Cast to Object or Object[] to clarify intent. + + + + + + + Array creation without elements + 0 + + + + From 789ec03dba4d3fa43ec364afb4d20f6b65997368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 21 Apr 2024 14:19:03 +0200 Subject: [PATCH 063/142] fix last violation --- .../bestpractices/UnnecessaryVarargsArrayCreationRule.java | 4 +++- .../sourceforge/pmd/lang/java/rule/design/NcssCountRule.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnnecessaryVarargsArrayCreationRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnnecessaryVarargsArrayCreationRule.java index 153ac864db..fbddc7e33f 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnnecessaryVarargsArrayCreationRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnnecessaryVarargsArrayCreationRule.java @@ -24,7 +24,9 @@ public class UnnecessaryVarargsArrayCreationRule extends AbstractJavaRulechainRu @Override public Object visit(ASTArrayAllocation array, Object data) { - if (array.getArrayInitializer() == null)return null; + if (array.getArrayInitializer() == null) { + return null; + } JavaNode parent = array.getParent(); if (parent instanceof ASTArgumentList && array.getIndexInParent() == parent.getNumChildren() - 1) { diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NcssCountRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NcssCountRule.java index 492d2474e4..94e134460b 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NcssCountRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/NcssCountRule.java @@ -101,7 +101,7 @@ public final class NcssCountRule extends AbstractJavaRulechainRule { node.getSimpleName(), classSize + " (Highest = " + classHighest + ")", }; - asCtx(data).addViolation(node, messageParams); + asCtx(data).addViolation(node, (Object[]) messageParams); } } } From 2f66305c9c4e9742cfa07ee11d1f0e7a2a3b24d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 21 Apr 2024 14:30:35 +0200 Subject: [PATCH 064/142] Small optimization --- .../pmd/lang/java/rule/internal/DataflowPass.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index 6e0925a46e..6624bc5323 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -791,6 +791,10 @@ public final class DataflowPass { *

Try statements are handled specially because of the finally. */ private SpanInfo processBreakableStmt(ASTStatement statement, SpanInfo input, Supplier processFun) { + if (!(statement.getParent() instanceof ASTLabeledStatement)) { + // happy path, no labels + return processFun.get(); + } GlobalAlgoState globalState = input.global; // this will be filled with the reaching defs of the break statements, then merged with the actual exit state SpanInfo placeholderForExitState = input.forkEmpty(); @@ -807,7 +811,6 @@ public final class DataflowPass { private static PSet accLabels(JavaNode statement, GlobalAlgoState globalState, SpanInfo breakTarget, @Nullable SpanInfo continueTarget) { Node parent = statement.getParent(); - // in most cases this will remain empty PSet labels = HashTreePSet.empty(); // collect labels and give a name to the exit state. while (parent instanceof ASTLabeledStatement) { From a92b61711e914651fc323c4be0c7ad452668248e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 21 Apr 2024 22:47:24 +0200 Subject: [PATCH 065/142] Update pmd-java/src/main/resources/category/java/errorprone.xml --- pmd-java/src/main/resources/category/java/errorprone.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/errorprone.xml b/pmd-java/src/main/resources/category/java/errorprone.xml index d25f87b81b..d4599e9f82 100644 --- a/pmd-java/src/main/resources/category/java/errorprone.xml +++ b/pmd-java/src/main/resources/category/java/errorprone.xml @@ -1108,7 +1108,7 @@ boolean x = (y == Double.NaN); since="7.1.0" message="Unclear if a varargs or non-varargs call is intended. Cast to {0} or {0}[], or pass varargs parameters separately to clarify intent." class="net.sourceforge.pmd.lang.java.rule.errorprone.ConfusingArgumentToVarargsMethodRule" - externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#confusingargumenttovarargsmethod"> + externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#confusingargumenttovarargsmethod"> Reports a confusing argument passed to a varargs method. From af97136018cf292bae091311846aa84353e66599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 23 Apr 2024 18:47:48 +0200 Subject: [PATCH 066/142] [java] Stop parsing Java for CPD Ref #4958 --- .../ast/SyntacticJavaTokenizerFactory.java | 39 ++----------------- .../pmd/lang/java/cpd/JavaCpdLexer.java | 3 +- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java index f97231e2ca..17284185c3 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java @@ -4,55 +4,24 @@ package net.sourceforge.pmd.lang.java.ast; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import net.sourceforge.pmd.lang.LanguageVersion; import net.sourceforge.pmd.lang.TokenManager; import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream; import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; -import net.sourceforge.pmd.lang.java.JavaLanguageModule; -import net.sourceforge.pmd.lang.java.internal.JavaLanguageProperties; /** * Creates a tokenizer, that uses the syntactic grammar to provide context * for the tokenizer when reducing the input characters to tokens. - *

This is required with JEP 430: String Templates

. * - * @see JEP 430: String Templates (Preview) + * @deprecated This implementation has been superseded. It is not necessary to parse Java code in order to tokenize it. */ +@Deprecated public final class SyntacticJavaTokenizerFactory { private SyntacticJavaTokenizerFactory() { // factory class } + @Deprecated public static TokenManager createTokenizer(CharStream cs) { - final List tokenList = new ArrayList<>(); - JavaParserImplTokenManager tokenManager = new JavaParserImplTokenManager(null, cs) { - @Override - public JavaccToken getNextToken() { - JavaccToken token = super.getNextToken(); - tokenList.add(token); - return token; - } - }; - - LanguageVersion latestVersion = JavaLanguageModule.getInstance().getLatestVersion(); - JavaParserImpl parser = new JavaParserImpl(tokenManager); - tokenManager.parser = parser; - parser.setJdkVersion(JavaLanguageProperties.getInternalJdkVersion(latestVersion)); - parser.setPreview(JavaLanguageProperties.isPreviewEnabled(latestVersion)); - - ASTCompilationUnit compilationUnit = parser.CompilationUnit(); - assert compilationUnit != null; - - return new TokenManager() { - Iterator iterator = tokenList.iterator(); - @Override - public JavaccToken getNextToken() { - return iterator.next(); - } - }; + return JavaTokenKinds.newTokenManager(cs); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/cpd/JavaCpdLexer.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/cpd/JavaCpdLexer.java index 1cf9ae4a5c..125777f963 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/cpd/JavaCpdLexer.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/cpd/JavaCpdLexer.java @@ -18,7 +18,6 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; import net.sourceforge.pmd.lang.document.TextDocument; import net.sourceforge.pmd.lang.java.ast.InternalApiBridge; import net.sourceforge.pmd.lang.java.ast.JavaTokenKinds; -import net.sourceforge.pmd.lang.java.ast.SyntacticJavaTokenizerFactory; import net.sourceforge.pmd.lang.java.internal.JavaLanguageProperties; /** @@ -44,7 +43,7 @@ public class JavaCpdLexer extends JavaccCpdLexer { @Override protected TokenManager makeLexerImpl(TextDocument doc) { - return SyntacticJavaTokenizerFactory.createTokenizer(CharStream.create(doc, InternalApiBridge.javaTokenDoc())); + return JavaTokenKinds.newTokenManager(CharStream.create(doc, InternalApiBridge.javaTokenDoc())); } @Override From c9b15f9c9be34c775494de4cd092e78f2a4e41ab Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 25 Apr 2024 08:49:26 +0200 Subject: [PATCH 067/142] Bump maven-pmd-plugin from 3.21.2 to 3.22.0 --- pom.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 59112d9496..e008f8a4fa 100644 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ 3.2.5 10.14.0 3.3.1 - 3.21.2 + 3.22.0 1.10.14 3.6.3 4.9.3 @@ -543,11 +543,6 @@ - - net.sourceforge.pmd - pmd-compat6 - 7.0.0 - net.sourceforge.pmd pmd-core From 6f0de09ceb960afc829966f2ae46488e89d29c3b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 25 Apr 2024 09:18:08 +0200 Subject: [PATCH 068/142] [doc] Update release notes (#4963, #4948) --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2857b638e9..1cb39aa014 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -62,6 +62,7 @@ This is a {{ site.pmd.release_type }} release. * [#2056](https://github.com/pmd/pmd/issues/2056): \[java] CloseResource false-positive with URLClassLoader in cast expression * [#4751](https://github.com/pmd/pmd/issues/4751): \[java] PMD crashes when analyzing CloseResource Rule * [#4928](https://github.com/pmd/pmd/issues/4928): \[java] EmptyCatchBlock false negative when allowCommentedBlocks=true + * [#4948](https://github.com/pmd/pmd/issues/4948): \[java] ImplicitSwitchFallThrough: False-positive with nested switch statements * java-performance * [#3845](https://github.com/pmd/pmd/issues/3845): \[java] InsufficientStringBufferDeclaration should consider literal expression * [#4874](https://github.com/pmd/pmd/issues/4874): \[java] StringInstantiation: False-positive when using `new String(charArray)` From a154f783bddf8f76ab9cd858eab0701c2e9ce1f8 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 25 Apr 2024 09:59:53 +0200 Subject: [PATCH 069/142] [doc] Update all-contributors Add @BurovnikovEvgeniy as a contributor Add @kohlschuetter as a contributor Add @Luro02 as a contributor Add @rs23 as a contributor Add @andygoossens as a contributor Add @mitchspano as a contributor Add @mfvanek as a contributor Add @VishV-Android as a contributor --- .all-contributorsrc | 72 +++++++ docs/pages/pmd/projectdocs/credits.md | 282 +++++++++++++------------- 2 files changed, 218 insertions(+), 136 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 4166d23161..924c39021e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -7462,6 +7462,78 @@ "contributions": [ "bug" ] + }, + { + "login": "BurovnikovEvgeniy", + "name": "BurovnikovEvgeniy", + "avatar_url": "https://avatars.githubusercontent.com/u/71849985?v=4", + "profile": "https://github.com/BurovnikovEvgeniy", + "contributions": [ + "bug" + ] + }, + { + "login": "kohlschuetter", + "name": "Dr. Christian Kohlschütter", + "avatar_url": "https://avatars.githubusercontent.com/u/822690?v=4", + "profile": "https://kohlschuetter.github.io/blog/", + "contributions": [ + "bug" + ] + }, + { + "login": "Luro02", + "name": "Lucas", + "avatar_url": "https://avatars.githubusercontent.com/u/24826124?v=4", + "profile": "https://github.com/Luro02", + "contributions": [ + "bug" + ] + }, + { + "login": "rs23", + "name": "Reinhard Schiedermeier", + "avatar_url": "https://avatars.githubusercontent.com/u/12321337?v=4", + "profile": "http://sol.cs.hm.edu/rs", + "contributions": [ + "bug" + ] + }, + { + "login": "andygoossens", + "name": "Andy Goossens", + "avatar_url": "https://avatars.githubusercontent.com/u/2099087?v=4", + "profile": "https://github.com/andygoossens", + "contributions": [ + "bug" + ] + }, + { + "login": "mitchspano", + "name": "Mitch Spano", + "avatar_url": "https://avatars.githubusercontent.com/u/18402464?v=4", + "profile": "https://github.com/mitchspano", + "contributions": [ + "bug" + ] + }, + { + "login": "mfvanek", + "name": "Ivan Vakhrushev", + "avatar_url": "https://avatars.githubusercontent.com/u/37612014?v=4", + "profile": "https://www.linkedin.com/in/mfvanek/", + "contributions": [ + "bug" + ] + }, + { + "login": "VishV-Android", + "name": "Vishv_Android", + "avatar_url": "https://avatars.githubusercontent.com/u/126696109?v=4", + "profile": "https://github.com/VishV-Android", + "contributions": [ + "bug" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 0e6b9270e0..9855a0bacd 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -81,558 +81,567 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Andro72
Andro72

🐛 Andrwyw
Andrwyw

🐛 Andrés Catalán
Andrés Catalán

🐛 + Andy Goossens
Andy Goossens

🐛 Andy Pattenden
Andy Pattenden

🐛 Andy Ray
Andy Ray

🐛 Andy Robinson
Andy Robinson

🐛 - Andy-2639
Andy-2639

🐛 + Andy-2639
Andy-2639

🐛 Ankush Somani
Ankush Somani

🐛 Anmol Kumar
Anmol Kumar

🐛 Anthony Whitford
Anthony Whitford

🐛 AnthonyKot
AnthonyKot

🐛 Aravind Hegde
Aravind Hegde

🐛 Arda Aslan
Arda Aslan

🐛 - Ari Fogel
Ari Fogel

🐛 + Ari Fogel
Ari Fogel

🐛 Arnaud Jeansen
Arnaud Jeansen

💻 🐛 Arpit Koolwal
Arpit Koolwal

🐛 Artem
Artem

💻 🐛 Artem
Artem

🐛 Artem Sheremet
Artem Sheremet

🐛 Artur
Artur

🐛 - Artur Bosch
Artur Bosch

🐛 + Artur Bosch
Artur Bosch

🐛 Artur Dryomov
Artur Dryomov

🐛 Artur Ossowski
Artur Ossowski

🐛 AshTheMash
AshTheMash

🐛 Ashish Rana
Ashish Rana

🐛 Atul Kaushal
Atul Kaushal

🐛 August Boland
August Boland

🐛 - Aurel Hudec
Aurel Hudec

🐛 + Aurel Hudec
Aurel Hudec

🐛 Austin
Austin

🐛 Austin Shalit
Austin Shalit

🐛 Austin Tice
Austin Tice

🐛 Ayoub Kaanich
Ayoub Kaanich

🐛 BBG
BBG

💻 📖 🐛 Bailey Tjiong
Bailey Tjiong

💻 - Barthélemy L.
Barthélemy L.

🐛 + Barthélemy L.
Barthélemy L.

🐛 Basavaraj K N
Basavaraj K N

🐛 Basil Peace
Basil Peace

🐛 Belle
Belle

🐛 Ben Lerner
Ben Lerner

🐛 Ben Manes
Ben Manes

🐛 Ben McCann
Ben McCann

🐛 - Bendegúz Nagy
Bendegúz Nagy

🐛 + Bendegúz Nagy
Bendegúz Nagy

🐛 Bennet S Yee
Bennet S Yee

🐛 Benoit Lacelle
Benoit Lacelle

🐛 Bernardo Macêdo
Bernardo Macêdo

🐛 Bernd Farka
Bernd Farka

🐛 Betina Cynthia Mamani
Betina Cynthia Mamani

🐛 Bhanu Prakash Pamidi
Bhanu Prakash Pamidi

💻 🐛 - Bhargav Thanki
Bhargav Thanki

🐛 + Bhargav Thanki
Bhargav Thanki

🐛 Binu R J
Binu R J

🐛 Björn Kautler
Björn Kautler

💻 🐛 Blightbuster
Blightbuster

🐛 Bo Zhang
Bo Zhang

🐛 Bob "Wombat" Hogg
Bob "Wombat" Hogg

🐛 Bobby Wertman
Bobby Wertman

🐛 - Bolarinwa Saheed Olayemi
Bolarinwa Saheed Olayemi

💻 🐛 + Bolarinwa Saheed Olayemi
Bolarinwa Saheed Olayemi

💻 🐛 Boris Petrov
Boris Petrov

🐛 Brad Kent
Brad Kent

🐛 Brandon Mikeska
Brandon Mikeska

🐛 Brian Batronis
Brian Batronis

🐛 Brian Johnson
Brian Johnson

🐛 Brice Dutheil
Brice Dutheil

💻 🐛 - Bruno Ferreira
Bruno Ferreira

🐛 + Bruno Ferreira
Bruno Ferreira

🐛 Bruno Harbulot
Bruno Harbulot

🐛 Bruno Ritz
Bruno Ritz

🐛 + BurovnikovEvgeniy
BurovnikovEvgeniy

🐛 Cameron Donaldson
Cameron Donaldson

🐛 Carlos Macasaet
Carlos Macasaet

🐛 Carsten Otto
Carsten Otto

🐛 - Charlie Housh
Charlie Housh

🐛 - Charlie Jonas
Charlie Jonas

🐛 + Charlie Housh
Charlie Housh

🐛 + Charlie Jonas
Charlie Jonas

🐛 Chas Honton
Chas Honton

🐛 Chen Yang
Chen Yang

🐛 Chotu
Chotu

🐛 Chris Smith
Chris Smith

🐛 Chris Toomey
Chris Toomey

🐛 - Christian Hujer
Christian Hujer

🐛 - Christian Pontesegger
Christian Pontesegger

🐛 + Christian Hujer
Christian Hujer

🐛 + Christian Pontesegger
Christian Pontesegger

🐛 ChristianWulf
ChristianWulf

🐛 Christofer Dutz
Christofer Dutz

💻 Christoffer Anselm
Christoffer Anselm

🐛 Christophe Vidal
Christophe Vidal

🐛 Christopher Dancy
Christopher Dancy

🐛 - Clemens Prill
Clemens Prill

🐛 - Clint Chester
Clint Chester

💻 🐛 + Clemens Prill
Clemens Prill

🐛 + Clint Chester
Clint Chester

💻 🐛 Clément Fournier
Clément Fournier

💻 📖 🐛 🚧 Codacy Badger
Codacy Badger

🐛 Code-Nil
Code-Nil

🐛 ColColonCleaner
ColColonCleaner

🐛 Colin Ingarfield
Colin Ingarfield

🐛 - Craig Andrews
Craig Andrews

🐛 - Craig Muchinsky
Craig Muchinsky

🐛 + Craig Andrews
Craig Andrews

🐛 + Craig Muchinsky
Craig Muchinsky

🐛 Cyril
Cyril

💻 🐛 Dale
Dale

💻 Damien Jiang
Damien Jiang

🐛 Dan Berindei
Dan Berindei

🐛 Dan Rollo
Dan Rollo

🐛 - Dan Ziemba
Dan Ziemba

🐛 - Daniel Gredler
Daniel Gredler

💻 🐛 + Dan Ziemba
Dan Ziemba

🐛 + Daniel Gredler
Daniel Gredler

💻 🐛 Daniel Jipa
Daniel Jipa

🐛 Daniel Paul Searles
Daniel Paul Searles

💻 Daniel Reigada
Daniel Reigada

🐛 Danilo Pianini
Danilo Pianini

🐛 Darko
Darko

🐛 - David
David

🐛 - David Atkinson
David Atkinson

🐛 + David
David

🐛 + David Atkinson
David Atkinson

🐛 David Burström
David Burström

💻 🐛 David Goaté
David Goaté

🐛 David Golpira
David Golpira

🐛 David Kovařík
David Kovařík

🐛 David M. Karr (fullname at gmail.com)
David M. Karr (fullname at gmail.com)

🐛 - David Renz
David Renz

💻 🐛 - David Renz
David Renz

🐛 + David Renz
David Renz

💻 🐛 + David Renz
David Renz

🐛 Dawid Ciok
Dawid Ciok

🐛 💻 Debamoy Datta
Debamoy Datta

💻 Deleted user
Deleted user

🐛 Dell Green
Dell Green

🐛 Dem Pilafian
Dem Pilafian

🐛 - Den
Den

🐛 - Denis Borovikov
Denis Borovikov

💻 🐛 + Den
Den

🐛 + Denis Borovikov
Denis Borovikov

💻 🐛 Dennie Reniers
Dennie Reniers

💻 🐛 Dennis Kieselhorst
Dennis Kieselhorst

🐛 Derek P. Moore
Derek P. Moore

🐛 Dichotomia
Dichotomia

🐛 Dionisio Cortés Fernández
Dionisio Cortés Fernández

💻 🐛 - Dmitri Bourlatchkov
Dmitri Bourlatchkov

🐛 - Dmitriy Kuzmin
Dmitriy Kuzmin

🐛 + Dmitri Bourlatchkov
Dmitri Bourlatchkov

🐛 + Dmitriy Kuzmin
Dmitriy Kuzmin

🐛 Dmytro Dashenkov
Dmytro Dashenkov

🐛 + Dr. Christian Kohlschütter
Dr. Christian Kohlschütter

🐛 Drew Hall
Drew Hall

🐛 Dumitru Postoronca
Dumitru Postoronca

🐛 Dylan Adams
Dylan Adams

🐛 + + Eden Hao
Eden Hao

🐛 Edward Klimoshenko
Edward Klimoshenko

🐛 💻 Egor Bredikhin
Egor Bredikhin

🐛 - - Elan P. Kugelmass
Elan P. Kugelmass

🐛 Elder S.
Elder S.

🐛 Eldrick Wega
Eldrick Wega

📖 Emile
Emile

🐛 + + Eric
Eric

🐛 Eric Kintzer
Eric Kintzer

🐛 Eric Perret
Eric Perret

🐛 - - Eric Squires
Eric Squires

🐛 Erich L Foster
Erich L Foster

🐛 Erik Bleske
Erik Bleske

🐛 Erik C. Thauvin
Erik C. Thauvin

📖 + + Ernst Reissner
Ernst Reissner

🐛 Ewan Tempero
Ewan Tempero

🐛 F.W. Dekker
F.W. Dekker

🐛 - - FSchliephacke
FSchliephacke

🐛 Facundo
Facundo

🐛 Federico Giust
Federico Giust

🐛 Fedor Sherstobitov
Fedor Sherstobitov

🐛 + + Felix Lampe
Felix Lampe

🐛 Filip Golonka
Filip Golonka

🐛 Filipe Esperandio
Filipe Esperandio

💻 🐛 - - Filippo Nova
Filippo Nova

🐛 Francesco la Torre
Francesco la Torre

🐛 Francisco Duarte
Francisco Duarte

🐛 Frieder Bluemle
Frieder Bluemle

🐛 + + Frits Jalvingh
Frits Jalvingh

💻 🐛 G. Bazior
G. Bazior

🐛 Gabe Henkes
Gabe Henkes

🐛 - - Gary Gregory
Gary Gregory

🐛 Genoud Magloire
Genoud Magloire

🐛 Geoffrey555
Geoffrey555

🐛 Georg Romstorfer
Georg Romstorfer

🐛 + + Gio
Gio

🐛 Gol
Gol

🐛 Gonzalo Exequiel Ibars Ingman
Gonzalo Exequiel Ibars Ingman

💻 🐛 - - GooDer
GooDer

🐛 Gregor Riegler
Gregor Riegler

🐛 Grzegorz Olszewski
Grzegorz Olszewski

🐛 Gunther Schrijvers
Gunther Schrijvers

💻 🐛 + + Gustavo Krieger
Gustavo Krieger

🐛 Guy Elsmore-Paddock
Guy Elsmore-Paddock

🐛 Görkem Mülayim
Görkem Mülayim

🐛 - - Hanzel Godinez
Hanzel Godinez

🐛 Haoliang Chen
Haoliang Chen

🐛 Harsh Kukreja
Harsh Kukreja

🐛 Hassan ALAMI
Hassan ALAMI

🐛 + + Heber
Heber

🐛 Henning Schmiedehausen
Henning Schmiedehausen

💻 🐛 Henning von Bargen
Henning von Bargen

💻 - - Hervé Boutemy
Hervé Boutemy

🐛 Himanshu Pandey
Himanshu Pandey

🐛 Hokwang Lee
Hokwang Lee

🐛 Hooperbloob
Hooperbloob

💻 + + Hung PHAN
Hung PHAN

🐛 IDoCodingStuffs
IDoCodingStuffs

💻 🐛 Iccen Gan
Iccen Gan

🐛 - - Ignacio Mariano Tirabasso
Ignacio Mariano Tirabasso

🐛 Igor Melnichenko
Igor Melnichenko

🐛 Igor Moreno
Igor Moreno

🐛 Intelesis-MS
Intelesis-MS

🐛 - Iroha_
Iroha_

🐛 - Ishan Srivastava
Ishan Srivastava

🐛 - Ivano Guerini
Ivano Guerini

🐛 + Iroha_
Iroha_

🐛 + Ishan Srivastava
Ishan Srivastava

🐛 + Ivan Vakhrushev
Ivan Vakhrushev

🐛 + Ivano Guerini
Ivano Guerini

🐛 Ivar Andreas Bonsaksen
Ivar Andreas Bonsaksen

🐛 Ivo Šmíd
Ivo Šmíd

🐛 JJengility
JJengility

🐛 + + Jake Hemmerle
Jake Hemmerle

🐛 James Harrison
James Harrison

🐛 💻 Jan
Jan

🐛 Jan Aertgeerts
Jan Aertgeerts

💻 🐛 - - Jan Brümmer
Jan Brümmer

🐛 Jan Tříska
Jan Tříska

🐛 Jan-Lukas Else
Jan-Lukas Else

🐛 + + Jason Qiu
Jason Qiu

💻 📖 Jason Williams
Jason Williams

🐛 Jean-Paul Mayer
Jean-Paul Mayer

🐛 Jean-Simon Larochelle
Jean-Simon Larochelle

🐛 - - Jeff Bartolotta
Jeff Bartolotta

💻 🐛 Jeff Hube
Jeff Hube

💻 🐛 Jeff Jensen
Jeff Jensen

🐛 + + Jeff May
Jeff May

🐛 Jens Gerdes
Jens Gerdes

🐛 Jeroen Borgers
Jeroen Borgers

🐛 💻 📢 Jeroen van Wilgenburg
Jeroen van Wilgenburg

📖 - - Jerome Russ
Jerome Russ

🐛 JerritEic
JerritEic

💻 📖 🐛 Jiri Pejchal
Jiri Pejchal

🐛 + + Jithin Sunny
Jithin Sunny

🐛 Jiří Škorpil
Jiří Škorpil

🐛 Joao Machado
Joao Machado

🐛 Jochen Krauss
Jochen Krauss

🐛 - - Johan Hammar
Johan Hammar

🐛 John Karp
John Karp

🐛 John Zhang
John Zhang

🐛 + + John-Teng
John-Teng

💻 🐛 Jon Moroney
Jon Moroney

💻 🐛 Jonas Geiregat
Jonas Geiregat

🐛 Jonathan Wiesel
Jonathan Wiesel

💻 🐛 - - Jordan
Jordan

🐛 Jordi Llach
Jordi Llach

🐛 Jorge Solórzano
Jorge Solórzano

🐛 + + JorneVL
JorneVL

🐛 Jose Palafox
Jose Palafox

🐛 Jose Stovall
Jose Stovall

🐛 Joseph
Joseph

💻 - - Joseph Heenan
Joseph Heenan

🐛 Josh Feingold
Josh Feingold

💻 🐛 Josh Holthaus
Josh Holthaus

🐛 + + Joshua S Arquilevich
Joshua S Arquilevich

🐛 João Dinis Ferreira
João Dinis Ferreira

📖 João Ferreira
João Ferreira

💻 🐛 João Pedro Schmitt
João Pedro Schmitt

🐛 - - Juan Martín Sotuyo Dodero
Juan Martín Sotuyo Dodero

💻 📖 🐛 🚧 Juan Pablo Civile
Juan Pablo Civile

🐛 Julian Voronetsky
Julian Voronetsky

🐛 + + Julien
Julien

🐛 Julius
Julius

🐛 JustPRV
JustPRV

🐛 Jörn Huxhorn
Jörn Huxhorn

🐛 - - KThompso
KThompso

🐛 Kai Amundsen
Kai Amundsen

🐛 Karel Vervaeke
Karel Vervaeke

🐛 + + Karl-Andero Mere
Karl-Andero Mere

🐛 Karl-Philipp Richter
Karl-Philipp Richter

🐛 Karsten Silz
Karsten Silz

🐛 Kazuma Watanabe
Kazuma Watanabe

🐛 - - Kev
Kev

🐛 Keve Müller
Keve Müller

🐛 Kevin Guerra
Kevin Guerra

💻 + + Kevin Jones
Kevin Jones

🐛 💻 Kevin Wayne
Kevin Wayne

🐛 Kieran Black
Kieran Black

🐛 Kirill Zubov
Kirill Zubov

🐛 - - Kirk Clemens
Kirk Clemens

💻 🐛 Klaus Hartl
Klaus Hartl

🐛 Koen Van Looveren
Koen Van Looveren

🐛 + + Kris Scheibe
Kris Scheibe

💻 🐛 Krystian Dabrowski
Krystian Dabrowski

🐛 💻 Kunal Thanki
Kunal Thanki

🐛 LaLucid
LaLucid

💻 - - Larry Diamond
Larry Diamond

💻 🐛 Lars Knickrehm
Lars Knickrehm

🐛 Laurent Bovet
Laurent Bovet

🐛 💻 + + Leo Gutierrez
Leo Gutierrez

🐛 LiGaOg
LiGaOg

💻 Liam Sharp
Liam Sharp

🐛 Lintsi
Lintsi

🐛 - - Linus Fernandes
Linus Fernandes

🐛 Lixon Lookose
Lixon Lookose

🐛 Logesh
Logesh

🐛 - Lorenzo Gabriele
Lorenzo Gabriele

🐛 - Loïc Ledoyen
Loïc Ledoyen

🐛 - Lucas Silva
Lucas Silva

🐛 - Lucas Soncini
Lucas Soncini

💻 🐛 + Lorenzo Gabriele
Lorenzo Gabriele

🐛 + Loïc Ledoyen
Loïc Ledoyen

🐛 + Lucas
Lucas

🐛 + Lucas Silva
Lucas Silva

🐛 + Lucas Soncini
Lucas Soncini

💻 🐛 Luis Alcantar
Luis Alcantar

💻 Lukasz Slonina
Lukasz Slonina

🐛 + + Lukebray
Lukebray

🐛 Lynn
Lynn

💻 🐛 Lyor Goldstein
Lyor Goldstein

🐛 MCMicS
MCMicS

🐛 Macarse
Macarse

🐛 - - Machine account for PMD
Machine account for PMD

💻 Maciek Siemczyk
Maciek Siemczyk

🐛 + + Maikel Steneker
Maikel Steneker

💻 🐛 Maksim Moiseikin
Maksim Moiseikin

🐛 Manfred Koch
Manfred Koch

🐛 Manuel Moya Ferrer
Manuel Moya Ferrer

💻 🐛 Manuel Ryan
Manuel Ryan

🐛 - - Marat Vyshegorodtsev
Marat Vyshegorodtsev

🐛 Marcel Härle
Marcel Härle

🐛 + + Marcello Fialho
Marcello Fialho

🐛 Marcin Dąbrowski
Marcin Dąbrowski

💻 Marcin Rataj
Marcin Rataj

🐛 Marcono1234
Marcono1234

🐛 Mark Adamcin
Mark Adamcin

🐛 - - Mark Hall
Mark Hall

💻 🐛 Mark Kolich
Mark Kolich

🐛 + + Mark Pritchard
Mark Pritchard

🐛 Markus Rathgeb
Markus Rathgeb

🐛 Marquis Wang
Marquis Wang

🐛 MartGit
MartGit

🐛 Martin Feldsztejn
Martin Feldsztejn

🐛 - - Martin Lehmann
Martin Lehmann

🐛 Martin Spamer
Martin Spamer

🐛 + + Martin Tarjányi
Martin Tarjányi

🐛 MatFl
MatFl

🐛 Mateusz Stefanski
Mateusz Stefanski

🐛 Mathieu Gouin
Mathieu Gouin

🐛 MatiasComercio
MatiasComercio

💻 🐛 - - Matt Benson
Matt Benson

🐛 Matt De Poorter
Matt De Poorter

🐛 + + Matt Hargett
Matt Hargett

💻 💵 Matt Harrah
Matt Harrah

🐛 Matt Nelson
Matt Nelson

🐛 Matthew Amos
Matthew Amos

🐛 Matthew Duggan
Matthew Duggan

🐛 - - Matthew Hall
Matthew Hall

🐛 Matías Fraga
Matías Fraga

💻 🐛 + + Maxime Robert
Maxime Robert

💻 🐛 MetaBF
MetaBF

🐛 Michael
Michael

🐛 Michael Bell
Michael Bell

🐛 Michael Bernstein
Michael Bernstein

🐛 - - Michael Clay
Michael Clay

🐛 Michael Dombrowski
Michael Dombrowski

🐛 + + Michael Hausegger
Michael Hausegger

🐛 Michael Hoefer
Michael Hoefer

🐛 Michael Kolesnikov
Michael Kolesnikov

🐛 Michael Möbius
Michael Möbius

🐛 Michael N. Lipp
Michael N. Lipp

🐛 - - Michael Pellegrini
Michael Pellegrini

🐛 Michal Kordas
Michal Kordas

🐛 + + Michał Borek
Michał Borek

🐛 Michał Kuliński
Michał Kuliński

🐛 Miguel Núñez Díaz-Montes
Miguel Núñez Díaz-Montes

🐛 Mihai Ionut
Mihai Ionut

🐛 Mikhail Kuchma
Mikhail Kuchma

🐛 + Mirek Hankus
Mirek Hankus

🐛 + Mitch Spano
Mitch Spano

🐛 - Mirek Hankus
Mirek Hankus

🐛 Mladjan Gadzic
Mladjan Gadzic

🐛 MrAngry52
MrAngry52

🐛 Muminur Choudhury
Muminur Choudhury

🐛 Mykhailo Palahuta
Mykhailo Palahuta

💻 🐛 Nagendra Kumar Singh
Nagendra Kumar Singh

🐛 Nahuel Barrios
Nahuel Barrios

🐛 + Nakul Sharma
Nakul Sharma

🐛 - Nakul Sharma
Nakul Sharma

🐛 Nathan Braun
Nathan Braun

🐛 Nathan Reynolds
Nathan Reynolds

🐛 Nathan Reynolds
Nathan Reynolds

🐛 Nathanaël
Nathanaël

🐛 Naveen
Naveen

💻 Nazdravi
Nazdravi

🐛 + Neha-Dhonde
Neha-Dhonde

🐛 - Neha-Dhonde
Neha-Dhonde

🐛 Nicholas Doyle
Nicholas Doyle

🐛 Nick Butcher
Nick Butcher

🐛 Nico Gallinal
Nico Gallinal

🐛 Nicola Dal Maso
Nicola Dal Maso

🐛 Nicolas Filotto
Nicolas Filotto

💻 Nicolas Vervelle
Nicolas Vervelle

🐛 + Nicolas Vuillamy
Nicolas Vuillamy

📖 - Nicolas Vuillamy
Nicolas Vuillamy

📖 Nikita Chursin
Nikita Chursin

🐛 Niklas Baudy
Niklas Baudy

🐛 Nikolas Havrikov
Nikolas Havrikov

🐛 Nilesh Virkar
Nilesh Virkar

🐛 Nimit Patel
Nimit Patel

🐛 Niranjan Harpale
Niranjan Harpale

🐛 + Nirvik Patel
Nirvik Patel

💻 - Nirvik Patel
Nirvik Patel

💻 Noah Sussman
Noah Sussman

🐛 Noah0120
Noah0120

🐛 Noam Tamim
Noam Tamim

🐛 Noel Grandin
Noel Grandin

🐛 Olaf Haalstra
Olaf Haalstra

🐛 Oleg Andreych
Oleg Andreych

💻 🐛 + Oleg Pavlenko
Oleg Pavlenko

🐛 - Oleg Pavlenko
Oleg Pavlenko

🐛 Oleksii Dykov
Oleksii Dykov

💻 🐛 Oliver Eikemeier
Oliver Eikemeier

🐛 Oliver Siegmar
Oliver Siegmar

💵 Olivier Parent
Olivier Parent

💻 🐛 Ollie Abbey
Ollie Abbey

💻 🐛 OverDrone
OverDrone

🐛 + Ozan Gulle
Ozan Gulle

💻 🐛 - Ozan Gulle
Ozan Gulle

💻 🐛 PUNEET JAIN
PUNEET JAIN

🐛 Parbati Bose
Parbati Bose

🐛 Paul Berg
Paul Berg

🐛 Paul Guyot
Paul Guyot

💻 Pavel Bludov
Pavel Bludov

🐛 Pavel Mička
Pavel Mička

🐛 + Pedro Nuno Santos
Pedro Nuno Santos

🐛 - Pedro Nuno Santos
Pedro Nuno Santos

🐛 Pedro Rijo
Pedro Rijo

🐛 Pelisse Romain
Pelisse Romain

💻 📖 🐛 Per Abich
Per Abich

💻 Pete Davids
Pete Davids

🐛 Peter Bruin
Peter Bruin

🐛 Peter Chittum
Peter Chittum

💻 🐛 + Peter Cudmore
Peter Cudmore

🐛 - Peter Cudmore
Peter Cudmore

🐛 Peter Kasson
Peter Kasson

🐛 Peter Kofler
Peter Kofler

🐛 Peter Paul Bakker
Peter Paul Bakker

💻 Peter Rader
Peter Rader

🐛 Pham Hai Trung
Pham Hai Trung

🐛 Philip Graf
Philip Graf

💻 🐛 + Philip Hachey
Philip Hachey

🐛 - Philip Hachey
Philip Hachey

🐛 Philippe Ozil
Philippe Ozil

🐛 Phinehas Artemix
Phinehas Artemix

🐛 Phokham Nonava
Phokham Nonava

🐛 Pim van der Loos
Pim van der Loos

💻 ⚠️ Piotr Szymański
Piotr Szymański

🐛 Piotrek Żygieło
Piotrek Żygieło

💻 🐛 📖 + Pranay Jaiswal
Pranay Jaiswal

🐛 - Pranay Jaiswal
Pranay Jaiswal

🐛 Prasad Kamath
Prasad Kamath

🐛 Prasanna
Prasanna

🐛 Presh-AR
Presh-AR

🐛 Puneet1726
Puneet1726

🐛 Rafael Cortês
Rafael Cortês

🐛 RaheemShaik999
RaheemShaik999

🐛 + RajeshR
RajeshR

💻 🐛 - RajeshR
RajeshR

💻 🐛 Ramachandra Mohan
Ramachandra Mohan

🐛 Ramel0921
Ramel0921

🐛 Raquel Pau
Raquel Pau

🐛 Ravikiran Janardhana
Ravikiran Janardhana

🐛 Reda Benhemmouche
Reda Benhemmouche

🐛 + Reinhard Schiedermeier
Reinhard Schiedermeier

🐛 Renato Oliveira
Renato Oliveira

💻 🐛 @@ -776,289 +785,290 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Vincent Maurin
Vincent Maurin

🐛 Vincent Privat
Vincent Privat

🐛 Vishhwas
Vishhwas

🐛 + Vishv_Android
Vishv_Android

🐛 Vitaly
Vitaly

🐛 - Vitaly Polonetsky
Vitaly Polonetsky

🐛 + Vitaly Polonetsky
Vitaly Polonetsky

🐛 Vojtech Polivka
Vojtech Polivka

🐛 Vsevolod Zholobov
Vsevolod Zholobov

🐛 Vyom Yadav
Vyom Yadav

💻 Wang Shidong
Wang Shidong

🐛 Waqas Ahmed
Waqas Ahmed

🐛 Wayne J. Earl
Wayne J. Earl

🐛 - Wchenghui
Wchenghui

🐛 + Wchenghui
Wchenghui

🐛 Wener
Wener

💻 Will Winder
Will Winder

🐛 William Brockhus
William Brockhus

💻 🐛 Wilson Kurniawan
Wilson Kurniawan

🐛 Wim Deblauwe
Wim Deblauwe

🐛 Woongsik Choi
Woongsik Choi

🐛 - XenoAmess
XenoAmess

💻 🐛 + XenoAmess
XenoAmess

💻 🐛 Yang
Yang

💻 YaroslavTER
YaroslavTER

🐛 Yasar Shaikh
Yasar Shaikh

💻 Young Chan
Young Chan

💻 🐛 YuJin Kim
YuJin Kim

🐛 Yuri Dolzhenko
Yuri Dolzhenko

🐛 - Yurii Dubinka
Yurii Dubinka

🐛 + Yurii Dubinka
Yurii Dubinka

🐛 Zoltan Farkas
Zoltan Farkas

🐛 Zustin
Zustin

🐛 aaronhurst-google
aaronhurst-google

🐛 💻 alexmodis
alexmodis

🐛 andreoss
andreoss

🐛 andrey81inmd
andrey81inmd

💻 🐛 - anicoara
anicoara

🐛 + anicoara
anicoara

🐛 arunprasathav
arunprasathav

🐛 asiercamara
asiercamara

🐛 astillich-igniti
astillich-igniti

💻 avesolovksyy
avesolovksyy

🐛 avishvat
avishvat

🐛 avivmu
avivmu

🐛 - axelbarfod1
axelbarfod1

🐛 + axelbarfod1
axelbarfod1

🐛 b-3-n
b-3-n

🐛 balbhadra9
balbhadra9

🐛 base23de
base23de

🐛 bergander
bergander

🐛 💻 berkam
berkam

💻 🐛 breizh31
breizh31

🐛 - caesarkim
caesarkim

🐛 + caesarkim
caesarkim

🐛 carolyujing
carolyujing

🐛 cbfiddle
cbfiddle

🐛 cesares-basilico
cesares-basilico

🐛 chrite
chrite

🐛 ciufudean
ciufudean

📖 cobratbq
cobratbq

🐛 - coladict
coladict

🐛 + coladict
coladict

🐛 cosmoJFH
cosmoJFH

🐛 cristalp
cristalp

🐛 crunsk
crunsk

🐛 cwholmes
cwholmes

🐛 cyberjj999
cyberjj999

🐛 cyw3
cyw3

🐛 📖 - d1ss0nanz
d1ss0nanz

🐛 + d1ss0nanz
d1ss0nanz

🐛 dague1
dague1

📖 dalizi007
dalizi007

💻 danbrycefairsailcom
danbrycefairsailcom

🐛 dariansanity
dariansanity

🐛 darrenmiliband
darrenmiliband

🐛 davidburstrom
davidburstrom

🐛 - dbirkman-paloalto
dbirkman-paloalto

🐛 + dbirkman-paloalto
dbirkman-paloalto

🐛 deepak-patra
deepak-patra

🐛 dependabot[bot]
dependabot[bot]

💻 🐛 dinesh150
dinesh150

🐛 diziaq
diziaq

🐛 dreaminpast123
dreaminpast123

🐛 duanyanan
duanyanan

🐛 - dutt-sanjay
dutt-sanjay

🐛 + dutt-sanjay
dutt-sanjay

🐛 dylanleung
dylanleung

🐛 dzeigler
dzeigler

🐛 eant60
eant60

🐛 ekkirala
ekkirala

🐛 emersonmoura
emersonmoura

🐛 emouty
emouty

💻 - eugenepugach
eugenepugach

🐛 + eugenepugach
eugenepugach

🐛 fairy
fairy

🐛 filiprafalowicz
filiprafalowicz

💻 flxbl-io
flxbl-io

💵 foxmason
foxmason

🐛 frankegabor
frankegabor

🐛 frankl
frankl

🐛 - freafrea
freafrea

🐛 + freafrea
freafrea

🐛 fsapatin
fsapatin

🐛 gracia19
gracia19

🐛 guo fei
guo fei

🐛 gurmsc5
gurmsc5

🐛 gwilymatgearset
gwilymatgearset

💻 🐛 haigsn
haigsn

🐛 - hemanshu070
hemanshu070

🐛 + hemanshu070
hemanshu070

🐛 henrik242
henrik242

🐛 hongpuwu
hongpuwu

🐛 hvbtup
hvbtup

💻 🐛 igniti GmbH
igniti GmbH

🐛 ilovezfs
ilovezfs

🐛 itaigilo
itaigilo

🐛 - jakivey32
jakivey32

🐛 + jakivey32
jakivey32

🐛 jbennett2091
jbennett2091

🐛 jcamerin
jcamerin

🐛 jkeener1
jkeener1

🐛 jmetertea
jmetertea

🐛 johnra2
johnra2

💻 josemanuelrolon
josemanuelrolon

💻 🐛 - kabroxiko
kabroxiko

💻 🐛 + kabroxiko
kabroxiko

💻 🐛 karwer
karwer

🐛 kaulonline
kaulonline

🐛 kdaemonv
kdaemonv

🐛 kdebski85
kdebski85

🐛 💻 kenji21
kenji21

💻 🐛 kfranic
kfranic

🐛 - khalidkh
khalidkh

🐛 + khalidkh
khalidkh

🐛 koalalam
koalalam

🐛 krzyk
krzyk

🐛 lasselindqvist
lasselindqvist

🐛 lgemeinhardt
lgemeinhardt

🐛 lihuaib
lihuaib

🐛 liqingjun123
liqingjun123

🐛 - lonelyma1021
lonelyma1021

🐛 + lonelyma1021
lonelyma1021

🐛 lpeddy
lpeddy

🐛 lujiefsi
lujiefsi

💻 lukelukes
lukelukes

💻 lyriccoder
lyriccoder

🐛 marcelmore
marcelmore

🐛 matchbox
matchbox

🐛 - matthiaskraaz
matthiaskraaz

🐛 + matthiaskraaz
matthiaskraaz

🐛 meandonlyme
meandonlyme

🐛 mikesive
mikesive

🐛 milossesic
milossesic

🐛 mluckam
mluckam

💻 mohan-chinnappan-n
mohan-chinnappan-n

💻 mriddell95
mriddell95

🐛 - mrlzh
mrlzh

🐛 + mrlzh
mrlzh

🐛 msloan
msloan

🐛 mucharlaravalika
mucharlaravalika

🐛 mvenneman
mvenneman

🐛 nareshl119
nareshl119

🐛 nicolas-harraudeau-sonarsource
nicolas-harraudeau-sonarsource

🐛 noerremark
noerremark

🐛 - novsirion
novsirion

🐛 + novsirion
novsirion

🐛 nwcm
nwcm

📖 🐛 💻 oggboy
oggboy

🐛 oinume
oinume

🐛 orimarko
orimarko

💻 🐛 pacvz
pacvz

💻 pallavi agarwal
pallavi agarwal

🐛 - parksungrin
parksungrin

🐛 + parksungrin
parksungrin

🐛 patpatpat123
patpatpat123

🐛 patriksevallius
patriksevallius

🐛 pbrajesh1
pbrajesh1

🐛 phoenix384
phoenix384

🐛 piotrszymanski-sc
piotrszymanski-sc

💻 plan3d
plan3d

🐛 - poojasix
poojasix

🐛 + poojasix
poojasix

🐛 prabhushrikant
prabhushrikant

🐛 pujitha8783
pujitha8783

🐛 r-r-a-j
r-r-a-j

🐛 raghujayjunk
raghujayjunk

🐛 rajeshveera
rajeshveera

🐛 rajeswarreddy88
rajeswarreddy88

🐛 - recdevs
recdevs

🐛 + recdevs
recdevs

🐛 reudismam
reudismam

💻 🐛 rijkt
rijkt

🐛 rillig-tk
rillig-tk

🐛 rmohan20
rmohan20

💻 🐛 rnveach
rnveach

🐛 rxmicro
rxmicro

🐛 - ryan-gustafson
ryan-gustafson

💻 🐛 + ryan-gustafson
ryan-gustafson

💻 🐛 sabi0
sabi0

🐛 scais
scais

🐛 screamingfrog
screamingfrog

💵 sebbASF
sebbASF

🐛 sergeygorbaty
sergeygorbaty

💻 shilko2013
shilko2013

🐛 - shiomiyan
shiomiyan

📖 + shiomiyan
shiomiyan

📖 simeonKondr
simeonKondr

🐛 snajberk
snajberk

🐛 sniperrifle2004
sniperrifle2004

🐛 snuyanzin
snuyanzin

🐛 💻 soyodream
soyodream

🐛 sratz
sratz

🐛 - stonio
stonio

🐛 + stonio
stonio

🐛 sturton
sturton

💻 🐛 sudharmohan
sudharmohan

🐛 suruchidawar
suruchidawar

🐛 svenfinitiv
svenfinitiv

🐛 tashiscool
tashiscool

🐛 test-git-hook
test-git-hook

🐛 - testation21
testation21

💻 🐛 + testation21
testation21

💻 🐛 thanosa
thanosa

🐛 tiandiyixian
tiandiyixian

🐛 tobwoerk
tobwoerk

🐛 tprouvot
tprouvot

🐛 💻 trentchilders
trentchilders

🐛 triandicAnt
triandicAnt

🐛 - trishul14
trishul14

🐛 + trishul14
trishul14

🐛 tsui
tsui

🐛 wangzitom12306
wangzitom12306

🐛 winhkey
winhkey

🐛 witherspore
witherspore

🐛 wjljack
wjljack

🐛 wuchiuwong
wuchiuwong

🐛 - xingsong
xingsong

🐛 + xingsong
xingsong

🐛 xioayuge
xioayuge

🐛 xnYi9wRezm
xnYi9wRezm

💻 🐛 xuanuy
xuanuy

🐛 xyf0921
xyf0921

🐛 yalechen-cyw3
yalechen-cyw3

🐛 yasuharu-sato
yasuharu-sato

🐛 - zenglian
zenglian

🐛 + zenglian
zenglian

🐛 zgrzyt93
zgrzyt93

💻 🐛 zh3ng
zh3ng

🐛 zt_soft
zt_soft

🐛 ztt79
ztt79

🐛 zzzzfeng
zzzzfeng

🐛 Árpád Magosányi
Árpád Magosányi

🐛 - 任贵杰
任贵杰

🐛 + 任贵杰
任贵杰

🐛 茅延安
茅延安

💻 From 102ba1e9625400912548e3ab3a19c765bb2d6727 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 25 Apr 2024 10:28:18 +0200 Subject: [PATCH 070/142] [ci] Disable auto-gen-config for regression tests --- Dangerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dangerfile b/Dangerfile index 0e35809f22..7c44a32730 100644 --- a/Dangerfile +++ b/Dangerfile @@ -28,7 +28,7 @@ def run_pmdtester @base_branch = ENV['PMD_CI_BRANCH'] @logger.info "\n\n--------------------------------------" @logger.info "Run against PR base #{@base_branch}" - @summary = PmdTester::Runner.new(get_args(@base_branch)).run + @summary = PmdTester::Runner.new(get_args(@base_branch, FALSE)).run unless Dir.exist?('target/reports/diff') message("No regression tested rules have been changed.", sticky: true) From f5d47ac36e7975919bfafdd0c386f81da2038591 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 25 Apr 2024 11:00:01 +0200 Subject: [PATCH 071/142] [ci] Disable auto-gen-config for regression tests --- Dangerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dangerfile b/Dangerfile index 7c44a32730..7c75a6e426 100644 --- a/Dangerfile +++ b/Dangerfile @@ -28,7 +28,7 @@ def run_pmdtester @base_branch = ENV['PMD_CI_BRANCH'] @logger.info "\n\n--------------------------------------" @logger.info "Run against PR base #{@base_branch}" - @summary = PmdTester::Runner.new(get_args(@base_branch, FALSE)).run + @summary = PmdTester::Runner.new(get_args(@base_branch, false)).run unless Dir.exist?('target/reports/diff') message("No regression tested rules have been changed.", sticky: true) From 04206ecd80dca03495c85c196365579c299732af Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 25 Apr 2024 11:38:02 +0200 Subject: [PATCH 072/142] Revert "[ci] Disable auto-gen-config for regression tests" This reverts commit f5d47ac36e7975919bfafdd0c386f81da2038591. This reverts commit 102ba1e9625400912548e3ab3a19c765bb2d6727. --- Dangerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dangerfile b/Dangerfile index 7c75a6e426..0e35809f22 100644 --- a/Dangerfile +++ b/Dangerfile @@ -28,7 +28,7 @@ def run_pmdtester @base_branch = ENV['PMD_CI_BRANCH'] @logger.info "\n\n--------------------------------------" @logger.info "Run against PR base #{@base_branch}" - @summary = PmdTester::Runner.new(get_args(@base_branch, false)).run + @summary = PmdTester::Runner.new(get_args(@base_branch)).run unless Dir.exist?('target/reports/diff') message("No regression tested rules have been changed.", sticky: true) From 31585acc6f5f8aa396d3f1365df348da8e3ca076 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 25 Apr 2024 11:47:20 +0200 Subject: [PATCH 073/142] Bump build-tools from 24-SNAPSHOT to 24 --- .github/workflows/build.yml | 2 +- .github/workflows/git-repo-sync.yml | 2 +- .github/workflows/troubleshooting.yml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9ccf28a9a3..acbecfa5cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: run: | echo "LANG=en_US.UTF-8" >> $GITHUB_ENV echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV - echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV + echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/24/scripts" >> $GITHUB_ENV - name: Check Environment shell: bash run: | diff --git a/.github/workflows/git-repo-sync.yml b/.github/workflows/git-repo-sync.yml index c564eeea92..d0327c4e2b 100644 --- a/.github/workflows/git-repo-sync.yml +++ b/.github/workflows/git-repo-sync.yml @@ -24,7 +24,7 @@ jobs: shell: bash run: | echo "LANG=en_US.UTF-8" >> $GITHUB_ENV - echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV + echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/24/scripts" >> $GITHUB_ENV - name: Sync run: .ci/git-repo-sync.sh shell: bash diff --git a/.github/workflows/troubleshooting.yml b/.github/workflows/troubleshooting.yml index 58b1c56fcc..010e2a0fc4 100644 --- a/.github/workflows/troubleshooting.yml +++ b/.github/workflows/troubleshooting.yml @@ -36,7 +36,7 @@ jobs: run: | echo "LANG=en_US.UTF-8" >> $GITHUB_ENV echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV - echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV + echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/24/scripts" >> $GITHUB_ENV - name: Check Environment shell: bash run: | diff --git a/pom.xml b/pom.xml index e008f8a4fa..846b3623ae 100644 --- a/pom.xml +++ b/pom.xml @@ -113,7 +113,7 @@ -Xmx512m -Dfile.encoding=${project.build.sourceEncoding} ${extraArgLine} - 24-SNAPSHOT + 24 7.0.0 ${settings.localRepository}/net/java/dev/javacc/javacc/${javacc.version}/javacc-${javacc.version}.jar From 7d0dfa0b13e96dbbe678b067853631429c61f02e Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 08:14:38 +0200 Subject: [PATCH 074/142] Prepare pmd release 7.1.0 --- docs/_config.yml | 2 +- docs/pages/release_notes.md | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/_config.yml b/docs/_config.yml index 6740ca0c9f..7d821a9e62 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,7 +1,7 @@ repository: pmd/pmd pmd: - version: 7.1.0-SNAPSHOT + version: 7.1.0 previous_version: 7.0.0 date: 26-April-2024 release_type: minor diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 322d436ce6..d15a5d50ed 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -15,25 +15,23 @@ This is a {{ site.pmd.release_type }} release. ### 🚀 New and noteworthy #### More robust CPD reports - -There were a number of circumstances, specially around (but not limited to) literal sequences, were CPD would report duplicate overlapping or partially overlapping matches. These have now been fixed, and CPD will report only the longest non-overlapping duplicate. +There were a number of circumstances, specially around (but not limited to) literal sequences, were CPD would +report duplicate overlapping or partially overlapping matches. These have now been fixed, and CPD will report +only the longest non-overlapping duplicate. These improvements apply to all supported languages, irrespective of supported flags. -### ✨ New rules - +#### ✨ New Rules - The new Java rule {%rule java/bestpractices/UnnecessaryVarargsArrayCreation %} reports explicit array creation when a varargs is expected. This is more heavy to read and could be simplified. - The new Java rule {%rule java/errorprone/ConfusingArgumentToVarargsMethod %} reports some confusing situations where a varargs method is called with an inexact argument type. These may end up in a mismatch between the expected parameter type and the actual value. - - The new Java rule {% rule "java/codestyle/LambdaCanBeMethodReference" %} reports lambda expressions that can be replaced with a method reference. Please read the documentation of the rule for more info. This rule is now part of the Quickstart ruleset. -### 🌟 Rule Changes - +#### 🌟 Rule Changes * {%rule java/bestpractices/JUnitTestsShouldIncludeAssert %} and {% rule java/bestpractices/JUnitTestContainsTooManyAsserts %} have a new property named `extraAssertMethodNames`. With this property, you can configure which additional static methods should be considered as valid verification methods. This allows to use custom mocking or assertion libraries. @@ -88,16 +86,19 @@ These improvements apply to all supported languages, irrespective of supported f * [#4967](https://github.com/pmd/pmd/pull/4967): Fix reproducible build issues with 7.0.0 ### 🚨 API Changes - #### Deprecated methods - -* {% jdoc java::lang.java.ast.ASTLambdaExpression#getBlock() %} and {% jdoc java::lang.java.ast.ASTLambdaExpression#getExpression() %} -* {%jdoc java::lang.java.rule.design.SingularFieldRule#mayBeSingular(java::lang.java.ast.ModifierOwner) %} has been deprecated for - removal. The method is only useful for the rule itself and shouldn't be used otherwise. +* pmd-java + * {% jdoc !!java::lang.java.ast.ASTLambdaExpression#getBlock() %} and {% jdoc !!java::lang.java.ast.ASTLambdaExpression#getExpression() %} + * {% jdoc !!java::lang.java.rule.design.SingularFieldRule#mayBeSingular(java::lang.java.ast.ModifierOwner) %} has been deprecated for + removal. The method is only useful for the rule itself and shouldn't be used otherwise. ### ✨ External Contributions * [#4864](https://github.com/pmd/pmd/pull/4864): Fix #1084 \[Java] add extra assert method names to Junit rules - [Erwan Moutymbo](https://github.com/emouty) (@emouty) * [#4894](https://github.com/pmd/pmd/pull/4894): Fix #4791 Error caused by space in JDK path - [Scrates1](https://github.com/Scrates1) (@Scrates1) -{% endtocmaker %} +### 📈 Stats +* 205 commits +* 71 closed tickets & PRs +* Days since last release: 34 +{% endtocmaker %} From 592e80d4a9e01b4294d10bcad8ead80291c6ffa7 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 08:35:11 +0200 Subject: [PATCH 075/142] [release] prepare release pmd_releases/7.1.0 --- pmd-ant/pom.xml | 2 +- pmd-apex/pom.xml | 2 +- pmd-cli/pom.xml | 2 +- pmd-coco/pom.xml | 2 +- pmd-compat6/pom.xml | 2 +- pmd-core/pom.xml | 2 +- pmd-cpp/pom.xml | 2 +- pmd-cs/pom.xml | 2 +- pmd-dart/pom.xml | 2 +- pmd-dist/pom.xml | 2 +- pmd-doc/pom.xml | 2 +- pmd-fortran/pom.xml | 2 +- pmd-gherkin/pom.xml | 2 +- pmd-go/pom.xml | 2 +- pmd-groovy/pom.xml | 2 +- pmd-html/pom.xml | 2 +- pmd-java/pom.xml | 2 +- pmd-javascript/pom.xml | 2 +- pmd-jsp/pom.xml | 2 +- pmd-julia/pom.xml | 2 +- pmd-kotlin/pom.xml | 2 +- pmd-lang-test/pom.xml | 2 +- pmd-languages-deps/pom.xml | 2 +- pmd-lua/pom.xml | 2 +- pmd-matlab/pom.xml | 2 +- pmd-modelica/pom.xml | 2 +- pmd-objectivec/pom.xml | 2 +- pmd-perl/pom.xml | 2 +- pmd-php/pom.xml | 2 +- pmd-plsql/pom.xml | 2 +- pmd-python/pom.xml | 2 +- pmd-ruby/pom.xml | 2 +- pmd-scala-modules/pmd-scala-common/pom.xml | 2 +- pmd-scala-modules/pmd-scala_2.12/pom.xml | 2 +- pmd-scala-modules/pmd-scala_2.13/pom.xml | 2 +- pmd-swift/pom.xml | 2 +- pmd-test-schema/pom.xml | 2 +- pmd-test/pom.xml | 2 +- pmd-tsql/pom.xml | 2 +- pmd-velocity/pom.xml | 2 +- pmd-visualforce/pom.xml | 2 +- pmd-xml/pom.xml | 2 +- pom.xml | 6 +++--- 43 files changed, 45 insertions(+), 45 deletions(-) diff --git a/pmd-ant/pom.xml b/pmd-ant/pom.xml index 92156edb96..3c47ac7843 100644 --- a/pmd-ant/pom.xml +++ b/pmd-ant/pom.xml @@ -7,7 +7,7 @@ pmd net.sourceforge.pmd - 7.1.0-SNAPSHOT + 7.1.0 4.0.0 diff --git a/pmd-apex/pom.xml b/pmd-apex/pom.xml index 7324f13452..125cc7225b 100644 --- a/pmd-apex/pom.xml +++ b/pmd-apex/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-cli/pom.xml b/pmd-cli/pom.xml index 946c1a8d55..9145c0bf72 100644 --- a/pmd-cli/pom.xml +++ b/pmd-cli/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-coco/pom.xml b/pmd-coco/pom.xml index c142f4225d..61894b4bd0 100644 --- a/pmd-coco/pom.xml +++ b/pmd-coco/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-compat6/pom.xml b/pmd-compat6/pom.xml index d442413de1..e4133ae530 100644 --- a/pmd-compat6/pom.xml +++ b/pmd-compat6/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 pmd-compat6 diff --git a/pmd-core/pom.xml b/pmd-core/pom.xml index 67cd064514..43c5c7750c 100644 --- a/pmd-core/pom.xml +++ b/pmd-core/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-cpp/pom.xml b/pmd-cpp/pom.xml index 8b2baf8fc5..966136b0a1 100644 --- a/pmd-cpp/pom.xml +++ b/pmd-cpp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-cs/pom.xml b/pmd-cs/pom.xml index 961ea3bbd2..fd9e9108ba 100644 --- a/pmd-cs/pom.xml +++ b/pmd-cs/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-dart/pom.xml b/pmd-dart/pom.xml index 0ae496e75a..7fb657f2f9 100644 --- a/pmd-dart/pom.xml +++ b/pmd-dart/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index 544dec8f55..92c78888f7 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-doc/pom.xml b/pmd-doc/pom.xml index 10f70bd0e4..472d0a0c42 100644 --- a/pmd-doc/pom.xml +++ b/pmd-doc/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-fortran/pom.xml b/pmd-fortran/pom.xml index 4629e05389..9d83a46377 100644 --- a/pmd-fortran/pom.xml +++ b/pmd-fortran/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-gherkin/pom.xml b/pmd-gherkin/pom.xml index 86ee0f2b8a..7062166114 100644 --- a/pmd-gherkin/pom.xml +++ b/pmd-gherkin/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-go/pom.xml b/pmd-go/pom.xml index 88ac216243..49b3b2d271 100644 --- a/pmd-go/pom.xml +++ b/pmd-go/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-groovy/pom.xml b/pmd-groovy/pom.xml index 0d15dfbb0b..f15a81bc87 100644 --- a/pmd-groovy/pom.xml +++ b/pmd-groovy/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-html/pom.xml b/pmd-html/pom.xml index a184d7cc1f..4e07912b1e 100644 --- a/pmd-html/pom.xml +++ b/pmd-html/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-java/pom.xml b/pmd-java/pom.xml index dbc0c16c0a..97951c5875 100644 --- a/pmd-java/pom.xml +++ b/pmd-java/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-javascript/pom.xml b/pmd-javascript/pom.xml index e4a8f98a27..eae383689d 100644 --- a/pmd-javascript/pom.xml +++ b/pmd-javascript/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-jsp/pom.xml b/pmd-jsp/pom.xml index 61be68c532..dd6830dce2 100644 --- a/pmd-jsp/pom.xml +++ b/pmd-jsp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-julia/pom.xml b/pmd-julia/pom.xml index a42e18aaec..f4871dc9ea 100644 --- a/pmd-julia/pom.xml +++ b/pmd-julia/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-kotlin/pom.xml b/pmd-kotlin/pom.xml index 5ea491683a..d0fa0cab92 100644 --- a/pmd-kotlin/pom.xml +++ b/pmd-kotlin/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-lang-test/pom.xml b/pmd-lang-test/pom.xml index 0fd858305c..095312b601 100644 --- a/pmd-lang-test/pom.xml +++ b/pmd-lang-test/pom.xml @@ -12,7 +12,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-languages-deps/pom.xml b/pmd-languages-deps/pom.xml index e6f339c8a2..1a97f9dbb6 100644 --- a/pmd-languages-deps/pom.xml +++ b/pmd-languages-deps/pom.xml @@ -4,7 +4,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 pmd-languages-deps diff --git a/pmd-lua/pom.xml b/pmd-lua/pom.xml index 24f21403f9..58f4434b59 100644 --- a/pmd-lua/pom.xml +++ b/pmd-lua/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-matlab/pom.xml b/pmd-matlab/pom.xml index 54166a1612..e719086307 100644 --- a/pmd-matlab/pom.xml +++ b/pmd-matlab/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-modelica/pom.xml b/pmd-modelica/pom.xml index 58a4e48e2b..a1cc5bf932 100644 --- a/pmd-modelica/pom.xml +++ b/pmd-modelica/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-objectivec/pom.xml b/pmd-objectivec/pom.xml index cb82109d28..ea1da86146 100644 --- a/pmd-objectivec/pom.xml +++ b/pmd-objectivec/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-perl/pom.xml b/pmd-perl/pom.xml index 8abc31b698..9520bcf5f3 100644 --- a/pmd-perl/pom.xml +++ b/pmd-perl/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-php/pom.xml b/pmd-php/pom.xml index a446f353cb..f434480005 100644 --- a/pmd-php/pom.xml +++ b/pmd-php/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-plsql/pom.xml b/pmd-plsql/pom.xml index ff0b7c7f6c..314856817f 100644 --- a/pmd-plsql/pom.xml +++ b/pmd-plsql/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-python/pom.xml b/pmd-python/pom.xml index 2c0a8595f0..eb840fe60a 100644 --- a/pmd-python/pom.xml +++ b/pmd-python/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-ruby/pom.xml b/pmd-ruby/pom.xml index b5eddc00c3..9ba43f87ce 100644 --- a/pmd-ruby/pom.xml +++ b/pmd-ruby/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-scala-modules/pmd-scala-common/pom.xml b/pmd-scala-modules/pmd-scala-common/pom.xml index 13a68664ba..9c4022628e 100644 --- a/pmd-scala-modules/pmd-scala-common/pom.xml +++ b/pmd-scala-modules/pmd-scala-common/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../../pom.xml diff --git a/pmd-scala-modules/pmd-scala_2.12/pom.xml b/pmd-scala-modules/pmd-scala_2.12/pom.xml index f49d0deb67..8ccdf84c96 100644 --- a/pmd-scala-modules/pmd-scala_2.12/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.12/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd-scala-common - 7.1.0-SNAPSHOT + 7.1.0 ../pmd-scala-common/pom.xml diff --git a/pmd-scala-modules/pmd-scala_2.13/pom.xml b/pmd-scala-modules/pmd-scala_2.13/pom.xml index 46cc4a81ba..2be8020812 100644 --- a/pmd-scala-modules/pmd-scala_2.13/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.13/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd-scala-common - 7.1.0-SNAPSHOT + 7.1.0 ../pmd-scala-common/pom.xml diff --git a/pmd-swift/pom.xml b/pmd-swift/pom.xml index 16e72f0362..2f2a970c9a 100644 --- a/pmd-swift/pom.xml +++ b/pmd-swift/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-test-schema/pom.xml b/pmd-test-schema/pom.xml index 4ab3094ccb..e5ce4edbdd 100644 --- a/pmd-test-schema/pom.xml +++ b/pmd-test-schema/pom.xml @@ -11,7 +11,7 @@ pmd net.sourceforge.pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-test/pom.xml b/pmd-test/pom.xml index 3fe5075ae9..f89c707f40 100644 --- a/pmd-test/pom.xml +++ b/pmd-test/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-tsql/pom.xml b/pmd-tsql/pom.xml index 9c760a2e5a..b629638f87 100644 --- a/pmd-tsql/pom.xml +++ b/pmd-tsql/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-velocity/pom.xml b/pmd-velocity/pom.xml index b3d4141a6e..5ed458e262 100644 --- a/pmd-velocity/pom.xml +++ b/pmd-velocity/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-visualforce/pom.xml b/pmd-visualforce/pom.xml index d361264c2d..d59bd04a4d 100644 --- a/pmd-visualforce/pom.xml +++ b/pmd-visualforce/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml index 3b48f67441..63fd135277 100644 --- a/pmd-xml/pom.xml +++ b/pmd-xml/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 ../pom.xml diff --git a/pom.xml b/pom.xml index 846b3623ae..a7937c209c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.sourceforge.pmd pmd - 7.1.0-SNAPSHOT + 7.1.0 pom PMD @@ -60,7 +60,7 @@ scm:git:git://github.com/pmd/pmd.git scm:git:ssh://git@github.com/pmd/pmd.git https://github.com/pmd/pmd - HEAD + pmd_releases/7.1.0 @@ -81,7 +81,7 @@ - 2024-03-22T07:17:27Z + 2024-04-26T06:14:52Z 8 From 339e1d4f436a27f6bb7d1891d835d3f8b4d173d0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 09:04:20 +0200 Subject: [PATCH 076/142] [release] Prepare next development version [skip ci] --- docs/_config.yml | 6 +- docs/pages/release_notes.md | 82 +- docs/pages/release_notes_old.md | 107 + docs/pages/release_notes_pmd7.md | 3544 -------------------- pmd-ant/pom.xml | 2 +- pmd-apex/pom.xml | 2 +- pmd-cli/pom.xml | 2 +- pmd-coco/pom.xml | 2 +- pmd-compat6/pom.xml | 2 +- pmd-core/pom.xml | 2 +- pmd-cpp/pom.xml | 2 +- pmd-cs/pom.xml | 2 +- pmd-dart/pom.xml | 2 +- pmd-dist/pom.xml | 2 +- pmd-doc/pom.xml | 2 +- pmd-fortran/pom.xml | 2 +- pmd-gherkin/pom.xml | 2 +- pmd-go/pom.xml | 2 +- pmd-groovy/pom.xml | 2 +- pmd-html/pom.xml | 2 +- pmd-java/pom.xml | 2 +- pmd-javascript/pom.xml | 2 +- pmd-jsp/pom.xml | 2 +- pmd-julia/pom.xml | 2 +- pmd-kotlin/pom.xml | 2 +- pmd-lang-test/pom.xml | 2 +- pmd-languages-deps/pom.xml | 2 +- pmd-lua/pom.xml | 2 +- pmd-matlab/pom.xml | 2 +- pmd-modelica/pom.xml | 2 +- pmd-objectivec/pom.xml | 2 +- pmd-perl/pom.xml | 2 +- pmd-php/pom.xml | 2 +- pmd-plsql/pom.xml | 2 +- pmd-python/pom.xml | 2 +- pmd-ruby/pom.xml | 2 +- pmd-scala-modules/pmd-scala-common/pom.xml | 2 +- pmd-scala-modules/pmd-scala_2.12/pom.xml | 2 +- pmd-scala-modules/pmd-scala_2.13/pom.xml | 2 +- pmd-swift/pom.xml | 2 +- pmd-test-schema/pom.xml | 2 +- pmd-test/pom.xml | 2 +- pmd-tsql/pom.xml | 2 +- pmd-velocity/pom.xml | 2 +- pmd-visualforce/pom.xml | 2 +- pmd-xml/pom.xml | 2 +- pom.xml | 4 +- 47 files changed, 155 insertions(+), 3672 deletions(-) diff --git a/docs/_config.yml b/docs/_config.yml index 7d821a9e62..f53795d99a 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,9 +1,9 @@ repository: pmd/pmd pmd: - version: 7.1.0 - previous_version: 7.0.0 - date: 26-April-2024 + version: 7.2.0-SNAPSHOT + previous_version: 7.1.0 + date: 31-May-2024 release_type: minor # release types: major, minor, bugfix diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index d15a5d50ed..e8d7cdbf90 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,91 +14,11 @@ This is a {{ site.pmd.release_type }} release. ### 🚀 New and noteworthy -#### More robust CPD reports -There were a number of circumstances, specially around (but not limited to) literal sequences, were CPD would -report duplicate overlapping or partially overlapping matches. These have now been fixed, and CPD will report -only the longest non-overlapping duplicate. - -These improvements apply to all supported languages, irrespective of supported flags. - -#### ✨ New Rules -- The new Java rule {%rule java/bestpractices/UnnecessaryVarargsArrayCreation %} reports explicit array creation - when a varargs is expected. This is more heavy to read and could be simplified. -- The new Java rule {%rule java/errorprone/ConfusingArgumentToVarargsMethod %} reports some confusing situations - where a varargs method is called with an inexact argument type. These may end up in a mismatch between the expected - parameter type and the actual value. -- The new Java rule {% rule "java/codestyle/LambdaCanBeMethodReference" %} reports lambda expressions that can be replaced - with a method reference. Please read the documentation of the rule for more info. This rule is now part of the Quickstart - ruleset. - -#### 🌟 Rule Changes -* {%rule java/bestpractices/JUnitTestsShouldIncludeAssert %} and {% rule java/bestpractices/JUnitTestContainsTooManyAsserts %} - have a new property named `extraAssertMethodNames`. With this property, you can configure which additional static - methods should be considered as valid verification methods. This allows to use custom mocking or assertion libraries. - ### 🐛 Fixed Issues -* core - * [#494](https://github.com/pmd/pmd/issues/494): \[core] Adopt JApiCmp to enforce control over API changes - * [#4942](https://github.com/pmd/pmd/issues/4942): \[core] CPD: `--skip-duplicate-files` has no effect (7.0.0 regression) - * [#4959](https://github.com/pmd/pmd/pull/4959): \[core] Upgrade saxon to 12.4 -* cli - * [#4791](https://github.com/pmd/pmd/issues/4791): \[cli] Could not find or load main class - * [#4913](https://github.com/pmd/pmd/issues/4913): \[cli] cpd-gui closes immediately -* doc - * [#4901](https://github.com/pmd/pmd/issues/4901): \[doc] Improve documentation on usage of violationSuppressXPath -* apex - * [#4418](https://github.com/pmd/pmd/issues/4418): \[apex] ASTAnnotation.getImage() does not return value as written in the class -* apex-errorprone - * [#3953](https://github.com/pmd/pmd/issues/3953): \[apex] EmptyCatchBlock false positive with formal (doc) comments -* cpp - * [#2438](https://github.com/pmd/pmd/issues/2438): \[cpp] Repeated Duplication blocks -* java - * [#4899](https://github.com/pmd/pmd/issues/4899): \[java] Parsing failed in ParseLock#doParse() java.io.IOException: Stream closed - * [#4902](https://github.com/pmd/pmd/issues/4902): \[java] "Bad intersection, unrelated class types" for Constable\[] and Enum\[] - * [#4947](https://github.com/pmd/pmd/issues/4947): \[java] Broken TextBlock parser -* java-bestpractices - * [#1084](https://github.com/pmd/pmd/issues/1084): \[java] Allow JUnitTestsShouldIncludeAssert to configure verification methods - * [#3216](https://github.com/pmd/pmd/issues/3216): \[java] New rule: UnnecessaryVarargsArrayCreation - * [#4435](https://github.com/pmd/pmd/issues/4435): \[java] \[7.0-rc1] UnusedAssignment for used field - * [#4569](https://github.com/pmd/pmd/issues/4569): \[java] ForLoopCanBeForeach reports on loop `for (int i = 0; i < list.size(); i += 2)` - * [#4618](https://github.com/pmd/pmd/issues/4618): \[java] UnusedAssignment false positive with conditional assignments of fields -* java-codestyle - * [#4602](https://github.com/pmd/pmd/issues/4602): \[java] UnnecessaryImport: false positives with static imports - * [#4785](https://github.com/pmd/pmd/issues/4785): \[java] False Positive: PMD Incorrectly report violation for UnnecessaryImport - * [#4779](https://github.com/pmd/pmd/issues/4779): \[java] Examples in documentation of MethodArgumentCanBeFinal do not trigger the rule - * [#4881](https://github.com/pmd/pmd/issues/4881): \[java] ClassNamingConventions: interfaces are identified as abstract classes (regression in 7.0.0) -* java-design - * [#2440](https://github.com/pmd/pmd/issues/2440): \[java] FinalFieldCouldBeStatic FN when the right side of the assignment is a constant expression - * [#3694](https://github.com/pmd/pmd/issues/3694): \[java] SingularField ignores static variables - * [#4873](https://github.com/pmd/pmd/issues/4873): \[java] AvoidCatchingGenericException: Can no longer suppress on the exception itself -* java-errorprone - * [#2056](https://github.com/pmd/pmd/issues/2056): \[java] CloseResource false-positive with URLClassLoader in cast expression - * [#4751](https://github.com/pmd/pmd/issues/4751): \[java] PMD crashes when analyzing CloseResource Rule - * [#4928](https://github.com/pmd/pmd/issues/4928): \[java] EmptyCatchBlock false negative when allowCommentedBlocks=true - * [#4948](https://github.com/pmd/pmd/issues/4948): \[java] ImplicitSwitchFallThrough: False-positive with nested switch statements -* java-performance - * [#3845](https://github.com/pmd/pmd/issues/3845): \[java] InsufficientStringBufferDeclaration should consider literal expression - * [#4874](https://github.com/pmd/pmd/issues/4874): \[java] StringInstantiation: False-positive when using `new String(charArray)` - * [#4886](https://github.com/pmd/pmd/issues/4886): \[java] BigIntegerInstantiation: False Positive with Java 17 and BigDecimal.TWO -* pom-errorprone - * [#4388](https://github.com/pmd/pmd/issues/4388): \[pom] InvalidDependencyTypes doesn't consider dependencies at all -* misc - * [#4967](https://github.com/pmd/pmd/pull/4967): Fix reproducible build issues with 7.0.0 ### 🚨 API Changes -#### Deprecated methods -* pmd-java - * {% jdoc !!java::lang.java.ast.ASTLambdaExpression#getBlock() %} and {% jdoc !!java::lang.java.ast.ASTLambdaExpression#getExpression() %} - * {% jdoc !!java::lang.java.rule.design.SingularFieldRule#mayBeSingular(java::lang.java.ast.ModifierOwner) %} has been deprecated for - removal. The method is only useful for the rule itself and shouldn't be used otherwise. ### ✨ External Contributions -* [#4864](https://github.com/pmd/pmd/pull/4864): Fix #1084 \[Java] add extra assert method names to Junit rules - [Erwan Moutymbo](https://github.com/emouty) (@emouty) -* [#4894](https://github.com/pmd/pmd/pull/4894): Fix #4791 Error caused by space in JDK path - [Scrates1](https://github.com/Scrates1) (@Scrates1) - -### 📈 Stats -* 205 commits -* 71 closed tickets & PRs -* Days since last release: 34 {% endtocmaker %} + diff --git a/docs/pages/release_notes_old.md b/docs/pages/release_notes_old.md index 2fedec6996..b4eaab15bd 100644 --- a/docs/pages/release_notes_old.md +++ b/docs/pages/release_notes_old.md @@ -5,6 +5,113 @@ permalink: pmd_release_notes_old.html Previous versions of PMD can be downloaded here: [Releases - pmd/pmd (GitHub)](https://github.com/pmd/pmd/releases) +## 26-April-2024 - 7.1.0 + +The PMD team is pleased to announce PMD 7.1.0. + +This is a minor release. + +### Table Of Contents + +* [🚀 New and noteworthy](#new-and-noteworthy) + * [More robust CPD reports](#more-robust-cpd-reports) + * [✨ New Rules](#new-rules) + * [🌟 Rule Changes](#rule-changes) +* [🐛 Fixed Issues](#fixed-issues) +* [🚨 API Changes](#api-changes) + * [Deprecated methods](#deprecated-methods) +* [✨ External Contributions](#external-contributions) +* [📈 Stats](#stats) + +### 🚀 New and noteworthy + +#### More robust CPD reports +There were a number of circumstances, specially around (but not limited to) literal sequences, were CPD would +report duplicate overlapping or partially overlapping matches. These have now been fixed, and CPD will report +only the longest non-overlapping duplicate. + +These improvements apply to all supported languages, irrespective of supported flags. + +#### ✨ New Rules +- The new Java rule [`UnnecessaryVarargsArrayCreation`](https://docs.pmd-code.org/pmd-doc-7.1.0/pmd_rules_java_bestpractices.html#unnecessaryvarargsarraycreation) reports explicit array creation + when a varargs is expected. This is more heavy to read and could be simplified. +- The new Java rule [`ConfusingArgumentToVarargsMethod`](https://docs.pmd-code.org/pmd-doc-7.1.0/pmd_rules_java_errorprone.html#confusingargumenttovarargsmethod) reports some confusing situations + where a varargs method is called with an inexact argument type. These may end up in a mismatch between the expected + parameter type and the actual value. +- The new Java rule [`LambdaCanBeMethodReference`](https://docs.pmd-code.org/pmd-doc-7.1.0/pmd_rules_java_codestyle.html#lambdacanbemethodreference) reports lambda expressions that can be replaced + with a method reference. Please read the documentation of the rule for more info. This rule is now part of the Quickstart + ruleset. + +#### 🌟 Rule Changes +* [`JUnitTestsShouldIncludeAssert`](https://docs.pmd-code.org/pmd-doc-7.1.0/pmd_rules_java_bestpractices.html#junittestsshouldincludeassert) and [`JUnitTestContainsTooManyAsserts`](https://docs.pmd-code.org/pmd-doc-7.1.0/pmd_rules_java_bestpractices.html#junittestcontainstoomanyasserts) + have a new property named `extraAssertMethodNames`. With this property, you can configure which additional static + methods should be considered as valid verification methods. This allows to use custom mocking or assertion libraries. + +### 🐛 Fixed Issues +* core + * [#494](https://github.com/pmd/pmd/issues/494): \[core] Adopt JApiCmp to enforce control over API changes + * [#4942](https://github.com/pmd/pmd/issues/4942): \[core] CPD: `--skip-duplicate-files` has no effect (7.0.0 regression) + * [#4959](https://github.com/pmd/pmd/pull/4959): \[core] Upgrade saxon to 12.4 +* cli + * [#4791](https://github.com/pmd/pmd/issues/4791): \[cli] Could not find or load main class + * [#4913](https://github.com/pmd/pmd/issues/4913): \[cli] cpd-gui closes immediately +* doc + * [#4901](https://github.com/pmd/pmd/issues/4901): \[doc] Improve documentation on usage of violationSuppressXPath +* apex + * [#4418](https://github.com/pmd/pmd/issues/4418): \[apex] ASTAnnotation.getImage() does not return value as written in the class +* apex-errorprone + * [#3953](https://github.com/pmd/pmd/issues/3953): \[apex] EmptyCatchBlock false positive with formal (doc) comments +* cpp + * [#2438](https://github.com/pmd/pmd/issues/2438): \[cpp] Repeated Duplication blocks +* java + * [#4899](https://github.com/pmd/pmd/issues/4899): \[java] Parsing failed in ParseLock#doParse() java.io.IOException: Stream closed + * [#4902](https://github.com/pmd/pmd/issues/4902): \[java] "Bad intersection, unrelated class types" for Constable\[] and Enum\[] + * [#4947](https://github.com/pmd/pmd/issues/4947): \[java] Broken TextBlock parser +* java-bestpractices + * [#1084](https://github.com/pmd/pmd/issues/1084): \[java] Allow JUnitTestsShouldIncludeAssert to configure verification methods + * [#3216](https://github.com/pmd/pmd/issues/3216): \[java] New rule: UnnecessaryVarargsArrayCreation + * [#4435](https://github.com/pmd/pmd/issues/4435): \[java] \[7.0-rc1] UnusedAssignment for used field + * [#4569](https://github.com/pmd/pmd/issues/4569): \[java] ForLoopCanBeForeach reports on loop `for (int i = 0; i < list.size(); i += 2)` + * [#4618](https://github.com/pmd/pmd/issues/4618): \[java] UnusedAssignment false positive with conditional assignments of fields +* java-codestyle + * [#4602](https://github.com/pmd/pmd/issues/4602): \[java] UnnecessaryImport: false positives with static imports + * [#4785](https://github.com/pmd/pmd/issues/4785): \[java] False Positive: PMD Incorrectly report violation for UnnecessaryImport + * [#4779](https://github.com/pmd/pmd/issues/4779): \[java] Examples in documentation of MethodArgumentCanBeFinal do not trigger the rule + * [#4881](https://github.com/pmd/pmd/issues/4881): \[java] ClassNamingConventions: interfaces are identified as abstract classes (regression in 7.0.0) +* java-design + * [#2440](https://github.com/pmd/pmd/issues/2440): \[java] FinalFieldCouldBeStatic FN when the right side of the assignment is a constant expression + * [#3694](https://github.com/pmd/pmd/issues/3694): \[java] SingularField ignores static variables + * [#4873](https://github.com/pmd/pmd/issues/4873): \[java] AvoidCatchingGenericException: Can no longer suppress on the exception itself +* java-errorprone + * [#2056](https://github.com/pmd/pmd/issues/2056): \[java] CloseResource false-positive with URLClassLoader in cast expression + * [#4751](https://github.com/pmd/pmd/issues/4751): \[java] PMD crashes when analyzing CloseResource Rule + * [#4928](https://github.com/pmd/pmd/issues/4928): \[java] EmptyCatchBlock false negative when allowCommentedBlocks=true + * [#4948](https://github.com/pmd/pmd/issues/4948): \[java] ImplicitSwitchFallThrough: False-positive with nested switch statements +* java-performance + * [#3845](https://github.com/pmd/pmd/issues/3845): \[java] InsufficientStringBufferDeclaration should consider literal expression + * [#4874](https://github.com/pmd/pmd/issues/4874): \[java] StringInstantiation: False-positive when using `new String(charArray)` + * [#4886](https://github.com/pmd/pmd/issues/4886): \[java] BigIntegerInstantiation: False Positive with Java 17 and BigDecimal.TWO +* pom-errorprone + * [#4388](https://github.com/pmd/pmd/issues/4388): \[pom] InvalidDependencyTypes doesn't consider dependencies at all +* misc + * [#4967](https://github.com/pmd/pmd/pull/4967): Fix reproducible build issues with 7.0.0 + +### 🚨 API Changes +#### Deprecated methods +* pmd-java + * ASTLambdaExpression#getBlock and ASTLambdaExpression#getExpression + * SingularFieldRule#mayBeSingular has been deprecated for + removal. The method is only useful for the rule itself and shouldn't be used otherwise. + +### ✨ External Contributions +* [#4864](https://github.com/pmd/pmd/pull/4864): Fix #1084 \[Java] add extra assert method names to Junit rules - [Erwan Moutymbo](https://github.com/emouty) (@emouty) +* [#4894](https://github.com/pmd/pmd/pull/4894): Fix #4791 Error caused by space in JDK path - [Scrates1](https://github.com/Scrates1) (@Scrates1) + +### 📈 Stats +* 205 commits +* 71 closed tickets & PRs +* Days since last release: 34 + ## 22-March-2024 - 7.0.0 diff --git a/docs/pages/release_notes_pmd7.md b/docs/pages/release_notes_pmd7.md index 3b7f58f544..8b13789179 100644 --- a/docs/pages/release_notes_pmd7.md +++ b/docs/pages/release_notes_pmd7.md @@ -1,3545 +1 @@ ---- -title: Detailed Release Notes for PMD 7 -summary: "These are the detailed release notes for PMD 7." -permalink: pmd_release_notes_pmd7.html -keywords: changelog, release notes ---- -## 🚀 Major Features and Enhancements - -### New official logo - -Many of you probably have already seen the new logo, but now it's time to actually ship it. The new logo -was long ago decided (see [#1663](https://github.com/pmd/pmd/issues/1663)). - -We decided it's time to have a modernized logo and get rid of the gun. This allows to include -the logo anywhere without offense. - -The official logo is also without a tagline (such as "Code Quality Matters!") as the tagline created some -controversies. Without a tagline, we are not limited in the direction of future development of PMD. - -![New PMD Logo](images/logo/pmd-logo-300px.png) - -The new logo is available from the [Logo Project Page](pmd_projectdocs_logo.html). - -### Revamped Java - -The Java grammar has been refactored substantially in order to make it easier to maintain and more correct -regarding the Java Language Specification. It supports now also the edge-cases where PMD 6 was failing -(e.g. annotations were not supported everywhere). Changing the grammar entails a changed AST and therefore changed -rules. The PMD built-in rules have all been upgraded and many bugs have been fixed on the way. -Unfortunately, if you are using custom rules, you will most probably need to accommodate these changes yourself. - -The type resolution framework has been rewritten from scratch and should now cover the entire Java spec correctly. -The same is true for the symbol table. -PMD 6 on the other hand has always had problems with advanced type inference, e.g. with lambdas and call chains. -Since it was built on the core reflection API, it also was prone to linkage errors and classloader leaks for instance. -PMD 7 does not need to load classes, and does not have these problems. - -The AST exposes much more semantic information now. For instance, you can jump from a method call to -the declaration of the method being called, or from a field access to the field declaration. These -improvements allow interesting rules to be written that need precise knowledge of the types -in the program, for instance to detect [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) -or [`UseDiamondOperator`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#usediamondoperator). -These are just a small preview of the new rules we will be adding in the PMD 7 release cycle. - -Overall, the changes to the parser, AST, type resolution and symbol table code has made PMD for -Java **significantly faster**. On average, we have seen ~2-3X faster analysis, but as usual, this may change -depending on your workload, configuration and ruleset. - -Contributors: [Clément Fournier](https://github.com/oowekyala) (@oowekyala), -[Andreas Dangel](https://github.com/adangel) (@adangel), -[Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod) - - - -### Revamped Command Line Interface - -PMD now ships with a unified Command Line Interface for both Linux/Unix and Windows. Instead of having a collection -of scripts for the different utilities shipped with PMD, a single script `pmd` (`pmd.bat` for Windows) can now -launch all utilities using subcommands, e.g. `pmd check`, `pmd designer`. All commands and options are thoroughly -documented in the help, with full color support where available. Moreover, efforts were made to provide consistency -in the usage of all PMD utilities. - -```shell -$ Usage: pmd [-hV] [COMMAND] - -h, --help Show this help message and exit. - -V, --version Print version information and exit. -Commands: - check The PMD standard source code analyzer - cpd Copy/Paste Detector - find duplicate code - designer The PMD visual rule designer - cpd-gui GUI for the Copy/Paste Detector - Warning: May not support the full CPD feature set - ast-dump Experimental: dumps the AST of parsing source code -Exit Codes: - 0 Successful analysis, no violations found - 1 An unexpected error occurred during execution - 2 Usage error, please refer to the command help - 4 Successful analysis, at least 1 violation found -``` - -For instance, where you previously would have run -```shell -run.sh pmd -d src -R ruleset.xml -``` -you should now use -```shell -pmd check -d src -R ruleset.xml -``` -or even better, omit using `-d` / `--dir` and simply pass the sources at the end of the parameter list - -```shell -pmd check -R ruleset.xml src -``` - -Multiple source directories can be passed, such as: -```shell -pmd check -R ruleset.xml src/main/java src/test/java -``` - -And the exact same applies to CPD: -```shell -pmd cpd --minimum-tokens 100 src/main/java -``` - -Additionally, the CLI for the `check` command has been enhanced with a progress bar, which interactively displays the -current progress of the analysis. - -![Demo](images/userdocs/pmd-demo.gif) - -This can be disabled with the `--no-progress` flag. - -Finally, we now provide a completion script for Bash/Zsh to further help daily usage. -To use it, edit your `~/.bashrc` / `~/.zshrc` file and add the following line: - -``` -source <(pmd generate-completion) -``` - -Contributors: [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod) - -### Full Antlr support - -PMD 6 only supported JavaCC based grammars, but with [Antlr](https://www.antlr.org/) parsers -can be generated as well. Languages backed by an Antlr grammar are now fully supported. This means, it's now -possible not only to use Antlr grammars for CPD, but we can actually build full-fledged PMD rules for them as well. -Both the traditional Java visitor rules, and the simpler XPath rules are available to users. This allows -to leverage existing grammars. - -We expect this to enable both our dev team and external contributors to largely extend PMD usage for more languages. - -Two languages (Swift and Kotlin) already use this new possibility. - -See the documentation page [Adding a new language with ANTLR](pmd_devdocs_major_adding_new_language_antlr.html) -for instructions on how to use this new feature. - -Contributors: [Lucas Soncini](https://github.com/lsoncini) (@lsoncini), -[Matías Fraga](https://github.com/matifraga) (@matifraga), -[Tomás De Lucca](https://github.com/tomidelucca) (@tomidelucca) - -### Updated PMD Designer - -This PMD release ships a new version of the pmd-designer. The designer artifact has been -renamed from "pmd-ui" to "pmd-designer". While the designer still works with Java 8, the -recommended Java Runtime is Java 11 (or later) with OpenJFX 17 (or later). - -For the detailed changes, see -* [PMD Designer Changelog (7.0.0)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0). -* [PMD Designer Changelog (7.0.0-rc4)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0-rc4). -* [PMD Designer Changelog (7.0.0-rc1)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0-rc1). - -### New CPD report format cpdhtml-v2.xslt - -Thanks to @mohan-chinnappan-n a new CPD report format has been added which features a data table. -It uses an XSLT stylesheet to convert CPD's XML format into HTML. - -See [the example report](report-examples/cpdhtml-v2.html). - -Contributors: [Mohan Chinnappan](https://github.com/mohan-chinnappan-n) (@mohan-chinnappan-n) - -## 🎉 Language Related Changes - -### New: CPD support for Apache Velocity Template Language (VTL) - -PMD supported Apache Velocity for a very long time, but the CPD integration never got finished. -This is now done and CPD supports Apache Velocity Template language for detecting copy and paste. -It is shipped in the module `pmd-velocity`. - -### New: CPD support for Coco - -Thanks to a contribution, CPD now supports Coco, a modern programming language -designed specifically for building event-driven software. It is shipped in the new -module `pmd-coco`. - -Contributors: [Wener](https://github.com/wener-tiobe) (@wener-tiobe) - -### New: CPD support for Julia - -Thanks to a contribution, CPD now supports the Julia language. It is shipped -in the new module `pmd-julia`. - -Contributors: [Wener](https://github.com/wener-tiobe) (@wener-tiobe) - -### New: CPD support for TypeScript - -Thanks to a contribution, CPD now supports the TypeScript language. It is shipped -with the rest of the JavaScript support in the module `pmd-javascript`. - -Contributors: [Paul Guyot](https://github.com/pguyot) (@pguyot) - -### New: Java 21 and 22 Support - -This release of PMD brings support for Java 21 and 22. There are the following new standard language features, -that are supported now: - -* [JEP 456: Unnamed Variables & Patterns](https://openjdk.org/jeps/456) (Java 22) -* [JEP 440: Record Patterns](https://openjdk.org/jeps/440) (Java 21) -* [JEP 441: Pattern Matching for switch](https://openjdk.org/jeps/441) (Java 21) - -PMD also supports the following preview language features: - -* [JEP 447: Statements before super(...) (Preview)](https://openjdk.org/jeps/447) (Java 22) -* [JEP 459: String Templates (Second Preview)](https://openjdk.org/jeps/459) (Java 21 and 22) -* [JEP 463: Implicitly Declared Classes and Instance Main Methods (Second Preview)](https://openjdk.org/jeps/463) (Java 21 and 22) - -In order to analyze a project with PMD that uses these preview language features, -you'll need to enable it via the environment variable `PMD_JAVA_OPTS` and select the new language -version `22-preview`: - - export PMD_JAVA_OPTS=--enable-preview - pmd check --use-version java-22-preview ... - -Note: Support for Java 19 and Java 20 preview language features have been removed. The versions "19-preview" and -"20-preview" are no longer available. - -### New: Kotlin support - -PMD now supports Kotlin as an additional language for analyzing source code. It is based on -the official kotlin Antlr grammar for Kotlin 1.8. Java-based rules and XPath-based rules are supported. - -We are shipping the following rules: - -* [`FunctionNameTooShort`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_kotlin_bestpractices.html#functionnametooshort) finds functions with a too - short name. -* [`OverrideBothEqualsAndHashcode`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_kotlin_errorprone.html#overridebothequalsandhashcode) finds classes with only - either `equals` or `hashCode` overridden, but not both. This leads to unexpected behavior once instances - of such classes are used in collections (Lists, HashMaps, ...). - -Contributors: [Jeroen Borgers](https://github.com/jborgers) (@jborgers), -[Peter Paul Bakker](https://github.com/stokpop) (@stokpop) - -### New: Swift support - -Given the full Antlr support, PMD now fully supports Swift for creating rules. Previously only CPD was supported. - -Note: There is only limited support for newer Swift language features in the parser, e.g. Swift 5.9 (Macro Expansions) -are supported, but other features are not. - -We are pleased to announce we are shipping a number of rules starting with PMD 7. - -* [`ForceCast`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_errorprone.html#forcecast) flags all force casts, making sure you are - defensively considering all types. Having the application crash shouldn't be an option. -* [`ForceTry`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_errorprone.html#forcetry) flags all force tries, making sure you are - defensively handling exceptions. Having the application crash shouldn't be an option. -* [`ProhibitedInterfaceBuilder`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_bestpractices.html#prohibitedinterfacebuilder) flags any usage of interface - builder. Interface builder files are prone to merge conflicts, and are impossible to code review, so larger - teams usually try to avoid it or reduce its usage. -* [`UnavailableFunction`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_bestpractices.html#unavailablefunction) flags any function throwing - a `fatalError` not marked as `@available(*, unavailable)` to ensure no calls are actually performed in - the codebase. - -Contributors: [Lucas Soncini](https://github.com/lsoncini) (@lsoncini), -[Matías Fraga](https://github.com/matifraga) (@matifraga), -[Tomás De Lucca](https://github.com/tomidelucca) (@tomidelucca) - -### Changed: Apex Support: Replaced Jorje with fully open source front-end - -When PMD added Apex support with version 5.5.0, it utilized the Apex Jorje library to parse Apex source -and generate an AST. This library is however a binary-blob provided as part of the -[Salesforce Extensions for VS Code](https://github.com/forcedotcom/salesforcedx-vscode), and it is closed-source. - -This causes problems, if binary blobs are not allowed by e.g. a company-wide policy. In that case, the Jorje -library prevented that PMD Apex could be used at all. - -Also having access to the source code, enhancements and modifications are easier to do. - -Under the hood, we use two open source libraries instead: - -* [apex-parser](https://github.com/apex-dev-tools/apex-parser) originally by - [Kevin Jones](https://github.com/nawforce) (@nawforce). - This project provides the grammar for a ANTLR based parser. -* [Summit-AST](https://github.com/google/summit-ast) by [Google](https://github.com/google) (@google) - This project translates the ANTLR parse tree into an AST, that is similar to the AST Jorje provided. - Note: This is not an official Google product. - -Although the parsers is completely switched, there are only little known changes to the AST. -These are documented in the [Migration Guide for PMD 7: Apex AST](pmd_userdocs_migrating_to_pmd7.html#apex-ast). -With the new Apex parser, the new language constructs like -[User Mode Database Operations](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_enforce_usermode.htm) -and the new [Null Coalescing Operator `??`](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_NullCoalescingOperator.htm) -can be parsed now. PMD should be able to parse Apex code up to version 60.0 (Spring '24). - -See [#3766](https://github.com/pmd/pmd/issues/3766) for details. - -Contributors: [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google), -[Edward Klimoshenko](https://github.com/eklimo) (@eklimo) - -### Changed: CPP can now ignore identifiers in sequences (CPD) - -* New command line option for CPD: `--ignore-sequences`. -* This option is used for CPP only: with the already existing option `--ignore-literal-sequences`, only - literals were ignored. The new option additionally ignores identifiers as well in sequences. -* See [PR #4470](https://github.com/pmd/pmd/pull/4470) for details. - -### Changed: Groovy Support (CPD) - -* We now support parsing all Groovy features from Groovy 3 and 4. -* We now support [suppression](pmd_userdocs_cpd.html#suppression) through `CPD-ON`/`CPD-OFF` comment pairs. -* See [PR #4726](https://github.com/pmd/pmd/pull/4726) for details. - -### Changed: HTML support - -Support for HTML was introduced in PMD 6.55.0 as an experimental feature. With PMD 7.0.0 this -is now considered stable. - -### Changed: JavaScript support - -The JS specific parser options have been removed. The parser now always retains comments and uses version ES6. -The language module registers a couple of different versions. The latest version, which supports ES6 and also some -new constructs (see [Rhino](https://github.com/mozilla/rhino)), is the default. This should be fine for most -use cases. - -### Changed: Language versions - -We revisited the versions that were defined by each language module. Now many more versions are defined for each -language. In general, you can expect that PMD can parse all these different versions. There might be situations -where this fails and this can be considered a bug. Usually the latest version is selected as the default -language version. - -The language versions can be used to mark rules to be useful only for a specific language version via -the `minimumLanguageVersion` and `maximumLanguageVersion` attributes. While this feature is currently only used by -the Java module, listing all possible versions enables other languages as well to use this feature. - -Related issue: [[core] Explicitly name all language versions (#4120)](https://github.com/pmd/pmd/issues/4120) - -### Changed: Rule properties - -* The old deprecated classes like `IntProperty` and `StringProperty` have been removed. Please use - PropertyFactory to create properties. -* All properties which accept multiple values now use a comma (`,`) as a delimiter. The previous default was a - pipe character (`|`). The delimiter is not configurable anymore. If needed, the comma can be escaped - with a backslash. -* The `min` and `max` attributes in property definitions in the XML are now optional and can appear separately - or be omitted. - -### Changed: Velocity Template Language (VTL) - -The module was named just "vm" which was not a good name. Its module name, language id and -package names have been renamed to "velocity". - -If you import rules, you also need to adjust the paths, e.g. - -* `category/vm/...` ➡️ `category/velocity/...` - -### Changed: Visualforce - -There was an inconsistency between the naming of the maven module and the language id. The language id -used the abbreviation "vf", while the maven module used the longer name "visualforce". This has been -solved by renaming the language module to its full name "visualforce". The java packages have -been renamed as well. - -If you import rules, you also need to adjust the paths, e.g. - -* `category/vf/security.xml` ➡️ `category/visualforce/security.xml` - -## 🌟 New and changed rules - -### New Rules - -**Apex** -* [`OperationWithHighCostInLoop`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_performance.html#operationwithhighcostinloop) finds Schema class methods called in a loop, which is a - potential performance issue. -* [`UnusedMethod`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#unusedmethod) finds unused methods in your code. - -**Java** -* [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) reports boxing and unboxing conversions that may be made implicit. -* [`UseExplicitTypes`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#useexplicittypes) reports usages of `var` keyword, which was introduced with Java 10. - -**Kotlin** -* [`FunctionNameTooShort`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_kotlin_bestpractices.html#functionnametooshort) finds functions with a too short name. -* [`OverrideBothEqualsAndHashcode`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_kotlin_errorprone.html#overridebothequalsandhashcode) finds classes with only - either `equals` or `hashCode` overridden, but not both. This leads to unexpected behavior once instances - of such classes are used in collections (Lists, HashMaps, ...). - -**Swift** -* [`ForceCast`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_errorprone.html#forcecast) flags all force casts, making sure you are - defensively considering all types. Having the application crash shouldn't be an option. -* [`ForceTry`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_errorprone.html#forcetry) flags all force tries, making sure you are - defensively handling exceptions. Having the application crash shouldn't be an option. -* [`ProhibitedInterfaceBuilder`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_bestpractices.html#prohibitedinterfacebuilder) flags any usage of interface - builder. Interface builder files are prone to merge conflicts, and are impossible to code review, so larger - teams usually try to avoid it or reduce its usage. -* [`UnavailableFunction`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_bestpractices.html#unavailablefunction) flags any function throwing - a `fatalError` not marked as `@available(*, unavailable)` to ensure no calls are actually performed in - the codebase. - -**XML** -* [`MissingEncoding`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_xml_bestpractices.html#missingencoding) finds XML files without explicit encoding. - -### Changed Rules - -**General changes** - -* All statistical rules (like ExcessiveClassLength, ExcessiveParameterList) have been simplified and unified. - The properties `topscore` and `sigma` have been removed. The property `minimum` is still there, however the type is not - a decimal number anymore but has been changed to an integer. This affects rules in the languages Apex, Java, PLSQL - and Velocity Template Language (velocity): - * Apex: [`ExcessiveClassLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#excessiveclasslength), [`ExcessiveParameterList`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#excessiveparameterlist), - [`ExcessivePublicCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#excessivepubliccount), [`NcssConstructorCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#ncssconstructorcount), - [`NcssMethodCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#ncssmethodcount), [`NcssTypeCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#ncsstypecount) - * Java: [`ExcessiveImports`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#excessiveimports), [`ExcessiveParameterList`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#excessiveparameterlist), - [`ExcessivePublicCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#excessivepubliccount), [`SwitchDensity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#switchdensity) - * PLSQL: [`ExcessiveMethodLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessivemethodlength), [`ExcessiveObjectLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessiveobjectlength), - [`ExcessivePackageBodyLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessivepackagebodylength), [`ExcessivePackageSpecificationLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessivepackagespecificationlength), - [`ExcessiveParameterList`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessiveparameterlist), [`ExcessiveTypeLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessivetypelength), - [`NcssMethodCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#ncssmethodcount), [`NcssObjectCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#ncssobjectcount), - [`NPathComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#npathcomplexity) - * Velocity: [`ExcessiveTemplateLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_velocity_design.html#excessivetemplatelength) - -* The general property `violationSuppressXPath` which is available for all rules to - [suppress warnings](pmd_userdocs_suppressing_warnings.html) now uses XPath version 3.1 by default. - This version of the XPath language is mostly identical to XPath 2.0. In PMD 6, XPath 1.0 has been used. - If you upgrade from PMD 6, you need to verify your `violationSuppressXPath` properties. - -**Apex General changes** - -* The properties `cc_categories`, `cc_remediation_points_multiplier`, `cc_block_highlighting` have been removed - from all rules. These properties have been deprecated since PMD 6.13.0. - See [issue #1648](https://github.com/pmd/pmd/issues/1648) for more details. - -**Apex Codestyle** - -* [`MethodNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#methodnamingconventions): The deprecated rule property `skipTestMethodUnderscores` has - been removed. It was actually deprecated since PMD 6.15.0, but was not mentioned in the release notes - back then. Use the property `testPattern` instead to configure valid names for test methods. - -**Java General changes** - -* Violations reported on methods or classes previously reported the line range of the entire method - or class. With PMD 7.0.0, the reported location is now just the identifier of the method or class. - This affects various rules, e.g. [`CognitiveComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cognitivecomplexity). - - The report location is controlled by the overrides of the method Node#getReportLocation - in different node types. - - See [issue #4439](https://github.com/pmd/pmd/issues/4439) and [issue #730](https://github.com/pmd/pmd/issues/730) - for more details. - -**Java Best Practices** - -* [`ArrayIsStoredDirectly`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#arrayisstoreddirectly): Violations are now reported on the assignment and not - anymore on the formal parameter. The reported line numbers will probably move. -* [`AvoidReassigningLoopVariables`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#avoidreassigningloopvariables): This rule might not report anymore all - reassignments of the control variable in for-loops when the property `forReassign` is set to `skip`. - See [issue #4500](https://github.com/pmd/pmd/issues/4500) for more details. -* [`LooseCoupling`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#loosecoupling): The rule has a new property to allow some types to be coupled - to (`allowedTypes`). -* [`UnusedLocalVariable`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#unusedlocalvariable): This rule has some important false-negatives fixed - and finds many more cases now. For details see issues [#2130](https://github.com/pmd/pmd/issues/2130), - [#4516](https://github.com/pmd/pmd/issues/4516), and [#4517](https://github.com/pmd/pmd/issues/4517). - -**Java Codestyle** - -* [`MethodNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodnamingconventions): The property `checkNativeMethods` has been removed. The - property was deprecated since PMD 6.3.0. Use the property `nativePattern` to control whether native methods - should be considered or not. -* [`ShortVariable`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#shortvariable): This rule now also reports short enum constant names. -* [`UseDiamondOperator`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#usediamondoperator): The property `java7Compatibility` has been removed. The rule now - handles Java 7 properly without a property. -* [`UnnecessaryFullyQualifiedName`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname): The rule has two new properties, - to selectively disable reporting on static field and method qualifiers. The rule also has been improved - to be more precise. -* [`UselessParentheses`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#uselessparentheses): The rule has two new properties which control how strict - the rule should be applied. With `ignoreClarifying` (default: true) parentheses that are strictly speaking - not necessary are allowed, if they separate expressions of different precedence. - The other property `ignoreBalancing` (default: true) is similar, in that it allows parentheses that help - reading and understanding the expressions. -* [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement): The rule has a new property to allow empty blocks when - they contain a comment (`allowCommentedBlocks`). - -**Java Design** - -* [`CyclomaticComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cyclomaticcomplexity): The property `reportLevel` has been removed. The property was - deprecated since PMD 6.0.0. The report level can now be configured separated for classes and methods using - `classReportLevel` and `methodReportLevel` instead. -* [`ImmutableField`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#immutablefield): The property `ignoredAnnotations` has been removed. The property was - deprecated since PMD 6.52.0. -* [`LawOfDemeter`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#lawofdemeter): The rule has a new property `trustRadius`. This defines the maximum degree - of trusted data. The default of 1 is the most restrictive. -* [`NPathComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#npathcomplexity): The property `minimum` has been removed. It was deprecated since PMD 6.0.0. - Use the property `reportLevel` instead. -* [`SingularField`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#singularfield): The properties `checkInnerClasses` and `disallowNotAssignment` have been removed. - The rule is now more precise and will check these cases properly. -* [`UseUtilityClass`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#useutilityclass): The property `ignoredAnnotations` has been removed. - -**Java Documentation** - -* [`CommentContent`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_documentation.html#commentcontent): The properties `caseSensitive` and `disallowedTerms` are removed. The - new property `forbiddenRegex` can be used now to define the disallowed terms with a single regular - expression. -* [`CommentRequired`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_documentation.html#commentrequired): - * Overridden methods are now detected even without the `@Override` - annotation. This is relevant for the property `methodWithOverrideCommentRequirement`. - See also [pull request #3757](https://github.com/pmd/pmd/pull/3757). - * Elements in annotation types are now detected as well. This might lead to an increased number of violations - for missing public method comments. - * The deprecated property `headerCommentRequirement` has been removed. Use the property `classCommentRequirement` - instead. -* [`CommentSize`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_documentation.html#commentsize): When determining the line-length of a comment, the leading comment - prefix markers (e.g. `*` or `//`) are ignored and don't add up to the line-length. - See also [pull request #4369](https://github.com/pmd/pmd/pull/4369). - -**Java Error Prone** - -* [`AvoidDuplicateLiterals`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#avoidduplicateliterals): The property `exceptionfile` has been removed. The property was - deprecated since PMD 6.10.0. Use the property `exceptionList` instead. -* [`DontImportSun`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#dontimportsun): `sun.misc.Signal` is not special-cased anymore. -* [`EmptyCatchBlock`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#emptycatchblock): `CloneNotSupportedException` and `InterruptedException` are not - special-cased anymore. Rename the exception parameter to `ignored` to ignore them. -* [`ImplicitSwitchFallThrough`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#implicitswitchfallthrough): Violations are now reported on the case statements - rather than on the switch statements. This is more accurate but might result in more violations now. -* [`NonSerializableClass`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#nonserializableclass): The deprecated property `prefix` has been removed - without replacement. In a serializable class all fields have to be serializable regardless of the name. - -### Deprecated Rules - -In PMD 7.0.0, there are no deprecated rules. - -### Removed Rules - -The following previously deprecated rules have been finally removed: - -**Apex** - -* performance.xml/AvoidSoqlInLoops (deleted) ➡️ use [`OperationWithLimitsInLoop`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_performance.html#operationwithlimitsinloop) -* performance.xml/AvoidSoslInLoops (deleted) ➡️ use [`OperationWithLimitsInLoop`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_performance.html#operationwithlimitsinloop) -* performance.xml/AvoidDmlStatementsInLoops (deleted) ➡️ use [`OperationWithLimitsInLoop`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_performance.html#operationwithlimitsinloop) -* codestyle.xml/VariableNamingConventions (deleted) ➡️ use [`FieldNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#fieldnamingconventions), - [`FormalParameterNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#formalparameternamingconventions), [`LocalVariableNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#localvariablenamingconventions), - or [`PropertyNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#propertynamingconventions) -* security.xml/ApexCSRF (deleted) ➡️ use [`ApexCSRF`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_errorprone.html#apexcsrf) - -**Java** - -* codestyle.xml/AbstractNaming (deleted) ➡️ use [`ClassNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#classnamingconventions) -* codestyle.xml/AvoidFinalLocalVariable (deleted) ➡️ not replaced -* codestyle.xml/AvoidPrefixingMethodParameters (deleted) ➡️ use [`FormalParameterNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#formalparameternamingconventions) -* performance.xml/AvoidUsingShortType (deleted) ➡️ not replaced -* errorprone.xml/BadComparison (deleted) ➡️ use [`ComparisonWithNaN`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#comparisonwithnan) -* errorprone.xml/BeanMembersShouldSerialize (deleted) ➡️ use [`NonSerializableClass`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#nonserializableclass) -* performance.xml/BooleanInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) - and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) -* performance.xml/ByteInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) - and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) -* errorprone.xml/CloneThrowsCloneNotSupportedException (deleted) ➡️ not replaced -* errorprone.xml/DataflowAnomalyAnalysis (deleted) ➡️ use [`UnusedAssignment`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#unusedassignment) -* codestyle.xml/DefaultPackage (deleted) ➡️ use [`CommentDefaultAccessModifier`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#commentdefaultaccessmodifier) -* errorprone.xml/DoNotCallSystemExit (deleted) ➡️ use [`DoNotTerminateVM`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#donotterminatevm) -* codestyle.xml/DontImportJavaLang (deleted) ➡️ use [`UnnecessaryImport`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport) -* codestyle.xml/DuplicateImports (deleted) ➡️ use [`UnnecessaryImport`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport) -* errorprone.xml/EmptyFinallyBlock (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) -* errorprone.xml/EmptyIfStmt (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) -* errorprone.xml/EmptyInitializer (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) -* errorprone.xml/EmptyStatementBlock (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) -* errorprone.xml/EmptyStatementNotInLoop (deleted) ➡️ use [`UnnecessarySemicolon`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessarysemicolon) -* errorprone.xml/EmptySwitchStatements (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) -* errorprone.xml/EmptySynchronizedBlock (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) -* errorprone.xml/EmptyTryBlock (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) -* errorprone.xml/EmptyWhileStmt (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) -* design.xml/ExcessiveClassLength (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) -* design.xml/ExcessiveMethodLength (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) -* codestyle.xml/ForLoopsMustUseBraces (deleted) ➡️ use [`ControlStatementBraces`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#controlstatementbraces) -* codestyle.xml/IfElseStmtsMustUseBraces (deleted) ➡️ use [`ControlStatementBraces`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#controlstatementbraces) -* codestyle.xml/IfStmtsMustUseBraces (deleted) ➡️ use [`ControlStatementBraces`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#controlstatementbraces) -* errorprone.xml/ImportFromSamePackage (deleted) ➡️ use [`UnnecessaryImport`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport) -* performance.xml/IntegerInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) - and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) -* errorprone.xml/InvalidSlf4jMessageFormat (deleted) ➡️ use [`InvalidLogMessageFormat`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#invalidlogmessageformat) -* errorprone.xml/LoggerIsNotStaticFinal (deleted) ➡️ use [`ProperLogger`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#properlogger) -* performance.xml/LongInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) - and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) -* codestyle.xml/MIsLeadingVariableName (deleted) ➡️ use [`FieldNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#fieldnamingconventions), - [`FormalParameterNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#formalparameternamingconventions), - or [`LocalVariableNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#localvariablenamingconventions) -* errorprone.xml/MissingBreakInSwitch (deleted) ➡️ use [`ImplicitSwitchFallThrough`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#implicitswitchfallthrough) -* design.xml/ModifiedCyclomaticComplexity (deleted) ➡️ use [`CyclomaticComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cyclomaticcomplexity) -* design.xml/NcssConstructorCount (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) -* design.xml/NcssMethodCount (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) -* design.xml/NcssTypeCount (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) -* bestpractices.xml/PositionLiteralsFirstInCaseInsensitiveComparisons (deleted) ➡️ - use [`LiteralsFirstInComparisons`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#literalsfirstincomparisons) -* bestpractices.xml/PositionLiteralsFirstInComparisons (deleted) ➡️ - use [`LiteralsFirstInComparisons`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#literalsfirstincomparisons) -* errorprone.xml/ReturnEmptyArrayRatherThanNull (deleted) ➡️ - use [`ReturnEmptyCollectionRatherThanNull`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull) -* performance.xml/ShortInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) - and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) -* design.xml/SimplifyBooleanAssertion (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) -* performance.xml/SimplifyStartsWith (deleted) ➡️ not replaced -* design.xml/StdCyclomaticComplexity (deleted) ➡️ use [`CyclomaticComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cyclomaticcomplexity) -* codestyle.xml/SuspiciousConstantFieldName (deleted) ➡️ use [`FieldNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#fieldnamingconventions) -* performance.xml/UnnecessaryWrapperObjectCreation (deleted) ➡️ use the new rule [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) -* multithreading.xml/UnsynchronizedStaticDateFormatter (deleted) ➡️ use [`UnsynchronizedStaticFormatter`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_multithreading.html#unsynchronizedstaticformatter) -* bestpractices.xml/UnusedImports (deleted) ➡️ use [`UnnecessaryImport`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport) -* bestpractices.xml/UseAssertEqualsInsteadOfAssertTrue (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) -* bestpractices.xml/UseAssertNullInsteadOfAssertEquals (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) -* bestpractices.xml/UseAssertSameInsteadOfAssertEquals (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) -* bestpractices.xml/UseAssertTrueInsteadOfAssertEquals (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) -* codestyle.xml/VariableNamingConventions (deleted) ➡️ use [`FieldNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#fieldnamingconventions), - [`FormalParameterNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#formalparameternamingconventions), or [`LocalVariableNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#localvariablenamingconventions) -* codestyle.xml/WhileLoopsMustUseBraces (deleted) ➡️ use [`ControlStatementBraces`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#controlstatementbraces) - -### Removed rulesets - -The following previously deprecated rulesets have been removed. These were the left-over rulesets from PMD 5. -The rules have been moved into categories with PMD 6. - -* rulesets/apex/apexunit.xml -* rulesets/apex/braces.xml -* rulesets/apex/complexity.xml -* rulesets/apex/empty.xml -* rulesets/apex/metrics.xml -* rulesets/apex/performance.xml -* rulesets/apex/ruleset.xml -* rulesets/apex/securty.xml -* rulesets/apex/style.xml -* rulesets/java/android.xml -* rulesets/java/basic.xml -* rulesets/java/clone.xml -* rulesets/java/codesize.xml -* rulesets/java/comments.xml -* rulesets/java/controversial.xml -* rulesets/java/coupling.xml -* rulesets/java/design.xml -* rulesets/java/empty.xml -* rulesets/java/finalizers.xml -* rulesets/java/imports.xml -* rulesets/java/j2ee.xml -* rulesets/java/javabeans.xml -* rulesets/java/junit.xml -* rulesets/java/logging-jakarta-commons.xml -* rulesets/java/logging-java.xml -* rulesets/java/metrics.xml -* rulesets/java/migrating.xml -* rulesets/java/migrating_to_13.xml -* rulesets/java/migrating_to_14.xml -* rulesets/java/migrating_to_15.xml -* rulesets/java/migrating_to_junit4.xml -* rulesets/java/naming.xml -* rulesets/java/optimizations.xml -* rulesets/java/strictexception.xml -* rulesets/java/strings.xml -* rulesets/java/sunsecure.xml -* rulesets/java/typeresolution.xml -* rulesets/java/unnecessary.xml -* rulesets/java/unusedcode.xml -* rulesets/ecmascript/basic.xml -* rulesets/ecmascript/braces.xml -* rulesets/ecmascript/controversial.xml -* rulesets/ecmascript/unnecessary.xml -* rulesets/jsp/basic.xml -* rulesets/jsp/basic-jsf.xml -* rulesets/plsql/codesize.xml -* rulesets/plsql/dates.xml -* rulesets/plsql/strictsyntax.xml -* rulesets/plsql/TomKytesDespair.xml -* rulesets/vf/security.xml -* rulesets/vm/basic.xml -* rulesets/pom/basic.xml -* rulesets/xml/basic.xml -* rulesets/xsl/xpath.xml -* rulesets/releases/* - -## 💥 Compatibility and Migration Notes - - - -### For endusers - -* PMD 7 requires Java 8 or above to execute. -* CLI changed: Custom scripts need to be updated (`run.sh pmd ...` ➡️ `pmd check ...`, `run.sh cpd ...` ➡️ `pmd cpd ...`). -* Java module revamped: Custom rules need to be updated. -* Removed rules: Custom rulesets need to be reviewed. See above for a list of new and removed rules. -* XPath 1.0 and 2.0 support is removed, `violationSuppressXPath` now requires XPath 3.1: Custom rulesets need - to be reviewed. -* Custom rules using rulechains: Need to override AbstractRule#buildTargetSelector - using RuleTargetSelector#forTypes. -* The asset filenames of PMD on [GitHub Releases](https://github.com/pmd/pmd/releases) are - now `pmd-dist--bin.zip`, `pmd-dist--src.zip` and `pmd-dist--doc.zip`. - Keep that in mind, if you have an automated download script. - - The structure inside the ZIP files stay the same, e.g. we still provide inside the binary distribution - ZIP file the base directory `pmd-bin-`. -* For maven-pmd-plugin usage, see [Using PMD 7 with maven-pmd-plugin](pmd_userdocs_tools_maven.html#using-pmd-7-with-maven-pmd-plugin). -* For gradle users, at least gradle 8.6 is required for PMD 7. - -### For integrators - -* PMD 7 is a major release where many things have been moved or rewritten. -* All integrators will require some level of change to adapt to the change in the API. -* For more details look at the deprecations notes of the past PMD 6 releases. These are collected below - under [API Changes](#api-changes). -* The PMD Ant tasks, which were previously in the module `pmd-core` has been moved into its own module `pmd-ant`, - which needs to be added explicitly now as an additional dependency. -* The CLI classes have also been moved out of `pmd-core` into its own module `pmd-cli`. The old entry point, the - main class PMD is gone. - -## 🚨 API - -The API of PMD has been growing over the years and needed some cleanup. The goal is, to -have a clear separation between a well-defined API and the implementation, which is internal. -This should help us in future development. - -This however entails some incompatibilities and deprecations. - -See [ADR 3 - API evolution principles](pmd_projectdocs_decisions_adr_3.html) and -[API changes](#api-changes) below. - -### Small Changes and cleanups - -* [#1648](https://github.com/pmd/pmd/issues/1648): \[apex,vf] Remove CodeClimate dependency - [Robert Sösemann](https://github.com/rsoesemann) - Properties "cc_categories", "cc_remediation_points_multiplier", "cc_block_highlighting" can no longer be overridden in rulesets. - They were deprecated without replacement. - -* The old GUI applications accessible through `run.sh designerold` and `run.sh bgastviewer` - (and corresponding Batch scripts) have been removed from the PMD distribution. Please use the newer rule designer - with `pmd designer`. The corresponding classes in packages `java.net.sourceforge.pmd.util.viewer` and - `java.net.sourceforge.pmd.util.designer` have all been removed. - -* All API related to XPath support has been moved to the package net.sourceforge.pmd.lang.rule.xpath. - This includes API that was previously dispersed over `net.sourceforge.pmd.lang`, `net.sourceforge.pmd.lang.ast.xpath`, - `net.sourceforge.pmd.lang.rule.xpath`, `net.sourceforge.pmd.lang.rule`, and various language-specific packages - (which were made internal). - -* The implementation of the Ant integration has been moved from the module `pmd-core` to a new module `pmd-ant`. - This involves classes in package net.sourceforge.pmd.ant. The ant CPDTask class `net.sourceforge.pmd.cpd.CPDTask` - has been moved into the same package net.sourceforge.pmd.ant. You'll need to update your taskdef entries in your - build.xml files with the FQCN net.sourceforge.pmd.ant.CPDTask if you use it anywhere. - -* Utility classes in net.sourceforge.pmd.util, that have previously marked as `@InternalApi` have been finally - moved to an internal sub package and are now longer available. - This includes ClasspathClassLoader, FileFinder, FileUtil, and IOUtil. - -* The following utility classes in net.sourceforge.pmd.util are now considered public API: - * AssertionUtil - * CollectionUtil - * ContextedAssertionError - * ContextedStackOverflowError - * GraphUtil - * IteratorUtil - * StringUtil - -* Moved the two classes AntlrCpdLexer and JavaccCpdLexer from - `internal` package into package net.sourceforge.pmd.cpd.impl. These two classes are part of the API and - are base classes for CPD language implementations. Since 7.0.0-rc2. - Note: These two classes have been previously called "AntlrTokenizer" and "JavaCCTokenizer". -* `AntlrBaseRule` is gone in favor of AbstractVisitorRule. Since 7.0.0-rc2. -* The classes `net.sourceforge.pmd.lang.kotlin.ast.KotlinInnerNode` and - `net.sourceforge.pmd.lang.swift.ast.SwiftInnerNode` are package-private now. Since 7.0.0-rc2. - -### XPath 3.1 support - -Support for XPath versions 1.0, 1.0-compatibility, 2.0 was removed. The default -(and only) supported XPath version is now XPath 3.1. This version of the XPath language is mostly identical to -XPath 2.0. - -Notable changes: -* The deprecated support for sequence-valued attributes is removed. Sequence-valued properties are still supported. -* Refer to [the Saxonica documentation](https://www.saxonica.com/html/documentation/expressions/xpath31new.html) for - an introduction to new features in XPath 3.1. - -### Node stream API for AST traversal - -This version includes a powerful API to navigate trees, similar in usage to the Java 8 Stream API: -```java -node.descendants(ASTMethodCall.class) - .filter(m -> "toString".equals(m.getMethodName())) - .map(m -> m.getQualifier()) - .filter(q -> TypeTestUtil.isA(String.class, q)) - .foreach(System.out::println); -``` - -A pipeline like shown here traverses the tree lazily, which is more efficient than traversing eagerly to put all -descendants in a list. It is also much easier to change than the old imperative way. - -To make this API as accessible as possible, the Node interface has been fitted with new -methods producing node streams. Those methods replace previous tree traversal methods like `Node#findDescendantsOfType`. -In all cases, they should be more efficient and more convenient. - -See NodeStream for more details. - -Contributors: [Clément Fournier](https://github.com/oowekyala) (@oowekyala) - -### Metrics framework - -The metrics framework has been made simpler and more general. - -* The metric interface takes an additional type parameter, representing the result type of the metric. This is - usually `Integer` or `Double`. It avoids widening the result to a `double` just to narrow it down. - - This makes it so, that `Double.NaN` is not an appropriate sentinel value to represent "not supported" anymore. - Instead, `computeFor` may return `null` in that case (or a garbage value). The value `null` may have caused - problems with the narrowing casts, which through unboxing, might have thrown an NPE. But when we deprecated - the language-specific metrics façades to replace them with the generic MetricsUtil, - we took care of making - the new methods throw an exception if the metric cannot be computed on the parameter. This forces you to guard - calls to MetricsUtil#computeMetric (and other overloads) - with something like `if (metric.supports(node))`. If you're following - this pattern, then you won't observe the undefined behavior. - -* The `MetricKey` interface is not so useful and has been merged into the Metric - interface and removed. So the Metric interface has the new method - displayName. - -* The framework is not tied to at most 2 node types per language anymore. Previously those were nodes for - classes and for methods/constructors. Instead, many metrics support more node types. For example, NCSS can - be computed on any code block. - - For that reason, keeping around a hard distinction between "class metrics" and "operation metrics" is not - useful. So in the Java framework for example, we removed the interfaces `JavaClassMetric`, `JavaOperationMetric`, - abstract classes for those, `JavaClassMetricKey`, and `JavaOperationMetricKey`. Metric constants are now all - inside the JavaMetrics utility class. The same was done in the Apex framework. - - We don't really need abstract classes for metrics now. So `AbstractMetric` is also removed from pmd-core. - There is a factory method on the Metric interface to create a metric easily. - -* This makes it so, that LanguageMetricsProvider does not need type parameters. - It can just return a `Set>` to list available metrics. - -* Signatures, their implementations, and the interface `SignedNode` have been - removed. Node streams allow replacing their usages very easily. - -### Testing framework - -* PMD 7 has been upgraded to use JUnit 5 only. That means, that JUnit4 related classes have been removed, namely - * `net.sourceforge.pmd.testframework.PMDTestRunner` - * `net.sourceforge.pmd.testframework.RuleTestRunner` - * `net.sourceforge.pmd.testframework.TestDescriptor` -* Rule tests, that use SimpleAggregatorTst or - PmdRuleTst work as before without change, but use - now JUnit5 under the hood. If you added additional JUnit4 tests to your rule test classes, then you'll - need to upgrade them to use JUnit5. - -### Language Lifecycle and Language Properties - -* Language modules now provide a proper lifecycle and can store global information. This enables the implementation - of multifile analysis. -* Language modules can define [custom language properties](pmd_languages_configuration.html) - which can be set via environment variables. This allows to add and use language specific configuration options - without the need to change pmd-core. - -The documentation page has been updated: -[Adding a new language with JavaCC](pmd_devdocs_major_adding_new_language_javacc.html) -and [Adding a new language with ANTLR](pmd_devdocs_major_adding_new_language_antlr.html) - -Related issue: [[core] Language lifecycle (#3782)](https://github.com/pmd/pmd/issues/3782) - -### Rule properties - -* The old deprecated classes like `IntProperty` and `StringProperty` have been removed. Please use - PropertyFactory to create properties. -* All properties which accept multiple values now use a comma (`,`) as a delimiter. The previous default was a - pipe character (`|`). The delimiter is not configurable anymore. If needed, the comma can be escaped - with a backslash. -* The `min` and `max` attributes in property definitions in the XML are now optional and can appear separately - or be omitted. - -### New Programmatic API for CPD - -This release introduces a new programmatic API to replace the old class CPD. The new API uses a similar model to -PmdAnalysis and is called CpdAnalysis. Programmatic execution of CPD should now be -done with a CPDConfiguration and a CpdAnalysis, for instance: - -```java -CPDConfiguration config = new CPDConfiguration(); -config.setMinimumTileSize(100); -config.setOnlyRecognizeLanguage(config.getLanguageRegistry().getLanguageById("java")); -config.setSourceEncoding(StandardCharsets.UTF_8); -config.addInputPath(Path.of("src/main/java") - -config.setIgnoreAnnotations(true); -config.setIgnoreLiterals(false); - -config.setRendererName("text"); - -try (CpdAnalysis cpd = CpdAnalysis.create(config)) { - // note: don't use `config` once a CpdAnalysis has been created. - // optional: add more files - cpd.files().addFile(Paths.get("src", "main", "more-java", "ExtraSource.java")); - - cpd.performAnalysis(); -} -``` - -CPD can of course still be called via command line or using the module `pmd-cli`. But for tight integration -this new programmatic API is recommended. - -See [PR #4397](https://github.com/pmd/pmd/pull/4397) for details. - -### API changes - -#### 7.0.0 - -These are the changes between 7.0.0-rc4 and final 7.0.0. - -**pmd-java** - -* Support for Java 20 preview language features have been removed. The version "20-preview" is no longer available. -* ASTPattern, ASTRecordPattern, - ASTTypePattern, ASTUnnamedPattern - - method `getParenthesisDepth()` has been removed. -* ASTTemplateFragment: To get the content of the template, use now - getContent or `@Content` instead of `getImage()`/`@Image`. -* ASTUnnamedPattern is not experimental anymore. The language feature - has been standardized with Java 22. - -**New API** - -The API around TreeRenderer has been declared as stable. It was previously -experimental. It can be used via the CLI subcommand `ast-dump` or programmatically, as described -on [Creating XML dump of the AST](pmd_userdocs_extending_ast_dump.html). - -**General AST Changes to avoid `@Image`** - -See [General AST Changes to avoid @Image](pmd_userdocs_migrating_to_pmd7.html#general-ast-changes-to-avoid-image) -in the migration guide for details. - -**XPath Rules** - -* The property `version` was already deprecated and has finally been removed. Please don't define the version - property anymore in your custom XPath rules. By default, the latest XPath version will be used, which - is XPath 3.1. - -**Moved classes/consolidated packages** - -* pmd-core - * Many types have been moved from the base package `net.sourceforge.pmd` into subpackage net.sourceforge.pmd.lang.rule - * Rule - * RulePriority - * RuleSet - * `RuleSetFactory` - * RuleSetLoader - * RuleSetLoadException - * RuleSetWriter - * Many types have been moved from the base package `net.sourceforge.pmd` into subpackage net.sourceforge.pmd.reporting - * Report - * RuleContext - * RuleViolation - * ViolationSuppressor - * XPathRule has been moved into subpackage net.sourceforge.pmd.lang.rule.xpath. -* pmd-html - * `net.sourceforge.pmd.lang.html.ast.HtmlCpdLexer` moved into package `cpd`: HtmlCpdLexer. -* pmd-lang-test: All types have been moved under the new base package net.sourceforge.pmd.lang.test: - * AbstractMetricTestRule (moved from `net.sourceforge.pmd.test.AbstractMetricTestRule`) - * BaseTextComparisonTest (moved from `net.sourceforge.pmd.test.BaseTextComparisonTest`) - * CpdTextComparisonTest (moved from `net.sourceforge.pmd.cpd.test.CpdTextComparisonTest`) - * BaseTreeDumpTest (moved from `net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest`) - * And many other types have been moved from `net.sourceforge.pmd.lang.ast.test` to `net.sourceforge.pmd.lang.test`. -* pmd-scala - * ScalaCpdLexer (moved from `net.sourceforge.pmd.lang.scala.cpd.ScalaCpdLexer`) - * ScalaTokenAdapter (moved from `net.sourceforge.pmd.lang.scala.cpd.ScalaTokenAdapter`) -* pmd-test - * AbstractRuleSetFactoryTest (moved from `net.sourceforge.pmd.lang.rule.AbstractRuleSetFactoryTest`) - * AbstractAntTestHelper (moved from `net.sourceforge.pmd.ant.AbstractAntTestHelper`) - * AbstractLanguageVersionTest (moved from `net.sourceforge.pmd.AbstractLanguageVersionTest`) - * PmdRuleTst (moved from `net.sourceforge.pmd.testframework.PmdRuleTst`) - * RuleTst (moved from `net.sourceforge.pmd.testframework.RuleTst`) - * SimpleAggregatorTst (moved from `net.sourceforge.pmd.testframework.SimpleAggregatorTst`) -* pmd-xml - * PomLanguageModule (moved from `net.sourceforge.pmd.lang.pom.PomLanguageModule`) - * WsdlLanguageModule (moved from `net.sourceforge.pmd.lang.wsdl.WsdlLanguageModule`) - * XslLanguageModule (moved from `net.sourceforge.pmd.lang.xsl.XslLanguageModule`) -* pmd-visualforce - * The package `net.sourceforge.pmd.lang.vf` has been renamed to net.sourceforge.pmd.lang.visualforce. - * The language id of visualforce has been changed to `visualforce` (it was previously just "vf") - * The ruleset changed: `category/vf/security.xml` ➡️ `category/visualforce/security.xml` -* pmd-velocity (renamed from pmd-vm) - * The package `net.sourceforge.pmd.lang.vm` has been renamed to net.sourceforge.pmd.lang.velocity. - * The language id of the Velocity module has been changed to `velocity` (it was previously just "vm") - * The rulesets changed: `category/vm/...` ➡️ `category/velocity/...` - * Many classes used the prefix `Vm`, e.g. `VmLanguageModule`. This has been changed to be `Vtl`: - * VtlLanguageModule - * VtlNode - * VtlParser - * VtlCpdLexer - * AbstractVtlRule - -**Internalized classes and interfaces and methods** - -The following classes/methods have been marked as @InternalApi before and are now moved into a `internal` -package or made (package) private and are _not accessible_ anymore. - -* pmd-core - * `net.sourceforge.pmd.cache.AbstractAnalysisCache` (moved to internal, now package private) - * `net.sourceforge.pmd.cache.AnalysisCache` (moved to internal) - * `net.sourceforge.pmd.cache.AnalysisCacheListener` (moved to internal) - * `net.sourceforge.pmd.cache.AnalysisResult` (moved to internal) - * `net.sourceforge.pmd.cache.CachedRuleMapper` (moved to internal, now package private) - * `net.sourceforge.pmd.cache.CachedRuleViolation` (moved to internal, now package private) - * `net.sourceforge.pmd.cache.ChecksumAware` (moved to internal) - * `net.sourceforge.pmd.cache.FileAnalysisCache` (moved to internal) - * `net.sourceforge.pmd.cache.NoopAnalysisCache` (moved to internal) - * `net.sourceforge.pmd.util.ResourceLoader` (moved to internal) - * net.sourceforge.pmd.cpd.Tokens - * Constructor is now package private. - * net.sourceforge.pmd.lang.LanguageProcessor.AnalysisTask - * Constructor is now package private. - * Method `withFiles(java.util.List)` is now package private. Note: it was not previously marked with @InternalApi. - * net.sourceforge.pmd.lang.rule.RuleTargetSelector - * Method `isRuleChain()` has been removed. - * net.sourceforge.pmd.renderers.AbstractAccumulatingRenderer - * renderFileReport - this method is now final - and can't be overridden anymore. - * net.sourceforge.pmd.reporting.Report - * Constructor as well as the methods `addRuleViolation`, `addConfigError`, `addError` are now private. - * net.sourceforge.pmd.reporting.RuleContext - * Method `getRule()` is now package private. - * Method `create(FileAnalysisListener listener, Rule rule)` has been removed. - * `net.sourceforge.pmd.rules.RuleFactory`: moved into subpackage `lang.rule` and made package private. - It has now been hidden completely from public API. - * Many types have been moved from into subpackage `lang.rule.internal`. - * `net.sourceforge.pmd.RuleSetReference` - * `net.sourceforge.pmd.RuleSetReferenceId` - * `net.sourceforge.pmd.RuleSets` - * `net.sourceforge.pmd.lang.rule.ParametricRuleViolation` is now package private and moved to `net.sourceforge.pmd.reporting.ParametricRuleViolation`. - The only public API is RuleViolation. - * net.sourceforge.pmd.lang.rule.RuleSet - * Method `applies(Rule,LanguageVersion)` is now package private. - * Method `applies(TextFile)` has been removed. - * Method `applies(FileId)` is now package private. - * net.sourceforge.pmd.lang.rule.RuleSetLoader - * Method `loadRuleSetsWithoutException(java.util.List)` is now package private. - * net.sourceforge.pmd.lang.rule.RuleSetLoadException - * All constructors are package private now. - * net.sourceforge.pmd.lang.ast.LexException - the constructor `LexException(boolean, String, int, int, String, char)` is now package private. - It is only used by JavaCC-generated token managers. - * net.sourceforge.pmd.PMDConfiguration - * Method `setAnalysisCache(AnalysisCache)` is now package private. Use setAnalysisCacheLocation instead. - * Method `getAnalysisCache()` is now package private. - * net.sourceforge.pmd.lang.document.FileCollector - * Method `newCollector(LanguageVersionDiscoverer, PmdReporter)` is now package private. - * Method `newCollector(PmdReporter)` is now package private. - * In order to create a FileCollector, use files instead. - * net.sourceforge.pmd.lang.rule.xpath.Attribute - * Method `replacementIfDeprecated()` is now package private. - * `net.sourceforge.pmd.properties.PropertyTypeId` - moved in subpackage `internal`. - * net.sourceforge.pmd.properties.PropertyDescriptor - method `getTypeId()` is now package private. -* pmd-doc - * The whole maven module `pmd-doc` is now considered internal API even though it was not declared so before. - It's used to generate the rule documentation for the built-in rules. - * All the classes have been moved into package `net.sourceforge.pmd.doc.internal`. -* pmd-ant - * net.sourceforge.pmd.ant.Formatter - * Method `getRenderer()` has been removed. - * Method `start(String)` is private now. - * Method `end(Report)` has been removed. - * Method `isNoOutputSupplied()` is now package private. - * Method `newListener(Project)` is now package private. - * net.sourceforge.pmd.ant.PMDTask - * Method `getRelativizeRoots()` has been removed. - * `net.sourceforge.pmd.ant.ReportException` is now package private. Note: It was not marked with @InternalApi before. -* pmd-apex - * net.sourceforge.pmd.lang.apex.ast.ApexNode - * Method `getNode()` has been removed. It was only deprecated before and not marked with @InternalApi. - However, it gave access to the wrapped Jorje node and was thus internal API. - * `net.sourceforge.pmd.lang.apex.ast.AbstractApexNode` - * Method `getNode()` is now package private. - * net.sourceforge.pmd.lang.apex.multifile.ApexMultifileAnalysis - * Constructor is now package private. - * `net.sourceforge.pmd.lang.apex.rule.design.AbstractNcssCountRule` (now package private) - * `net.sourceforge.pmd.lang.apex.rule.AbstractApexUnitTestRule` (moved to package `net.sourceforge.pmd.apex.rule.bestpractices`, now package private) -* pmd-java - * `net.sourceforge.pmd.lang.java.rule.AbstractIgnoredAnnotationRule` (moved to internal) - * `net.sourceforge.pmd.lang.java.types.ast.LazyTypeResolver` (moved to internal) - * net.sourceforge.pmd.lang.java.types.JMethodSig - * Method `internalApi()` has been removed. - * net.sourceforge.pmd.lang.java.types.TypeOps - * Method `isSameTypeInInference(JTypeMirror,JTypeMirror)` is now package private. -* pmd-jsp - * net.sourceforge.pmd.lang.jsp.ast.JspParser - * Method `getTokenBehavior()` has been removed. -* pmd-modelica - * net.sourceforge.pmd.lang.modelica.ast.InternalApiBridge renamed from `InternalModelicaNodeApi`. - * net.sourceforge.pmd.lang.modelica.resolver.InternalApiBridge renamed from `InternalModelicaResolverApi`. - * `net.sourceforge.pmd.lang.modelica.resolver.ModelicaSymbolFacade` has been removed. - * `net.sourceforge.pmd.lang.modelica.resolver.ResolutionContext` (moved to internal) - * `net.sourceforge.pmd.lang.modelica.resolver.ResolutionState` (moved to internal). Note: it was not previously marked with @InternalApi. - * `net.sourceforge.pmd.lang.modelica.resolver.Watchdog` (moved to internal). Note: it was not previously marked with @InternalApi. -* pmd-plsql - * `net.sourceforge.pmd.lang.plsql.rule.design.AbstractNcssCountRule` is now package private. -* pmd-scala - * net.sourceforge.pmd.lang.scala.ScalaLanguageModule - * Method `dialectOf(LanguageVersion)` has been removed. - -**Removed classes and members (previously deprecated)** - -The annotation `@DeprecatedUntil700` has been removed. - -* pmd-core - * CpdLanguageProperties. The field `DEFAULT_SKIP_BLOCKS_PATTERN` has been removed. - * BaseAntlrNode - method `joinTokenText()` has been removed. - * Node - many methods have been removed: - * `getNthParent(int)` - Use ancestors instead, e.g. `node.ancestors().get(n-1)` - * `getFirstParentOfType(Class)` - Use ancestors instead, e.g. `node.ancestors(parentType).first()` - * `getParentsOfType(Class)` - Use ancestors instead, e.g. `node.ancestors(parentType).toList()` - * `findChildrenOfType(Class)` - Use children instead, e.g. `node.children(childType).toList()` - * `findDescendantsOfType(Class)` - Use descendants instead, e.g. `node.descendants(targetType).toList()` - * `findDescendantsOfType(Class,boolean)` - Use descendants instead, e.g. `node.descendants(targetType).crossFindBoundaries(b).toList()` - * `getFirstChildOfType(Class)` - Use firstChild instead - * `getFirstDescendantOfType(Class)` - Use descendants instead, e.g. `node.descendants(targetType).first()` - * `hasDescendantOfType(Class)` - Use descendants instead, e.g. `node.descendants(targetType).nonEmpty()` - * `findChildNodesWithXPath(String)` - Use the NodeStream API instead. - * GenericNode - method `getNthParent(int)` has been removed. Use ancestors instead, e.g. `node.ancestors().get(n-1)` - * FileCollector - method `addZipFile(java.nio.file.Path)` has been removed. Use addZipFileWithContent instead - * TextDocument - method `readOnlyString(CharSequence,String,LanguageVersion)` has been removed. - Use readOnlyString instead. - * TextFile - method `dataSourceCompat(DataSource,PMDConfiguration)` has been removed. - Use TextFile directly, e.g. forPath - * XPathVersion - * `XPATH_1_0` - * `XPATH_1_0_COMPATIBILITY` - * `XPATH_2_0` - * Only XPath version 3.1 is now supported. This version of the XPath language is mostly identical to - XPath 2.0. XPath rules by default use now XPATH_3_1. - * `net.sourceforge.pmd.lang.rule.AbstractDelegateRule` removed. It has been merged with RuleReference. - * AbstractRule - the following methods have been removed: - * `deepCopyValuesTo(AbstractRule)` - use deepCopy instead. - * `addRuleChainVisit(Class)` - override buildTargetSelector in order to register nodes for rule chain visits. - * `addViolation(...)` - use addViolation instead, e.g. via `asCtx(data).addViolation(...)`. - Note: These methods were only marked as deprecated in javadoc. - * `addViolationWithMessage(...)` - use addViolationWithMessage instead, e.g. via - `asCtx(data).addViolationWithMessage(...)`. Note: These methods were only marked as deprecated in javadoc. - * RuleReference - the following methods have been removed: - * `setRuleSetReference(RuleSetReference)` - without replacement. Just construct new RuleReference instead. - * `hasOverriddenProperty(PropertyDescriptor)` - use isPropertyOverridden instead. - * XPathRule - * The constant `XPATH_DESCRIPTOR` has been made private and is not accessible anymore. - * The default constructor has been made package-private and is not accessible anymore. - * Language - method `getTerseName()` removed. Use getId instead. - * LanguageModuleBase - method `getTerseName()` removed. Use getId instead. - * LanguageRegistry - the following methods have been removed: - * `getLanguage(String)` - use getLanguageByFullName - via PMD or CPD instead. - * `findLanguageByTerseName(String)` - use getLanguageById - via PMD or CPD instead. - * `findByExtension(String)` - removed without replacement. - * LanguageVersionDiscoverer - method `getLanguagesForFile(java.io.File)` removed. - Use getLanguagesForFile instead. - * AbstractPropertySource - * field `propertyDescriptors` has been made private and is not accessible anymore. - Use getPropertyDescriptors instead. - * field `propertyValuesByDescriptor` has been made private and is not accessible anymore. - Use getPropertiesByPropertyDescriptor - or getOverriddenPropertiesByPropertyDescriptor instead. - * method `copyPropertyDescriptors()` has been removed. Use getPropertyDescriptors instead. - * method `copyPropertyValues()` has been removed. Use getPropertiesByPropertyDescriptor - or getOverriddenPropertiesByPropertyDescriptor instead. - * Reportable - the following methods have been removed. Use getReportLocation instead - * `getBeginLine()` - * `getBeginColumn()` - * `getEndLine()` - * `getEndColumn()` - * `net.sourceforge.pmd.util.datasource.DataSource` - use TextFile instead. - * `net.sourceforge.pmd.util.datasource.FileDataSource` - * `net.sourceforge.pmd.util.datasource.ReaderDataSource` - * `net.sourceforge.pmd.util.datasource.ZipDataSource` - * CollectionUtil - * method `invertedMapFrom(...)` has been removed. - * method `mapFrom(...)` has been removed. - * AbstractConfiguration - the following methods have been removed: - * `setIgnoreFilePath(String)` - use setIgnoreFilePath instead. - * `setInputFilePath(String)` - use setInputFilePath instead. - * `setInputPaths(String)` - use setInputPathList or - addInputPath instead. - * `setInputUri(String)` - use setInputUri instead. - * PMDConfiguration - the following methods have been removed - * `prependClasspath(String)` - use prependAuxClasspath instead. - * `getRuleSets()` - use getRuleSetPaths instead. - * `setRuleSets(String)` - use setRuleSets or - addRuleSet instead. - * `setReportFile(String)` - use setReportFile instead. - * `getReportFile()` - use getReportFilePath instead. - * Report - method `merge(Report)` has been removed. Use union instead. - * RuleSetLoader - method `toFactory()` has been made package private and is not accessible anymore. - * RuleViolation - the following methods have been removed: - * `getPackageName()` - use getAdditionalInfo with PACKAGE_NAME instead, e.g. `getAdditionalInfo().get(PACKAGE_NAME)`. - * `getClassName()` - use getAdditionalInfo with CLASS_NAME instead, e.g. `getAdditionalInfo().get(CLASS_NAME)`. - * `getMethodName()` - use getAdditionalInfo with METHOD_NAME instead, e.g. `getAdditionalInfo().get(METHOD_NAME)`. - * `getVariableName()` - use getAdditionalInfo with VARIABLE_NAME instead, e.g. `getAdditionalInfo().get(VARIABLE_NAME)`. -* pmd-apex - * ApexNode and ASTApexFile - * `#getApexVersion()`: In PMD 6, this method has been deprecated but was defined in the class `ApexRootNode`. - The version returned is always "Version.CURRENT", as the apex compiler integration - doesn't use additional information which Apex version actually is used. Therefore, this method can't be - used to determine the Apex version of the project that is being analyzed. - - If the current version is needed, then `Node.getTextDocument().getLanguageVersion()` can be used. This - is the version that has been selected via CLI `--use-version` parameter. - * ApexNode - * method `jjtAccept()` has been removed. - Use acceptVisitor instead. - * method `getNode()` has been removed. The underlying node is only available in AST nodes, but not in rule implementations. - * AbstractApexNode - method `getNode()` is now package private. - AST nodes still have access to the underlying Jorje node via the protected property `node`. - * `net.sourceforge.pmd.lang.apex.ast.ApexParserVisitor` - Use ApexVisitor or ApexVisitorBase instead. - * `net.sourceforge.pmd.lang.apex.ast.ApexParserVisitorAdapter` - * ASTAssignmentExpression - method `getOperator()` removed. - Use getOp instead. - * ASTBinaryExpression - method `getOperator()` removed. - Use getOp instead. - * ASTBooleanExpression - method `getOperator()` removed. - Use getOp instead. - * ASTPostfixExpression - method `getOperator()` removed. - Use getOp instead. - * ASTPrefixExpression - method `getOperator()` removed. - Use getOp instead. - * `net.sourceforge.pmd.lang.apex.rule.security.Helper` removed. This was actually internal API. -* pmd-java - * AbstractPackageNameModuleDirective - method `getImage()` has been removed. - Use getPackageName instead. - * `AbstractTypeDeclaration` - method `getImage()` has been removed. - Use `getSimpleName()` instead. - * ASTAnnotation - method `getAnnotationName()` has been removed. - * ASTClassType - * constructor `ASTClassType(java.lang.String)` has been removed. - * method `getImage()` has been removed. - * method `isReferenceToClassSameCompilationUnit()` has been removed. - * ASTFieldDeclaration - method `getVariableName()` has been removed. - * ASTLiteral - the following methods have been removed: - * `isStringLiteral()` - use `node instanceof ASTStringLiteral` instead. - * `isCharLiteral()` - use `node instanceof ASTCharLiteral` instead. - * `isNullLiteral()` - use `node instanceof ASTNullLiteral` instead. - * `isBooleanLiteral()` - use `node instanceof ASTBooleanLiteral` instead. - * `isNumericLiteral()` - use `node instanceof ASTNumericLiteral` instead. - * `isIntLiteral()` - use isIntLiteral instead. - * `isLongLiteral()` - use isLongLiteral instead. - * `isFloatLiteral()` - use isFloatLiteral instead. - * `isDoubleLiteral()` - use isDoubleLiteral instead. - * ASTMethodDeclaration - methods `getImage()` and `getMethodName()` have been removed. - Use getName instead. - * ASTMethodReference - method `getImage()` has been removed. - * ASTModuleName - method `getImage()` has been removed. - * ASTPrimitiveType - method `getImage()` has been removed. - * ASTType - * `getTypeImage()` has been removed. - * `getArrayDepth()` has been removed. It's only available for arrays: getArrayDepth. - * `isPrimitiveType()` - use `node instanceof ASTPrimitiveType` instead. - * `isArrayType()` - use `node instanceof ASTArrayType` instead. - * `isClassOrInterfaceType()` - use `node instanceof ASTClassType` instead. - * ASTTypeDeclaration - method `getImage()` has been removed. - * ASTUnaryExpression - method `isPrefix()` has been removed. - Use getOperator`.isPrefix()` instead. - * ASTVariableId - methods `getImage()` and `getVariableName()` have been removed. - Use getName instead. - * JavaComment - method `getImage()` has been removed. - Use getText instead. - * JavaNode - method `jjtAccept()` has been removed. - Use acceptVisitor instead. - * `net.sourceforge.pmd.lang.java.ast.JavaParserVisitor` - Use JavaVisitor or JavaVisitorBase instead. - * `net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter` - * ModifierOwner - * `isFinal()` - This is still available in various subtypes, where it makes sense, e.g. isFinal. - * `isAbstract()` - This is still available in subtypes, e.g. isAbstract. - * `isStrictfp()` - Use hasModifiers instead, e.g. `hasModifiers(STRICTFP)`. - * `isSynchronized()` - Use hasModifiers instead, e.g. `hasModifiers(SYNCHRONIZED)`. - * `isNative()` - Use hasModifiers instead, e.g. `hasModifiers(NATIVE)`. - * `isStatic()` - This is still available in subtypes, e.g. isStatic. - * `isVolatile()` - Use hasModifiers instead, e.g. `hasModifiers(VOLATILE)`. - * `isTransient()` - Use hasModifiers instead, e.g. `hasModifiers(TRANSIENT)`. - * `isPrivate()` - Use getVisibility instead, e.g. `getVisibility() == Visibility.V_PRIVATE`. - * `isPublic()` - Use getVisibility instead, e.g. `getVisibility() == Visibility.V_PUBLIC`. - * `isProtected()` - Use getVisibility instead, e.g. `getVisibility() == Visibility.V_PROTECTED`. - * `isPackagePrivate()` - Use getVisibility instead, e.g. `getVisibility() == Visibility.V_PACKAGE`. - * `isSyntacticallyAbstract()` - Use hasExplicitModifiers instead, e.g. `hasExplicitModifiers(ABSTRACT)`. - * `isSyntacticallyPublic()` - Use hasExplicitModifiers instead, e.g. `hasExplicitModifiers(PUBLIC)`. - * `isSyntacticallyStatic()` - Use hasExplicitModifiers instead, e.g. `hasExplicitModifiers(STATIC)`. - * `isSyntacticallyFinal()` - Use hasExplicitModifiers instead, e.g. `hasExplicitModifiers(FINAL)`. - * TypeNode - method `getType()` has been removed. Use getTypeMirror instead. -* pmd-javascript - * AbstractEcmascriptNode - method `getNode()` has been removed. - AST nodes still have access to the underlying Rhino node via the protected property `node`. - * ASTFunctionNode - method `getBody(int)` removed. - Use getBody instead. - * ASTTryStatement - * method `isCatch()` has been removed. Use hasCatch instead. - * method `isFinally()` has been removed. Use hasFinally instead. - * EcmascriptNode - * method `jjtAccept()` has been removed. Use acceptVisitor instead. - * method `getNode()` has been removed. The underlying node is only available in AST nodes, but not in rule implementations. - * `net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParserVisitor` - Use EcmascriptVisitor or EcmascriptVisitorBase instead. - * `net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParserVisitorAdapter` -* pmd-jsp - * `net.sourceforge.pmd.lang.jsp.ast.JspParserVisitor` - Use JspVisitor or JspVisitorBase instead. - * `net.sourceforge.pmd.lang.jsp.ast.JspParserVisitorAdapter` - * JspNode - method `jjtAccept()` has been removed. - Use acceptVisitor instead. -* pmd-modelica - * `net.sourceforge.pmd.lang.modelica.ast.ModelicaParserVisitor` - Use ModelicaVisitor or ModelicaVisitorBase instead. - * `net.sourceforge.pmd.lang.modelica.ast.ModelicaParserVisitorAdapter` - * ModelicaNode - method `jjtAccept()` has been removed. - Use acceptVisitor instead. - * `net.sourceforge.pmd.lang.modelica.rule.AmbiguousResolutionRule` - Use AmbiguousResolutionRule instead. - * `net.sourceforge.pmd.lang.modelica.rule.ConnectUsingNonConnector` - Use ConnectUsingNonConnectorRule -* pmd-plsql - * `net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor` - Use PlsqlVisitor or PlsqlVisitorBase instead. - * `net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitorAdapter` - * PLSQLNode - method `jjtAccept()` has been removed. - Use acceptVisitor instead. -* pmd-scala - * The maven module `pmd-scala` has been removed. Use `pmd-scala_2.13` or `pmd-scala_2.12` instead. - * ScalaNode - * Method `accept()` has been removed. Use acceptVisitor instead. - * Method `getNode()` has been removed. The underlying node is only available in AST nodes, but not in rule implementations. - * `AbstractScalaNode` - method `getNode()` has been removed. AST nodes still have access - to the underlying Scala node via the protected property `node`. -* pmd-visualforce - * VfNode - method `jjtAccept()` has been removed. - Use acceptVisitor instead. - * `net.sourceforge.pmd.lang.vf.ast.VfParserVisitor` - Use VfVisitor or VfVisitorBase instead. - * `net.sourceforge.pmd.lang.vf.ast.VfParserVisitorAdapter` - * DataType - method `fromBasicType(BasicType)` has been removed. - Use fromTypeName instead. -* pmd-velocity (previously pmd-vm) - * VtlNode - method `jjtAccept()` has been removed. - Use acceptVisitor instead. - * `net.sourceforge.pmd.lang.vm.ast.VmParserVisitor` - Use VtlVisitor or VtlVisitorBase instead. - * `net.sourceforge.pmd.lang.vm.ast.VmParserVisitorAdapter` - -**Removed classes, interfaces and methods (not previously deprecated)** - -* pmd-apex - * The method `isSynthetic()` in ASTMethod has been removed. - With the switch from Jorje to Summit AST as underlying parser, no synthetic methods are generated by the - parser anymore. This also means, that there is no XPath attribute `@Synthetic` anymore. - * The constant `STATIC_INITIALIZER_METHOD_NAME` in FieldDeclarationsShouldBeAtStartRule - has been removed. It was used to filter out synthetic methods, but these are not generated anymore with the - new parser. - * The method `getContext()` in ASTReferenceExpression has been removed. - It was not used and always returned `null`. - * The method `getNamespace()` in all AST nodes (defined in ApexNode) has - been removed, as it was never fully implemented. It always returned an empty string. - * The method `getNameSpace()` in ApexQualifiedName has been removed. - * The class `net.sourceforge.pmd.lang.apex.ast.ASTBridgeMethodCreator` has been removed. This was a node that has - been generated by the old Jorje parser only. -* pmd-apex-jorje - * With the switch from Jorje to Summit AST, this maven module is no longer needed and has been removed. -* pmd-core - * `net.sourceforge.pmd.util.Predicate` has been removed. It was marked as Experimental before. Use - `java.util.function.Predicate` instead. -* pmd-java - * The interface `FinalizableNode` (introduced in 7.0.0-rc1) has been removed. - Its method `isFinal()` has been moved down to the - nodes where needed, e.g. ASTLocalVariableDeclaration#isFinal. - * The method `isPackagePrivate()` in ASTClassDeclaration (formerly ASTClassOrInterfaceDeclaration) - has been removed. - Use hasVisibility instead, - which can correctly differentiate between local and package private classes. - -**Renamed classes, interfaces, methods** - -* pmd-core - * MessageReporter has been renamed to PmdReporter - * TokenMgrError has been renamed to LexException - * Tokenizer has been renamed to CpdLexer. Along with this rename, - all the implementations have been renamed as well (`Tokenizer` -> `CpdLexer`), e.g. "CppCpdLexer", "JavaCpdLexer". - This affects all language modules. - * AnyTokenizer has been renamed to AnyCpdLexer. - -* pmd-java - * The interface `AccessNode` has been renamed to ModifierOwner. This is only relevant - for Java rules, which use that type directly e.g. through downcasting. - Or when using the XPath function `pmd-java:nodeIs()`. - * The node `ASTClassOrInterfaceType` has been renamed to ASTClassType. XPath rules - need to be adjusted. - * The node `ASTClassOrInterfaceDeclaration` has been renamed to ASTClassDeclaration. - XPath rules need to be adjusted. - * The interface `ASTAnyTypeDeclaration` has been renamed to ASTTypeDeclaration. - This is only relevant for Java rules, which use that type directly, e.g. through downcasting. - Or when using the XPath function `pmd-java:nodeIs()`. - * The interface `ASTMethodOrConstructorDeclaration` has been renamed to - ASTExecutableDeclaration. This is only relevant for Java rules, which use that type - directly, e.g. through downcasting. Or when using the XPath function `pmd-java:nodeIs()`. - * The node `ASTVariableDeclaratorId` has been renamed to ASTVariableId. XPath rules - need to be adjusted. - * The node `ASTClassOrInterfaceBody` has been renamed to ASTClassBody. XPath rules - need to be adjusted. -* pmd-scala - * The interface `ScalaParserVisitor` has been renamed to ScalaVisitor in order - to align the naming scheme for the different language modules. - * The class `ScalaParserVisitorAdapter` has been renamed to ScalaVisitorBase in order - to align the naming scheme for the different language modules. - -**New API** - -These were annotated with `@Experimental`, but can now be considered stable. - -* pmd-apex - * ASTCommentContainer - * ApexMultifileAnalysis -* pmd-core - * CPDReport#filterMatches - * AntlrToken#getKind - * AbstractJjtreeNode - * TokenDocument - * AstInfo#getSuppressionComments - * AstInfo#withSuppressMap - * GenericToken#getKind - * FileCollector#addZipFileWithContent - * net.sourceforge.pmd.lang.document - * LanguageVersionHandler#getLanguageMetricsProvider - * LanguageVersionHandler#getDesignerBindings - * PlainTextLanguage - * PropertyConstraint#getXmlConstraint - * PropertyConstraint#toOptionalConstraint - * PropertyConstraint#fromPredicate - * PropertyConstraint#fromPredicate - * AbstractRenderer#setReportFile - * Renderer#setReportFile - * DesignerBindings - * DesignerBindings.TreeIconId - * RelatedNodesSelector - * Report#filterViolations - * Report#union -* pmd-groovy - * GroovyToken#getKind -* pmd-html - * net.sourceforge.pmd.lang.html -* pmd-java - * ASTExpression#getConversionContext - * AbstractJavaRulechainRule#<init> - * JSymbolTable - * JElementSymbol - * net.sourceforge.pmd.lang.java.symbols - * ExprContext - * JIntersectionType#getInducedClassType - * JTypeMirror#streamMethods - * JTypeMirror#streamDeclaredMethods - * JTypeMirror#getConstructors -* pmd-kotlin - * KotlinLanguageModule -* pmd-test-schema - * TestSchemaParser - -**Removed functionality** - -* The CLI parameter `--no-ruleset-compatibility` has been removed. It was only used to allow loading - some rulesets originally written for PMD 5 also in PMD 6 without fixing the rulesets. -* The class RuleSetFactoryCompatibility has been removed without replacement. - The different ways to enable/disable this filter in PMDConfiguration - (Property "RuleSetFactoryCompatibilityEnabled") and - PMDTask (Property "noRuleSetCompatibility") have been removed as well. -* `textcolor` renderer (TextColorRenderer) now renders always in color. - The property `color` has been removed. The possibility to override this with the system property `pmd.color` - has been removed as well. If you don't want colors, use `text` renderer (TextRenderer). - -#### 7.0.0-rc4 - -**pmd-java** - -* Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available. - -**Rule properties** - -* The old deprecated classes like `IntProperty` and `StringProperty` have been removed. Please use - PropertyFactory to create properties. -* All properties which accept multiple values now use a comma (`,`) as a delimiter. The previous default was a - pipe character (`|`). The delimiter is not configurable anymore. If needed, the comma can be escaped - with a backslash. -* The `min` and `max` attributes in property definitions in the XML are now optional and can appear separately - or be omitted. - -**New Programmatic API for CPD** - -See [Detailed Release Notes for PMD 7](pmd_release_notes_pmd7.html#new-programmatic-api-for-cpd) -and [PR #4397](https://github.com/pmd/pmd/pull/4397) for details. - -**Removed classes and methods** - -The following previously deprecated classes have been removed: - -* pmd-core - * `net.sourceforge.pmd.cpd.AbstractTokenizer` ➡️ use AnyCpdLexer instead (previously known as AnyTokenizer) - * `net.sourceforge.pmd.cpd.CPD` ➡️ use PmdCli from `pmd-cli` module for CLI support or use - CpdAnalysis for programmatic API - * `net.sourceforge.pmd.cpd.GridBagHelper` (now package private) - * `net.sourceforge.pmd.cpd.TokenEntry.State` - * `net.sourceforge.pmd.lang.document.CpdCompat` - * `net.sourceforge.pmd.properties.BooleanMultiProperty` - * `net.sourceforge.pmd.properties.BooleanProperty` - * `net.sourceforge.pmd.properties.CharacterMultiProperty` - * `net.sourceforge.pmd.properties.CharacterProperty` - * `net.sourceforge.pmd.properties.DoubleMultiProperty` - * `net.sourceforge.pmd.properties.DoubleProperty` - * `net.sourceforge.pmd.properties.EnumeratedMultiProperty` - * `net.sourceforge.pmd.properties.EnumeratedProperty` - * `net.sourceforge.pmd.properties.EnumeratedPropertyDescriptor` - * `net.sourceforge.pmd.properties.FileProperty` (note: without replacement) - * `net.sourceforge.pmd.properties.FloatMultiProperty` - * `net.sourceforge.pmd.properties.FloatProperty` - * `net.sourceforge.pmd.properties.IntegerMultiProperty` - * `net.sourceforge.pmd.properties.IntegerProperty` - * `net.sourceforge.pmd.properties.LongMultiProperty` - * `net.sourceforge.pmd.properties.LongProperty` - * `net.sourceforge.pmd.properties.MultiValuePropertyDescriptor` - * `net.sourceforge.pmd.properties.NumericPropertyDescriptor` - * `net.sourceforge.pmd.properties.PropertyDescriptorField` - * `net.sourceforge.pmd.properties.RegexProperty` - * `net.sourceforge.pmd.properties.SingleValuePropertyDescriptor` - * `net.sourceforge.pmd.properties.StringMultiProperty` - * `net.sourceforge.pmd.properties.StringProperty` - * `net.sourceforge.pmd.properties.ValueParser` - * `net.sourceforge.pmd.properties.ValueParserConstants` - * `net.sourceforge.pmd.properties.builders.MultiNumericPropertyBuilder` - * `net.sourceforge.pmd.properties.builders.MultiPackagedPropertyBuilder` - * `net.sourceforge.pmd.properties.builders.MultiValuePropertyBuilder` - * `net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilder` - * `net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilderConversionWrapper` - * `net.sourceforge.pmd.properties.builders.PropertyDescriptorExternalBuilder` - * `net.sourceforge.pmd.properties.builders.SingleNumericPropertyBuilder` - * `net.sourceforge.pmd.properties.builders.SinglePackagedPropertyBuilder` - * `net.sourceforge.pmd.properties.builders.SingleValuePropertyBuilder` - * `net.sourceforge.pmd.properties.modules.EnumeratedPropertyModule` - * `net.sourceforge.pmd.properties.modules.NumericPropertyModule` - -The following previously deprecated methods have been removed: - -* pmd-core - * `net.sourceforge.pmd.properties.PropertyBuilder.GenericCollectionPropertyBuilder#delim(char)` - * `net.sourceforge.pmd.properties.PropertySource#setProperty(...)` - * `net.sourceforge.pmd.properties.internal.PropertyTypeId#factoryFor(...)` - * `net.sourceforge.pmd.properties.internal.PropertyTypeId#typeIdFor(...)` - * `net.sourceforge.pmd.properties.PropertyDescriptor`: removed methods errorFor, type, isMultiValue, - uiOrder, compareTo, isDefinedExternally, valueFrom, asDelimitedString - -The following methods have been removed: - -* pmd-core - * CPDConfiguration - * `#sourceCodeFor(File)`, `#postConstruct()`, `#tokenizer()`, `#filenameFilter()` removed - * Mark - * `#getSourceSlice()`, `#setLineCount(int)`, `#getLineCount()`, `#setSourceCode(SourceCode)` removed - * `#getBeginColumn()`, `#getBeginLine()`, `#getEndLine()`, `#getEndColumn()` removed - ➡️ use getLocation instead - * Match - * `#LABEL_COMPARATOR` removed - * `#setMarkSet(...)`, `#setLabel(...)`, `#getLabel()`, `#addTokenEntry(...)` removed - * `#getSourceCodeSlice()` removed - ➡️ use CPDReport#getSourceCodeSlice instead - * TokenEntry - * `#getEOF()`, `#clearImages()`, `#getIdentifier()`, `#getIndex()`, `#setHashCode(int)` removed - * `#EOF` removed ➡️ use isEof instead - * Parser.ParserTask - * `#getFileDisplayName()` removed ➡️ use getFileId instead - (`getFileId().getAbsolutePath()`) - -The following classes have been removed: - -* pmd-core - * `net.sourceforge.pmd.cpd.AbstractLanguage` - * `net.sourceforge.pmd.cpd.AnyLanguage` - * `net.sourceforge.pmd.cpd.Language` - * `net.sourceforge.pmd.cpd.LanguageFactory` - * `net.sourceforge.pmd.cpd.MatchAlgorithm` (now package private) - * `net.sourceforge.pmd.cpd.MatchCollector` (now package private) - * `net.sourceforge.pmd.cpd.SourceCode` (and all inner classes like `FileCodeLoader`, ...) - * `net.sourceforge.pmd.cpd.token.TokenFilter` - -**Moved packages** - -* pmd-core - * NumericConstraints (old package: `net.sourceforge.pmd.properties.constraints.NumericConstraints`) - * PropertyConstraint (old package: `net.sourceforge.pmd.properties.constraints.PropertyConstraint`) - * not experimental anymore - * ReportException (old package: `net.sourceforge.pmd.cpd`, moved to module `pmd-ant`) - * it is now a RuntimeException - * CPDReportRenderer (old package: `net.sourceforge.pmd.cpd.renderer`) - * AntlrTokenFilter (old package: `net.sourceforge.pmd.cpd.token`) - * BaseTokenFilter (old package: `net.sourceforge.pmd.cpd.token.internal`) - * JavaCCTokenFilter (old package: `net.sourceforge.pmd.cpd.token`) - -**Changed types and other changes** - -* pmd-core - * PropertyDescriptor is now a class (was an interface) - and it is not comparable anymore. - * AbstractConfiguration#setSourceEncoding - * previously this method took a simple String for the encoding. - * PMDConfiguration and CPDConfiguration - * many getters and setters have been moved to the parent class AbstractConfiguration - * CPDListener#addedFile - * no `File` parameter anymore - * CPDReport#getNumberOfTokensPerFile returns a `Map` of `FileId,Integer` instead of `String` - * CPDReport#filterMatches now takes a `java.util.function.Predicate` - as parameter - * CpdLexer - * Note: CpdLexer was previously named Tokenizer. - * constants are now PropertyDescriptor instead of `String`, - to be used as language properties - * tokenize - changed parameters. Now takes a TextDocument and a TokenFactory - (instead of `SourceCode` and `Tokens`). - * Language - * method `#createProcessor(LanguagePropertyBundle)` moved to PmdCapableLanguage - * StringUtil#linesWithTrimIndent now takes a `Chars` - instead of a `String`. -* All language modules (like pmd-apex, pmd-cpp, ...) - * consistent package naming: `net.sourceforge.pmd.lang..cpd` - * adapted to use CpdCapableLanguage - * consistent static method `#getInstance()` - * removed constants like `ID`, `TERSE_NAME` or `NAME`. Use `getInstance().getName()` etc. instead - -**Internal APIs** - -* `net.sourceforge.pmd.properties.internal.PropertyTypeId` - -**Deprecated API** - -* Language#getTerseName ➡️ use getId instead - -* The method ASTPattern#getParenthesisDepth has been deprecated and will be removed. - It was introduced for supporting parenthesized patterns, but that was removed with Java 21. It is only used when - parsing code as java-19-preview. - -**Experimental APIs** - -* To support the Java preview language features "String Templates" and "Unnamed Patterns and Variables", the following - AST nodes have been introduced as experimental: - * ASTTemplateExpression - * ASTTemplate - * ASTTemplateFragment - * ASTUnnamedPattern -* The AST nodes for supporting "Record Patterns" and "Pattern Matching for switch" are not experimental anymore: - * ASTRecordPattern - * ASTPatternList (Note: it was renamed from `ASTComponentPatternList`) - * ASTGuard (Note: it was renamed from `ASTSwitchGuard`) - -#### 7.0.0-rc3 - -**PMD Distribution** - -* The asset filenames of PMD on [GitHub Releases](https://github.com/pmd/pmd/releases) are - now `pmd-dist--bin.zip`, `pmd-dist--src.zip` and `pmd-dist--doc.zip`. - Keep that in mind, if you have an automated download script. - - The structure inside the ZIP files stay the same, e.g. we still provide inside the binary distribution - ZIP file the base directory `pmd-bin-`. - -**CLI** - -* The CLI option `--stress` (or `-stress`) has been removed without replacement. -* The CLI option `--minimum-priority` was changed with 7.0.0-rc1 to only take the following values: - High, Medium High, Medium, Medium Low, Low. With 7.0.0-rc2 compatibility has been restored, so that the equivalent - integer values (1 to 5) are supported as well. - -**pmd-core** - -* Replaced `RuleViolation::getFilename` with new RuleViolation#getFileId, that returns a - FileId. This is an identifier for a TextFile - and could represent a path name. This allows to have a separate display name, e.g. renderers use - FileNameRenderer to either display the full path name or a relative path name - (see Renderer#setFileNameRenderer and - ConfigurableFileNameRenderer). Many places where we used a simple String for - a path-like name before have been adapted to use the new FileId. - - See [PR #4425](https://github.com/pmd/pmd/pull/4425) for details. - -#### 7.0.0-rc2 - -**Removed classes and methods** - -The following previously deprecated classes have been removed: - -* pmd-core - * `net.sourceforge.pmd.PMD` - * `net.sourceforge.pmd.cli.PMDCommandLineInterface` - * `net.sourceforge.pmd.cli.PMDParameters` - * `net.sourceforge.pmd.cli.PmdParametersParseResult` - -**CLI** - -* The CLI option `--minimum-priority` was changed with 7.0.0-rc1 to only take the following values: - High, Medium High, Medium, Medium Low, Low. With 7.0.0-rc2 compatibility has been restored, so that the equivalent - integer values (1 to 5) are supported as well. - -#### 7.0.0-rc1 - -**CLI** - -* The CLI option `--stress` (or `-stress`) has been removed without replacement. -* The CLI option `--minimum-priority` now takes one of the following values instead of an integer: - High, Medium High, Medium, Medium Low, Low. - -#### 6.55.0 - -**Go** - -* The LanguageModule of Go, that only supports CPD execution, has been deprecated. This language - is not fully supported by PMD, so having a language module does not make sense. The functionality of CPD is - not affected by this change. The following class has been deprecated and will be removed with PMD 7.0.0: - * GoLanguageModule - -**Java** -* Support for Java 18 preview language features have been removed. The version "18-preview" is no longer available. -* The experimental class `net.sourceforge.pmd.lang.java.ast.ASTGuardedPattern` has been removed. - -#### 6.54.0 - -**PMD CLI** - -* PMD now supports a new `--relativize-paths-with` flag (or short `-z`), which replaces `--short-names`. - It serves the same purpose: Shortening the pathnames in the reports. However, with the new flag it's possible - to explicitly define one or more pathnames that should be used as the base when creating relative paths. - The old flag `--short-names` is deprecated. - -**Deprecated APIs** - -**For removal** - -* ApexRootNode#getApexVersion() has been deprecated for removal. The version returned is - always `Version.CURRENT`, as the apex compiler integration doesn't use additional information which Apex version - actually is used. Therefore, this method can't be used to determine the Apex version of the project - that is being analyzed. -* CPDConfiguration#setEncoding and - CPDConfiguration#getEncoding. Use the methods - getSourceEncoding and - setSourceEncoding instead. Both are available - for `CPDConfiguration` which extends `AbstractConfiguration`. -* BaseCLITest and BaseCPDCLITest have been deprecated for removal without - replacement. CLI tests should be done in pmd-core only (and in PMD7 in pmd-cli). Individual language modules - shouldn't need to test the CLI integration logic again. Instead, the individual language modules should test their - functionality as unit tests. -* CPDConfiguration.LanguageConverter - -* FileCollector#addZipFile has been deprecated. It is replaced - by FileCollector#addZipFileWithContent which directly adds the - content of the zip file for analysis. - -* PMDConfiguration#setReportShortNames and - PMDConfiguration#isReportShortNames have been deprecated for removal. - Use AbstractConfiguration#addRelativizeRoot instead. - -**Internal APIs** - -* CSVWriter -* Some fields in AbstractAntTestHelper - -**Experimental APIs** - -* CPDReport has a new method which limited mutation of a given report: - * filterMatches creates a new CPD report - with some matches removed with a given predicate based filter. - -#### 6.53.0 - -**Deprecated APIs** - -**For removal** - -These classes / APIs have been deprecated and will be removed with PMD 7.0.0. - -* ExcessiveLengthRule (Java) - -#### 6.52.0 - -**PMD CLI** - -* PMD now supports a new `--use-version` flag, which receives a language-version pair (such as `java-8` or `apex-54`). - This supersedes the usage of `-language` / `-l` and `-version` / `-v`, allowing for multiple versions to be set in a single run. - PMD 7 will completely remove support for `-language` and `-version` in favor of this new flag. - -* Support for `-V` is being deprecated in favor of `--verbose` in preparation for PMD 7. - In PMD 7, `-v` will enable verbose mode and `-V` will show the PMD version for consistency with most Unix/Linux tools. - -* Support for `-min` is being deprecated in favor of `--minimum-priority` for consistency with most Unix/Linux tools, where `-min` would be equivalent to `-m -i -n`. - -**CPD CLI** - -* CPD now supports using `-d` or `--dir` as an alias to `--files`, in favor of consistency with PMD. - PMD 7 will remove support for `--files` in favor of these new flags. - -**Linux run.sh parameters** - -* Using `run.sh cpdgui` will now warn about it being deprecated. Use `run.sh cpd-gui` instead. - -* The old designer (`run.sh designerold`) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: `run.sh designer`. - -* The old visual AST viewer (`run.sh bgastviewer`) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: `run.sh designer` for a visual tool, or use `run.sh ast-dump` for a text-based alternative. - -**Deprecated API** - -* The following core APIs have been marked as deprecated for removal in PMD 7: - - PMD and `PMD.StatusCode` - PMD 7 will ship with a revamped CLI split from pmd-core. To programmatically launch analysis you can use PmdAnalysis. - - PMDConfiguration#getAllInputPaths - It is now superseded by PMDConfiguration#getInputPathList - - PMDConfiguration#setInputPaths - It is now superseded by PMDConfiguration#setInputPathList - - PMDConfiguration#addInputPath - It is now superseded by PMDConfiguration#addInputPath - - PMDConfiguration#getInputFilePath - It is now superseded by PMDConfiguration#getInputFile - - PMDConfiguration#getIgnoreFilePath - It is now superseded by PMDConfiguration#getIgnoreFile - - PMDConfiguration#setInputFilePath - It is now superseded by PMDConfiguration#setInputFilePath - - PMDConfiguration#setIgnoreFilePath - It is now superseded by PMDConfiguration#setIgnoreFilePath - - PMDConfiguration#getInputUri - It is now superseded by PMDConfiguration#getUri - - PMDConfiguration#setInputUri - It is now superseded by PMDConfiguration#setInputUri - - PMDConfiguration#getReportFile - It is now superseded by PMDConfiguration#getReportFilePath - - PMDConfiguration#setReportFile - It is now superseded by PMDConfiguration#setReportFile - - PMDConfiguration#isStressTest and PMDConfiguration#setStressTest - Will be removed with no replacement. - - PMDConfiguration#isBenchmark and PMDConfiguration#setBenchmark - Will be removed with no replacement, the CLI will still support it. - - CPD and `CPD.StatusCode` - PMD 7 will ship with a revamped CLI split from pmd-core. An alternative to programmatically launch CPD analysis will be added in due time. - -* In order to reduce the dependency on Apex Jorje classes, the method DataType#fromBasicType - has been deprecated. The equivalent method fromTypeName should be used instead. - -#### 6.51.0 - -No changes. - -#### 6.50.0 - -**CPD CLI** - -* CPD now supports the `--ignore-literal-sequences` argument when analyzing Lua code. - -#### 6.49.0 - -**Deprecated API** - -* In order to reduce the dependency on Apex Jorje classes, the following methods have been deprecated. - These methods all leaked internal Jorje enums. These enums have been replaced now by enums the - PMD's AST package. - * ASTAssignmentExpression#getOperator - * ASTBinaryExpression#getOperator - * ASTBooleanExpression#getOperator - * ASTPostfixExpression#getOperator - * ASTPrefixExpression#getOperator - - All these classes have now a new `getOp()` method. Existing code should be refactored to use this method instead. - It returns the new enums, like AssignmentOperator, and avoids - the dependency to Jorje. - -#### 6.48.0 - -**CPD CLI** - -* CPD has a new CLI option `--debug`. This option has the same behavior as in PMD. It enables more verbose - logging output. - -**Rule Test Framework** - -* The module "pmd-test", which contains support classes to write rule tests, now **requires Java 8**. If you depend on - this module for testing your own custom rules, you'll need to make sure to use at least Java 8. -* The new module "pmd-test-schema" contains now the XSD schema and the code to parse the rule test XML files. The - schema has been extracted in order to easily share it with other tools like the Rule Designer or IDE plugins. -* Test schema changes: - * The attribute `isRegressionTest` of `test-code` is deprecated. The new - attribute `disabled` should be used instead for defining whether a rule test should be skipped or not. - * The attributes `reinitializeRule` and `useAuxClasspath` of `test-code` are deprecated and assumed true. - They will not be replaced. - * The new attribute `focused` of `test-code` allows disabling all tests except the focused one temporarily. -* More information about the rule test framework can be found in the documentation: - [Testing your rules](pmd_userdocs_extending_testing.html) - -**Deprecated API** - -* The experimental Java AST class `net.sourceforge.pmd.lang.java.ast.ASTGuardedPattern` has been deprecated and - will be removed. It was introduced for Java 17 and Java 18 Preview as part of pattern matching for switch, - but it is no longer supported with Java 19 Preview. -* The interface CPDRenderer is deprecated. For custom CPD renderers - the new interface CPDReportRenderer should be used. -* The class TestDescriptor is deprecated, replaced with RuleTestDescriptor. -* Many methods of RuleTst have been deprecated as internal API. - -**Experimental APIs** - -* To support the Java preview language features "Pattern Matching for Switch" and "Record Patterns", the following - AST nodes have been introduced as experimental: - * ASTSwitchGuard - * ASTRecordPattern - * ASTComponentPatternList - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* CPDConfiguration#setRenderer -* CPDConfiguration#setCPDRenderer -* CPDConfiguration#getRenderer -* CPDConfiguration#getCPDRenderer -* CPDConfiguration#getRendererFromString -* CPDConfiguration#getCPDRendererFromString -* CPDRendererAdapter - -#### 6.47.0 - -No changes. - -#### 6.46.0 - -**Deprecated ruleset references** - -Ruleset references with the following formats are now deprecated and will produce a warning -when used on the CLI or in a ruleset XML file: -- `-`, eg `java-basic`, which resolves to `rulesets/java/basic.xml` -- the internal release number, eg `600`, which resolves to `rulesets/releases/600.xml` - -Use the explicit forms of these references to be compatible with PMD 7. - -**Deprecated API** - -- toString is now deprecated. The format of this - method will remain the same until PMD 7. The deprecation is intended to steer users - away from relying on this format, as it may be changed in PMD 7. -- getInputPaths and - setInputPaths are now deprecated. - A new set of methods have been added, which use lists and do not rely on comma splitting. - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -- CPDCommandLineInterface has been internalized. In order to execute CPD either - CPD#runCpd or CPD#main - should be used. -- Several members of BaseCPDCLITest have been deprecated with replacements. -- The methods Formatter#start, - Formatter#end, Formatter#getRenderer, - and Formatter#isNoOutputSupplied have been internalized. - -#### 6.45.0 - -**Experimental APIs** - -* Report has two new methods which allow limited mutations of a given report: - * Report#filterViolations creates a new report with - some violations removed with a given predicate based filter. - * Report#union can combine two reports into a single new Report. -* net.sourceforge.pmd.util.Predicate will be replaced in PMD7 with the standard Predicate interface from java8. -* The module `pmd-html` is entirely experimental right now. Anything in the package - `net.sourceforge.pmd.lang.html` should be used cautiously. - -#### 6.44.0 - -**Deprecated API** - -* Several members of PMD have been newly deprecated, including: - - `PMD#EOL`: use `System#lineSeparator()` - - `PMD#SUPPRESS_MARKER`: use DEFAULT_SUPPRESS_MARKER - - `PMD#processFiles`: use the new programmatic API - - `PMD#getApplicableFiles`: is internal -* PMDConfiguration#prependClasspath is deprecated - in favour of prependAuxClasspath. -* PMDConfiguration#setRuleSets and - getRuleSets are deprecated. Use instead - setRuleSets, - addRuleSet, - and getRuleSetPaths. -* Several members of BaseCLITest have been deprecated with replacements. -* Several members of PMDCommandLineInterface have been explicitly deprecated. - The whole class however was deprecated long ago already with 6.30.0. It is internal API and should - not be used. - -* In modelica, the rule classes AmbiguousResolutionRule - and ConnectUsingNonConnector have been deprecated, - since they didn't comply to the usual rule class naming conventions yet. - The replacements are in the subpackage `bestpractices`. - -**Experimental APIs** - -* Together with the new programmatic API the interface - TextFile has been added as *experimental*. It intends - to replace DataSource and SourceCode in the long term. - - This interface will change in PMD 7 to support read/write operations - and other things. You don't need to use it in PMD 6, as FileCollector - decouples you from this. A file collector is available through PmdAnalysis#files. - -#### 6.43.0 - -**Deprecated API** - -Some API deprecations were performed in core PMD classes, to improve compatibility with PMD 7. -- Report: the constructor and other construction methods like addViolation or createReport -- RuleContext: all constructors, getters and setters. A new set - of stable methods, matching those in PMD 7, was added to replace the `addViolation` - overloads of AbstractRule. In PMD 7, `RuleContext` will - be the API to report violations, and it can already be used as such in PMD 6. -- The field configuration is unused and will be removed. - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -- RuleSet: methods that serve to apply rules, including `apply`, `start`, `end`, `removeDysfunctionalRules` -- AbstractAccumulatingRenderer#renderFileReport is internal API - and should not be overridden in own renderers. - -**Changed API** - -It is now forbidden to report a violation: -- With a `null` node -- With a `null` message -- With a `null` set of format arguments (prefer a zero-length array) - -Note that the message is set from the XML rule declaration, so this is only relevant -if you instantiate rules manually. - -RuleContext now requires setting the current rule before calling -apply. This is -done automatically by `RuleSet#apply` and such. Creating and configuring a -`RuleContext` manually is strongly advised against, as the lifecycle of `RuleContext` -will change drastically in PMD 7. - -#### 6.42.0 - -No changes. - -#### 6.41.0 - -**Command Line Interface** - -The command line options for PMD and CPD now use GNU-syle long options format. E.g. instead of `-rulesets` the -preferred usage is now `--rulesets`. Alternatively one can still use the short option `-R`. -Some options also have been renamed to a more consistent casing pattern at the same time -(`--fail-on-violation` instead of `-failOnViolation`). -The old single-dash options are still supported but are deprecated and will be removed with PMD 7. -This change makes the command line interface more consistent within PMD and also less surprising -compared to other cli tools. - -The changes in detail for PMD: - -| old option | new option | -|---------------------------|------------------------------| -| `-rulesets` | `--rulesets` (or `-R`) | -| `-uri` | `--uri` | -| `-dir` | `--dir` (or `-d`) | -| `-filelist` | `--file-list` | -| `-ignorelist` | `--ignore-list` | -| `-format` | `--format` (or `-f`) | -| `-debug` | `--debug` | -| `-verbose` | `--verbose` | -| `-help` | `--help` | -| `-encoding` | `--encoding` | -| `-threads` | `--threads` | -| `-benchmark` | `--benchmark` | -| `-stress` | `--stress` | -| `-shortnames` | `--short-names` | -| `-showsuppressed` | `--show-suppressed` | -| `-suppressmarker` | `--suppress-marker` | -| `-minimumpriority` | `--minimum-priority` | -| `-property` | `--property` | -| `-reportfile` | `--report-file` | -| `-force-language` | `--force-language` | -| `-auxclasspath` | `--aux-classpath` | -| `-failOnViolation` | `--fail-on-violation` | -| `--failOnViolation` | `--fail-on-violation` | -| `-norulesetcompatibility` | `--no-ruleset-compatibility` | -| `-cache` | `--cache` | -| `-no-cache` | `--no-cache` | - -The changes in detail for CPD: - -| old option | new option | -|---------------------|-----------------------| -| `--failOnViolation` | `--fail-on-violation` | -| `-failOnViolation` | `--fail-on-violation` | -| `--filelist` | `--file-list` | - -#### 6.40.0 - -**Experimental APIs** - -* The interface ASTCommentContainer has been added to the Apex AST. - It provides a way to check whether a node contains at least one comment. Currently, this is only implemented for - ASTCatchBlockStatement and used by the rule - [`EmptyCatchBlock`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_errorprone.html#emptycatchblock). - This information is also available via XPath attribute `@ContainsComment`. - -#### 6.39.0 - -No changes. - -#### 6.38.0 - -No changes. - -#### 6.37.0 - -**PMD CLI** - -* PMD has a new CLI option `-force-language`. With that a language can be forced to be used for all input files, - irrespective of filenames. When using this option, the automatic language selection by extension is disabled - and all files are tried to be parsed with the given language. Parsing errors are ignored and unparsable files - are skipped. - - This option allows to use the xml language for files, that don't use xml as extension. - See also the examples on [PMD CLI reference](pmd_userdocs_cli_reference.html#analyze-other-xml-formats). - -**Experimental APIs** - -* The AST types and APIs around Sealed Classes are not experimental anymore: - * ASTClassOrInterfaceDeclaration#isSealed, - ASTClassOrInterfaceDeclaration#isNonSealed, - ASTClassOrInterfaceDeclaration#getPermittedSubclasses - * ASTPermitsList - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* The inner class net.sourceforge.pmd.cpd.TokenEntry.State is considered to be internal API. - It will probably be moved away with PMD 7. - -#### 6.36.0 - -No changes. - -#### 6.35.0 - -**Deprecated API** - -* PMD#doPMD is deprecated. - Use PMD#runPmd instead. -* PMD#run is deprecated. - Use PMD#runPmd instead. -* ThreadSafeReportListener and the methods to use them in Report - (addListener, - getListeners, addListeners) - are deprecated. This functionality will be replaced by another TBD mechanism in PMD 7. - -#### 6.34.0 - -No changes. - -#### 6.33.0 - -No changes. - -#### 6.32.0 - -**Experimental APIs** - -* The experimental class `ASTTypeTestPattern` has been renamed to ASTTypePattern - in order to align the naming to the JLS. -* The experimental class `ASTRecordConstructorDeclaration` has been renamed to ASTCompactConstructorDeclaration - in order to align the naming to the JLS. -* The AST types and APIs around Pattern Matching and Records are not experimental anymore: - * ASTVariableId#isPatternBinding - * ASTPattern - * ASTTypePattern - * ASTRecordDeclaration - * ASTRecordComponentList - * ASTRecordComponent - * ASTRecordBody - * ASTCompactConstructorDeclaration - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* The protected or public member of the Java rule AvoidUsingHardCodedIPRule - are deprecated and considered to be internal API. They will be removed with PMD 7. - -#### 6.31.0 - -**Deprecated API** - -* AbstractDomXmlRule -* AbstractWsdlRule -* A few methods of AbstractXmlRule - -**Experimental APIs** - -* The method GenericToken#getKind has been added as experimental. This - unifies the token interface for both JavaCC and Antlr. The already existing method - AntlrToken#getKind is therefore experimental as well. The - returned constant depends on the actual language and might change whenever the grammar - of the language is changed. - -#### 6.30.0 - -**Deprecated API** - -**Around RuleSet parsing** - -* RuleSetFactory and RulesetsFactoryUtils have been deprecated in favor of RuleSetLoader. This is easier to configure, and more maintainable than the multiple overloads of `RulesetsFactoryUtils`. -* Some static creation methods have been added to RuleSet for simple cases, eg forSingleRule. These replace some counterparts in RuleSetFactory -* Since RuleSets is also deprecated, many APIs that require a RuleSets instance now are deprecated, and have a counterpart that expects a `List`. -* RuleSetReferenceId, RuleSetReference, RuleSetFactoryCompatibility are deprecated. They are most likely not relevant outside of the implementation of pmd-core. - -**Around the `PMD` class** - -Many classes around PMD's entry point (PMD) have been deprecated as internal, including: -* The contents of the packages net.sourceforge.pmd.cli in pmd-core, net.sourceforge.pmd.processor -* SourceCodeProcessor -* The constructors of PMD (the class will be made a utility class) - -**Miscellaneous** - -* ASTPackageDeclaration#getPackageNameImage, - ASTTypeParameter#getParameterName - and the corresponding XPath attributes. In both cases they're replaced with a new method `getName`, - the attribute is `@Name`. -* ASTClassOrInterfaceBody#isAnonymousInnerClass, - and ASTClassOrInterfaceBody#isEnumChild, - refs [#905](https://github.com/pmd/pmd/issues/905) - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* net.sourceforge.pmd.lang.ecmascript.Ecmascript3Handler -* net.sourceforge.pmd.lang.ecmascript.Ecmascript3Parser -* EcmascriptParser#parserOptions -* EcmascriptParser#getSuppressMap -* net.sourceforge.pmd.lang.rule.ParametricRuleViolation -* ParserOptions#suppressMarker -* net.sourceforge.pmd.lang.modelica.rule.ModelicaRuleViolationFactory - -#### 6.29.0 - -No changes. - -#### 6.28.0 - -**Deprecated API** - -**For removal** - -* net.sourceforge.pmd.RuleViolationComparator. Use RuleViolation#DEFAULT_COMPARATOR instead. -* net.sourceforge.pmd.cpd.AbstractTokenizer. Use net.sourceforge.pmd.cpd.AnyCpdLexer instead (previously called AnyTokenizer). -* net.sourceforge.pmd.cpd.FortranTokenizer. Was replaced by an AnyCpdLexer. Use FortranLanguageModule#createCpdLexer anyway. -* net.sourceforge.pmd.cpd.PerlTokenizer. Was replaced by an AnyCpdLexer. Use PerlLanguageModule#createCpdLexer anyway. -* net.sourceforge.pmd.cpd.RubyTokenizer. Was replaced by an AnyCpdLexer. Use RubyLanguageModule#createCpdLexer anyway. -* RuleReference#getOverriddenLanguage and - RuleReference#setLanguage -* Antlr4 generated lexers: - * net.sourceforge.pmd.lang.cs.antlr4.CSharpLexer will be moved to package `net.sourceforge.pmd.lang.cs.ast` with PMD 7. - * net.sourceforge.pmd.lang.dart.antlr4.Dart2Lexer will be renamed to `DartLexer` and moved to package - `net.sourceforge.pmd.lang.dart.ast` with PMD 7. All other classes in the old package will be removed. - * net.sourceforge.pmd.lang.go.antlr4.GolangLexer will be moved to package - `net.sourceforge.pmd.lang.go.ast` with PMD 7. All other classes in the old package will be removed. - * net.sourceforge.pmd.lang.kotlin.antlr4.Kotlin will be renamed to `KotlinLexer` and moved to package - `net.sourceforge.pmd.lang.kotlin.ast` with PMD 7. - * net.sourceforge.pmd.lang.lua.antlr4.LuaLexer will be moved to package - `net.sourceforge.pmd.lang.lua.ast` with PMD 7. All other classes in the old package will be removed. - -#### 6.27.0 - -* XML rule definition in rulesets: In PMD 7, the `language` attribute will be required on all `rule` - elements that declare a new rule. Some base rule classes set the language implicitly in their - constructor, and so this is not required in all cases for the rule to work. But this - behavior will be discontinued in PMD 7, so missing `language` attributes are now - reported as a forward compatibility warning. - -**Deprecated API** - -**For removal** - -* Rule#getParserOptions -* Parser#getParserOptions -* AbstractParser -* RuleContext#removeAttribute -* RuleContext#getAttribute -* RuleContext#setAttribute -* ApexParserOptions -* ASTThrowStatement#getFirstClassOrInterfaceTypeImage -* EcmascriptParserOptions -* EcmascriptXPathRule -* XmlParserOptions -* XmlXPathRule -* Properties of AbstractXmlRule - -* net.sourceforge.pmd.Report.ReadableDuration -* Many methods of net.sourceforge.pmd.Report. They are replaced by accessors - that produce a List. For example, iterator() - (and implementing Iterable) and isEmpty() are both - replaced by getViolations(). - -* The dataflow codebase is deprecated for removal in PMD 7. This includes all code in the following packages, and their subpackages: - * net.sourceforge.pmd.lang.plsql.dfa - * net.sourceforge.pmd.lang.java.dfa - * net.sourceforge.pmd.lang.dfa - * and the class PLSQLDataFlowHandler - -* VfSimpleCharStream - -* ASTJspDeclarations -* ASTJspDocument -* ScalaParserVisitorAdapter#zero -* ScalaParserVisitorAdapter#combine -* ApexParserVisitorReducedAdapter -* JavaParserVisitorReducedAdapter - -* TypeHelper is deprecated in - favor of TypeTestUtil, which has the - same functionality, but a slightly changed API. -* Many of the classes in net.sourceforge.pmd.lang.java.symboltable - are deprecated as internal API. - -#### 6.26.0 - -**Deprecated API** - -**For removal** - -* RuleChainVisitor and all implementations in language modules -* AbstractRuleChainVisitor -* Language#getRuleChainVisitorClass -* BaseLanguageModule#<init> -* ImportWrapper - -#### 6.25.0 - -* The maven module `net.sourceforge.pmd:pmd-scala` is deprecated. Use `net.sourceforge.pmd:pmd-scala_2.13` - or `net.sourceforge.pmd:pmd-scala_2.12` instead. - -* Rule implementation classes are internal API and should not be used by clients directly. - The rules should only be referenced via their entry in the corresponding category ruleset - (e.g. ``). - - While we definitely won't move or rename the rule classes in PMD 6.x, we might consider changes - in PMD 7.0.0 and onwards. - -**Deprecated APIs** - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* AbstractIgnoredAnnotationRule (Java) -* AbstractInefficientZeroCheck (Java) -* AbstractJUnitRule (Java) -* AbstractJavaMetricsRule (Java) -* AbstractLombokAwareRule (Java) -* AbstractPoorMethodCall (Java) -* AbstractSunSecureRule (Java) -* AbstractNcssCountRule (Java) -* AbstractCommentRule (Java) -* AbstractOptimizationRule (Java) -* RegexHelper (Java) -* AbstractApexUnitTestRule (Apex) -* AbstractNcssCountRule (Apex) -* AbstractNcssCountRule (PLSQL) -* ApexParser -* ApexHandler -* RuleChain -* RuleSets -* RulesetsFactoryUtils#getRuleSets - -**For removal** - -* TokenEntry#TokenEntry -* AbstractTokenizerTest. Use CpdTextComparisonTest in module pmd-lang-test instead. - For details see - [Testing your implementation](pmd_devdocs_major_adding_new_cpd_language.html#testing-your-implementation) - in the developer documentation. -* ASTAnnotation#suppresses (Apex) -* ApexXPathRule (Apex) -* SymbolTableTestRule (Java) -* InefficientStringBufferingRule#isInStringBufferOperation - -#### 6.24.0 - -**Deprecated APIs** - -* BaseLanguageModule#addVersion(String, LanguageVersionHandler, boolean) -* Some members of TokenMgrError, in particular, a new constructor is available - that should be preferred to the old ones -* ANTLRSyntaxError - -**Experimental APIs** - -**Note:** Experimental APIs are identified with the annotation Experimental, -see its javadoc for details - -* The experimental methods in BaseLanguageModule have been replaced by a - definitive API. - -#### 6.23.0 - -**Deprecated APIs** - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* AbstractXPathRuleQuery -* JaxenXPathRuleQuery -* SaxonXPathRuleQuery -* XPathRuleQuery - -**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 **Apex**, **Javascript**, **PL/SQL**, **Scala** and **Visualforce** ASTs: - -* Manual instantiation of nodes. **Constructors of node classes are deprecated** and - marked InternalApi. Nodes should only be obtained from the parser, - which for rules, means that they 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**. The base classes are internal API - and will be hidden in version 7.0.0. You should not couple your code to them. - * In the meantime you should use interfaces like VfNode or - 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. -* The implementation classes of Parser (eg VfParser) are deprecated and should not be used directly. - Use LanguageVersionHandler#getParser instead. -* The implementation classes of TokenManager (eg VfTokenManager) are deprecated and should not be used outside of our implementation. - **This also affects CPD-only modules**. - -These deprecations are added to the following language modules in this release. -Please look at the package documentation to find out the full list of deprecations. -* Apex: net.sourceforge.pmd.lang.apex.ast -* Javascript: net.sourceforge.pmd.lang.ecmascript.ast -* PL/SQL: net.sourceforge.pmd.lang.plsql.ast -* Scala: net.sourceforge.pmd.lang.scala.ast -* Visualforce: net.sourceforge.pmd.lang.vf.ast - -These deprecations have already been rolled out in a previous version for the -following languages: -* Java: net.sourceforge.pmd.lang.java.ast -* Java Server Pages: net.sourceforge.pmd.lang.jsp.ast -* Velocity Template Language: net.sourceforge.pmd.lang.vm.ast - -Outside of these packages, these changes also concern the following TokenManager -implementations, and their corresponding Parser if it exists (in the same package): - -* CppTokenManager -* JavaTokenManager -* Ecmascript5TokenManager -* JspTokenManager -* MatlabTokenManager -* ModelicaTokenManager -* ObjectiveCTokenManager -* PLSQLTokenManager -* PythonTokenManager -* VfTokenManager -* VmTokenManager - - -In the **Java AST** the following attributes are deprecated and will issue a warning when used in XPath rules: - -* ASTAdditiveExpression#getImage - use `getOperator()` instead -* ASTVariableDeclaratorId#getImage - use `getName()` instead -* ASTVariableDeclaratorId#getVariableName - use `getName()` instead - -**For removal** - -* Parser#getTokenManager -* TokenManager#setFileName -* AbstractTokenManager#setFileName -* AbstractTokenManager#getFileName -* AntlrToken#getType - use `getKind()` instead. -* ImmutableLanguage -* MockRule -* Node#getFirstParentOfAnyType -* Node#getAsDocument -* AbstractNode#hasDescendantOfAnyType -* ASTRecordDeclaration#getComponentList -* Multiple fields, constructors and methods in XPathRule. See javadoc for details. - -#### 6.22.0 - -**Deprecated APIs** - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* JavaLanguageHandler -* JavaLanguageParser -* JavaDataFlowHandler -* Implementations of RuleViolationFactory in each - language module, eg JavaRuleViolationFactory. - See javadoc of RuleViolationFactory. -* Implementations of RuleViolation in each language module, - eg JavaRuleViolation. See javadoc of - RuleViolation. - -* RuleFactory -* RuleBuilder -* Constructors of RuleSetFactory, use factory methods from RulesetsFactoryUtils instead -* getRulesetFactory - -* AbstractApexNode -* AbstractApexNodeBase, and the related `visit` - methods on ApexParserVisitor and its implementations. - Use ApexNode instead, now considers comments too. - -**For removal** - -* pmd-core - * DFAGraphRule and its implementations - * DFAGraphMethod - * Many methods on the Node interface - and AbstractNode base class. See their javadoc for details. - * Node#isFindBoundary is deprecated for XPath queries. - * Many APIs of `net.sourceforge.pmd.lang.metrics`, though most of them were internal and - probably not used directly outside of PMD. Use MetricsUtil as - a replacement for the language-specific façades too. - * QualifiableNode, QualifiedName -* pmd-java - * AbstractJavaParser - * AbstractJavaHandler - * [`ASTAnyTypeDeclaration.TypeKind`](https://docs.pmd-code.org/apidocs/pmd-java/6.55.0/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeDeclaration.TypeKind.html) - * ASTAnyTypeDeclaration#getTypeKind - * JavaQualifiedName - * ASTCatchStatement#getBlock - * ASTCompilationUnit#declarationsAreInDefaultPackage - * JavaQualifiableNode - * ASTAnyTypeDeclaration#getQualifiedName - * ASTMethodOrConstructorDeclaration#getQualifiedName - * ASTLambdaExpression#getQualifiedName - * net.sourceforge.pmd.lang.java.qname and its contents - * MethodLikeNode - * Its methods will also be removed from its implementations, - ASTMethodOrConstructorDeclaration, - ASTLambdaExpression. - * ASTAnyTypeDeclaration#getImage will be removed. Please use `getSimpleName()` - instead. This affects ASTAnnotationTypeDeclaration#getImage, - ASTClassOrInterfaceDeclaration#getImage, and - ASTEnumDeclaration#getImage. - * Several methods of ASTTryStatement, replacements with other names - have been added. This includes the XPath attribute `@Finally`, replace it with a test for `child::FinallyStatement`. - * Several methods named `getGuardExpressionNode` are replaced with `getCondition`. This affects the - following nodes: WhileStatement, DoStatement, ForStatement, IfStatement, AssertStatement, ConditionalExpression. - * ASTYieldStatement will not implement TypeNode - anymore come 7.0.0. Test the type of the expression nested within it. - * JavaMetrics, JavaMetricsComputer - * ASTArguments#getArgumentCount. - Use size instead. - * ASTFormalParameters#getParameterCount. - Use size instead. -* pmd-apex - * ApexMetrics, ApexMetricsComputer - -**In ASTs (JSP)** - -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 JSP AST** (with other languages to come): - -* Manual instantiation of nodes. **Constructors of node classes are deprecated** and - marked InternalApi. Nodes should only be obtained from the parser, - which for rules, means that they 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**. The base classes are internal API - and will be hidden in version 7.0.0. You should not couple your code to them. - * In the meantime you should use interfaces like JspNode or - 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. -* The class JspParser is deprecated and should not be used directly. - Use LanguageVersionHandler#getParser instead. - -Please look at net.sourceforge.pmd.lang.jsp.ast to find out the full list of deprecations. - -**In ASTs (Velocity)** - -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 VM AST** (with other languages to come): - -* Manual instantiation of nodes. **Constructors of node classes are deprecated** and - marked InternalApi. Nodes should only be obtained from the parser, - which for rules, means that they 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**. The base classes are internal API - and will be hidden in version 7.0.0. You should not couple your code to them. - * In the meantime you should use interfaces like VtlNode or - 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. -* The package net.sourceforge.pmd.lang.vm.directive as well as the classes - DirectiveMapper and LogUtil are deprecated - for removal. They were only used internally during parsing. -* The class VmParser is deprecated and should not be used directly. - Use LanguageVersionHandler#getParser instead. - -Please look at net.sourceforge.pmd.lang.vm.ast to find out the full list of deprecations. - -**PLSQL AST** - -The production and node ASTCursorBody was unnecessary, not used and has been removed. Cursors have been already -parsed as ASTCursorSpecification. - -#### 6.21.0 - -**Deprecated APIs** - -**Internal API** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. -You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* JavaLanguageHandler -* JavaLanguageParser -* JavaDataFlowHandler -* Implementations of RuleViolationFactory in each - language module, eg JavaRuleViolationFactory. - See javadoc of RuleViolationFactory. -* Implementations of RuleViolation in each language module, - eg JavaRuleViolation. See javadoc of - RuleViolation. - -* RuleFactory -* RuleBuilder -* Constructors of RuleSetFactory, use factory methods from RulesetsFactoryUtils instead -* getRulesetFactory - -* AbstractApexNode -* AbstractApexNodeBase, and the related `visit` - methods on ApexParserVisitor and its implementations. - Use ApexNode instead, now considers comments too. - -* CharStream, JavaCharStream, - SimpleCharStream: these are APIs used by our JavaCC - implementations and that will be moved/refactored for PMD 7.0.0. They should not - be used, extended or implemented directly. -* All classes generated by JavaCC, eg JJTJavaParserState. - This includes token classes, which will be replaced with a single implementation, and - subclasses of ParseException, whose usages will be replaced - by just that superclass. - -**For removal** - -* pmd-core - * Many methods on the Node interface - and AbstractNode base class. See their javadoc for details. - * Node#isFindBoundary is deprecated for XPath queries. -* pmd-java - * AbstractJavaParser - * AbstractJavaHandler - * [`ASTAnyTypeDeclaration.TypeKind`](https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.55.0/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeDeclaration.TypeKind.html) - * ASTAnyTypeDeclaration#getTypeKind - * JavaQualifiedName - * ASTCatchStatement#getBlock - * ASTCompilationUnit#declarationsAreInDefaultPackage - * JavaQualifiableNode - * ASTAnyTypeDeclaration#getQualifiedName - * ASTMethodOrConstructorDeclaration#getQualifiedName - * ASTLambdaExpression#getQualifiedName - * net.sourceforge.pmd.lang.java.qname and its contents - * MethodLikeNode - * Its methods will also be removed from its implementations, - ASTMethodOrConstructorDeclaration, - ASTLambdaExpression. - * ASTAnyTypeDeclaration#getImage will be removed. Please use `getSimpleName()` - instead. This affects ASTAnnotationTypeDeclaration#getImage, - ASTClassOrInterfaceDeclaration#getImage, and - ASTEnumDeclaration#getImage. - * Several methods of ASTTryStatement, replacements with other names - have been added. This includes the XPath attribute `@Finally`, replace it with a test for `child::FinallyStatement`. - * Several methods named `getGuardExpressionNode` are replaced with `getCondition`. This affects the - following nodes: WhileStatement, DoStatement, ForStatement, IfStatement, AssertStatement, ConditionalExpression. - * ASTYieldStatement will not implement TypeNode - anymore come 7.0.0. Test the type of the expression nested within it. - -#### 6.20.0 - -No changes. - -#### 6.19.0 - -**Deprecated APIs** - -**For removal** - -* pmd-core - * All the package net.sourceforge.pmd.dcd and its subpackages. See DCD. - * In LanguageRegistry: - * commaSeparatedTerseNamesForLanguageVersion - * commaSeparatedTerseNamesForLanguage - * findAllVersions - * findLanguageVersionByTerseName - * getInstance - * RuleSet#getExcludePatterns. Use the new method getFileExclusions instead. - * RuleSet#getIncludePatterns. Use the new method getFileInclusions instead. - * Parser#canParse - * Parser#getSuppressMap - * RuleBuilder#RuleBuilder. Use the new constructor with the correct ResourceLoader instead. - * RuleFactory#RuleFactory. Use the new constructor with the correct ResourceLoader instead. -* pmd-java - * CanSuppressWarnings and its implementations - * isSuppressed - * getDeclaringType. - * isSupressed - * ASTMethodDeclarator - * getMethodName - * getBlock - * getParameterCount -* pmd-apex - * CanSuppressWarnings and its implementations - * isSupressed - -**Internal APIs** - -* pmd-core - * All the package net.sourceforge.pmd.util and its subpackages, - except net.sourceforge.pmd.util.datasource and net.sourceforge.pmd.util.database. - * GridBagHelper - * ColumnDescriptor - - -#### 6.18.0 - -**Changes to Renderer** - -* Each renderer has now a new method Renderer#setUseShortNames which - is used for implementing the "shortnames" CLI option. The method is automatically called by PMD, if this - CLI option is in use. When rendering filenames to the report, the new helper method - AbstractRenderer#determineFileName should be used. This will change - the filename to a short name, if the CLI option "shortnames" is used. - - Not adjusting custom renderers will make them render always the full file names and not honoring the - CLI option "shortnames". - -**Deprecated APIs** - -**For removal** - -* The methods ASTImportDeclaration#getImportedNameNode and - ASTImportDeclaration#getPackage have been deprecated and - will be removed with PMD 7.0.0. -* The method RuleContext#setSourceCodeFilename has been deprecated - and will be removed. The already existing method RuleContext#setSourceCodeFile - should be used instead. The method RuleContext#getSourceCodeFilename still - exists and returns just the filename without the full path. -* The method AbstractPMDProcessor#filenameFrom has been - deprecated. It was used to determine a "short name" of the file being analyzed, so that the report - can use short names. However, this logic has been moved to the renderers. -* The methods Report#metrics and Report#hasMetrics have - been deprecated. They were leftovers from a previous deprecation round targeting - StatisticalRule. - -**Internal APIs** - -Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. - -* pmd-core - * net.sourceforge.pmd.cache -* pmd-java - * net.sourceforge.pmd.lang.java.typeresolution: Everything, including - subpackages, except TypeHelper and - JavaTypeDefinition. - * ASTCompilationUnit#getClassTypeResolver - - -#### 6.17.0 - -No changes. - -#### 6.16.0 - -**Deprecated APIs** - -> Reminder: Please don't use members marked with the 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 - 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 JavaNode or - 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 net.sourceforge.pmd.lang.java.ast to find out the full list -of deprecations. - - -#### 6.15.0 - -**Deprecated APIs** - -**For removal** - -* The `DumpFacades` in all languages, that could be used to transform a AST into a textual representation, - will be removed with PMD 7. The rule designer is a better way to inspect nodes. - * net.sourceforge.pmd.lang.apex.ast.DumpFacade - * net.sourceforge.pmd.lang.java.ast.DumpFacade - * net.sourceforge.pmd.lang.ecmascript.ast.DumpFacade - * net.sourceforge.pmd.lang.jsp.ast.DumpFacade - * net.sourceforge.pmd.lang.plsql.ast.DumpFacade - * net.sourceforge.pmd.lang.vf.ast.DumpFacade - * net.sourceforge.pmd.lang.vm.ast.AbstractVmNode#dump - * net.sourceforge.pmd.lang.xml.ast.DumpFacade -* The method LanguageVersionHandler#getDumpFacade will be - removed as well. It is deprecated, along with all its implementations in the subclasses of LanguageVersionHandler. - -#### 6.14.0 - -No changes. - -#### 6.13.0 - -**Command Line Interface** - -The start scripts `run.sh`, `pmd.bat` and `cpd.bat` support the new environment variable `PMD_JAVA_OPTS`. -This can be used to set arbitrary JVM options for running PMD, such as memory settings (e.g. `PMD_JAVA_OPTS=-Xmx512m`) -or enable preview language features (e.g. `PMD_JAVA_OPTS=--enable-preview`). - -The previously available variables such as `OPTS` or `HEAPSIZE` are deprecated and will be removed with PMD 7.0.0. - -**Deprecated API** - -* CodeClimateRule is deprecated in 7.0.0 because it was unused for 2 years and - created an unwanted dependency. - Properties "cc_categories", "cc_remediation_points_multiplier", "cc_block_highlighting" will also be removed. - See [#1702](https://github.com/pmd/pmd/pull/1702) for more. - -* The Apex ruleset `rulesets/apex/ruleset.xml` has been deprecated and will be removed in 7.0.0. Please use the new - quickstart ruleset `rulesets/apex/quickstart.xml` instead. - -#### 6.12.0 - -No changes. - -#### 6.11.0 - -* StatisticalRule and the related helper classes and base rule classes - are deprecated for removal in 7.0.0. This includes all of net.sourceforge.pmd.stat and net.sourceforge.pmd.lang.rule.stat, - and also AbstractStatisticalJavaRule, AbstractStatisticalApexRule and the like. - The methods Report#addMetric and metricAdded - will also be removed. -* setProperty is deprecated, - because MultiValuePropertyDescriptor is deprecated as well. - -#### 6.10.0 - -**Properties framework** - - - - - -The properties framework is about to get a lifting, and for that reason, we need to deprecate a lot of APIs -to remove them in 7.0.0. The proposed changes to the API are described [on the wiki](https://github.com/pmd/pmd/wiki/Property-framework-7-0-0) - -**Changes to how you define properties** - -* Construction of property descriptors has been possible through builders since 6.0.0. The 7.0.0 API will only allow - construction through builders. The builder hierarchy, currently found in the package net.sourceforge.pmd.properties.builders, - is being replaced by the simpler PropertyBuilder. Their APIs enjoy a high degree of source compatibility. - -* Concrete property classes like IntegerProperty and StringMultiProperty will gradually - all be deprecated until 7.0.0. Their usages should be replaced by direct usage of the PropertyDescriptor - interface, e.g. `PropertyDescriptor` or `PropertyDescriptor>`. - -* Instead of spreading properties across countless classes, the utility class PropertyFactory will become - from 7.0.0 on the only provider for property descriptor builders. Each current property type will be replaced - by a corresponding method on `PropertyFactory`: - * IntegerProperty is replaced by PropertyFactory#intProperty - * IntegerMultiProperty is replaced by PropertyFactory#intListProperty - - * FloatProperty and DoubleProperty are both replaced by PropertyFactory#doubleProperty. - Having a separate property for floats wasn't that useful. - * Similarly, FloatMultiProperty and DoubleMultiProperty are replaced by PropertyFactory#doubleListProperty. - - * StringProperty is replaced by PropertyFactory#stringProperty - * StringMultiProperty is replaced by PropertyFactory#stringListProperty - - * RegexProperty is replaced by PropertyFactory#regexProperty - - * EnumeratedProperty is replaced by PropertyFactory#enumProperty - * EnumeratedProperty is replaced by PropertyFactory#enumListProperty - - * BooleanProperty is replaced by PropertyFactory#booleanProperty - * Its multi-valued counterpart, BooleanMultiProperty, is not replaced, because it doesn't have a use case. - - * CharacterProperty is replaced by PropertyFactory#charProperty - * CharacterMultiProperty is replaced by PropertyFactory#charListProperty - - * LongProperty is replaced by PropertyFactory#longIntProperty - * LongMultiProperty is replaced by PropertyFactory#longIntListProperty - - * MethodProperty, FileProperty, TypeProperty and their multi-valued counterparts - are discontinued for lack of a use-case, and have no planned replacement in 7.0.0 for now. - - -Here's an example: -```java -// Before 7.0.0, these are equivalent: -IntegerProperty myProperty = new IntegerProperty("score", "Top score value", 1, 100, 40, 3.0f); -IntegerProperty myProperty = IntegerProperty.named("score").desc("Top score value").range(1, 100).defaultValue(40).uiOrder(3.0f); - -// They both map to the following in 7.0.0 -PropertyDescriptor myProperty = PropertyFactory.intProperty("score").desc("Top score value").require(inRange(1, 100)).defaultValue(40); -``` - -You're highly encouraged to migrate to using this new API as soon as possible, to ease your migration to 7.0.0. - - - -**Architectural simplifications** - -* EnumeratedPropertyDescriptor, NumericPropertyDescriptor, PackagedPropertyDescriptor, - and the related builders (in net.sourceforge.pmd.properties.builders) will be removed. - These specialized interfaces allowed additional constraints to be enforced on the - value of a property, but made the property class hierarchy very large and impractical - to maintain. Their functionality will be mapped uniformly to PropertyConstraints, - which will allow virtually any constraint to be defined, and improve documentation and error reporting. The - related methods PropertyTypeId#isPropertyNumeric and - PropertyTypeId#isPropertyPackaged are also deprecated. - -* MultiValuePropertyDescriptor and SingleValuePropertyDescriptor - are deprecated. 7.0.0 will introduce a new XML syntax which will remove the need for such a divide - between single- and multi-valued properties. The method PropertyDescriptor#isMultiValue will be removed - accordingly. - -**Changes to the PropertyDescriptor interface** - -* preferredRowCount is deprecated with no intended replacement. It was never implemented, and does not belong - in this interface. The methods uiOrder and `compareTo(PropertyDescriptor)` are deprecated for the - same reason. These methods mix presentation logic with business logic and are not necessary for PropertyDescriptors to work. - `PropertyDescriptor` will not extend `Comparable` anymore come 7.0.0. -* The method propertyErrorFor is deprecated and will be removed with no intended - replacement. It's really just a shortcut for `prop.errorFor(rule.getProperty(prop))`. -* `T `valueFrom(String) and `String `asDelimitedString`(T)` are deprecated and will be removed. These were - used to serialize and deserialize properties to/from a string, but 7.0.0 will introduce a more flexible - XML syntax which will make them obsolete. -* isMultiValue and type are deprecated and won't be replaced. The new XML syntax will remove the need - for a divide between multi- and single-value properties, and will allow arbitrary types to be represented. - Since arbitrary types may be represented, `type` will become obsolete as it can't represent generic types, - which will nevertheless be representable with the XML syntax. It was only used for documentation, but a - new way to document these properties exhaustively will be added with 7.0.0. -* errorFor is deprecated as its return type will be changed to `Optional` with the shift to Java 8. - -**Deprecated APIs** - - - - - - - - -**For internalization** - -* The implementation of the adapters for the XPath engines Saxon and Jaxen (package net.sourceforge.pmd.lang.ast.xpath) - are now deprecated. They'll be moved to an internal package come 7.0.0. Only Attribute remains public API. - -* The classes PropertyDescriptorField, PropertyDescriptorBuilderConversionWrapper, and the methods - PropertyDescriptor#attributeValuesById, PropertyDescriptor#isDefinedExternally and PropertyTypeId#getFactory. - These were used to read and write properties to and from XML, but were not intended as public API. - -* The class ValueParserConstants and the interface ValueParser. - -* All classes from net.sourceforge.pmd.lang.java.metrics.impl.visitors are now considered internal API. They're deprecated - and will be moved into an internal package with 7.0.0. To implement your own metrics visitors, - JavaParserVisitorAdapter should be directly subclassed. - -* LanguageVersionHandler#getDataFlowHandler(), LanguageVersionHandler#getDFAGraphRule() - -* VisitorStarter - -**For removal** - -* All classes from net.sourceforge.pmd.properties.modules will be removed. - -* The interface Dimensionable has been deprecated. - It gets in the way of a grammar change for 7.0.0 and won't be needed anymore (see [#997](https://github.com/pmd/pmd/issues/997)). - -* Several methods from ASTLocalVariableDeclaration and ASTFieldDeclaration have - also been deprecated: - - * ASTFieldDeclaration won't be a TypeNode come 7.0.0, so - getType and - getTypeDefinition are deprecated. - - * The method `getVariableName` on those two nodes will be removed, too. - - * All these are deprecated because those nodes may declare several variables at once, possibly - with different types (and obviously with different names). They both implement `Iterator<`ASTVariableId`>` - though, so you should iterate on each declared variable. See [#910](https://github.com/pmd/pmd/issues/910). - -* Visitor decorators are now deprecated and will be removed in PMD 7.0.0. They were originally a way to write - composable visitors, used in the metrics framework, but they didn't prove cost-effective. - - * In net.sourceforge.pmd.lang.java.ast: JavaParserDecoratedVisitor, JavaParserControllessVisitor, - JavaParserControllessVisitorAdapter, and JavaParserVisitorDecorator are deprecated with no intended replacement. - - -* The LanguageModules of several languages, that only support CPD execution, have been deprecated. These languages - are not fully supported by PMD, so having a language module does not make sense. The functionality of CPD is - not affected by this change. The following classes have been deprecated and will be removed with PMD 7.0.0: - - * CppHandler - * CppLanguageModule - * CppParser - * CsLanguageModule - * FortranLanguageModule - * GroovyLanguageModule - * MatlabHandler - * MatlabLanguageModule - * MatlabParser - * ObjectiveCHandler - * ObjectiveCLanguageModule - * ObjectiveCParser - * PhpLanguageModule - * PythonHandler - * PythonLanguageModule - * PythonParser - * RubyLanguageModule - - -* Optional AST processing stages like symbol table, type resolution or data-flow analysis will be reified - in 7.0.0 to factorise common logic and make them extensible. Further explanations about this change can be - found on [#1426](https://github.com/pmd/pmd/pull/1426). Consequently, the following APIs are deprecated for - removal: - * In Rule: isDfa(), isTypeResolution(), isMultifile() and their - respective setters. - * In RuleSet: usesDFA(Language), usesTypeResolution(Language), usesMultifile(Language) - * In RuleSets: usesDFA(Language), usesTypeResolution(Language), usesMultifile(Language) - * In LanguageVersionHandler: getDataFlowFacade(), getSymbolFacade(), getSymbolFacade(ClassLoader), - getTypeResolutionFacade(ClassLoader), getQualifiedNameResolutionFacade(ClassLoader) - -#### 6.9.0 - -No changes. - -#### 6.8.0 - -* A couple of methods and fields in net.sourceforge.pmd.properties.AbstractPropertySource have been - deprecated, as they are replaced by already existing functionality or expose internal implementation - details: `propertyDescriptors`, `propertyValuesByDescriptor`, - `copyPropertyDescriptors()`, `copyPropertyValues()`, `ignoredProperties()`, `usesDefaultValues()`, - `useDefaultValueFor()`. - -* Some methods in net.sourceforge.pmd.properties.PropertySource have been deprecated as well: - `usesDefaultValues()`, `useDefaultValueFor()`, `ignoredProperties()`. - -* The class net.sourceforge.pmd.lang.rule.AbstractDelegateRule has been deprecated and will - be removed with PMD 7.0.0. It is internally only in use by RuleReference. - -* The default constructor of net.sourceforge.pmd.lang.rule.RuleReference has been deprecated - and will be removed with PMD 7.0.0. RuleReferences should only be created by providing a Rule and - a RuleSetReference. Furthermore, the following methods are deprecated: `setRuleReference()`, - `hasOverriddenProperty()`, `usesDefaultValues()`, `useDefaultValueFor()`. - -#### 6.7.0 - -* All classes in the package net.sourceforge.pmd.lang.dfa.report have been deprecated and will be removed - with PMD 7.0.0. This includes the class net.sourceforge.pmd.lang.dfa.report.ReportTree. The reason is, - that this class is very specific to Java and not suitable for other languages. It has only been used for - `YAHTMLRenderer`, which has been rewritten to work without these classes. - -* The nodes RUNSIGNEDSHIFT and RSIGNEDSHIFT are deprecated and will be removed from the AST with PMD 7.0.0. - These represented the operator of ShiftExpression in two cases out of three, but they're not needed and - make ShiftExpression inconsistent. The operator of a ShiftExpression is now accessible through - ShiftExpression#getOperator. - -#### 6.5.0 - -* The utility class CommentUtil has been deprecated and will be removed - with PMD 7.0.0. Its methods have been intended to parse javadoc tags. A more useful solution will be added - around the AST node `FormalComment`, which contains as children `JavadocElement` nodes, which in - turn provide access to the `JavadocTag`. - - All comment AST nodes (`FormalComment`, `MultiLineComment`, `SingleLineComment`) have a new method - `getFilteredComment()` which provide access to the comment text without the leading `/*` markers. - -* The method `AbstractCommentRule.tagsIndicesIn()` has been deprecated and will be removed with - PMD 7.0.0. It is not very useful, since it doesn't extract the information - in a useful way. You would still need check, which tags have been found, and with which - data they might be accompanied. - -#### 6.4.0 - -* The following classes in package net.sourceforge.pmd.benchmark have been deprecated: Benchmark, Benchmarker, - BenchmarkReport, BenchmarkResult, RuleDuration, StringBuilderCR and TextReport. Their API is not supported anymore - and is disconnected from the internals of PMD. Use the newer API based around TimeTracker instead, which can be found - in the same package. -* The class TypeOfFunction has been deprecated. Use the newer TypeIsFunction in the same package. -* The `typeof` methods in JavaFunctions have been deprecated. - Use the newer `typeIs` method in the same class instead. -* The methods `isA`, `isEither` and `isNeither` of TypeHelper. - Use the new `isExactlyAny` and `isExactlyNone` methods in the same class instead. - -#### 6.2.0 - -* The static method PMDParameters#transformParametersIntoConfiguration is now deprecated, - for removal in 7.0.0. The new instance method toConfiguration replaces it. - -* The method ASTConstructorDeclaration#getParameters has been deprecated in favor of the new method - getFormalParameters. This method is available for both - ASTConstructorDeclaration and ASTMethodDeclaration. - -#### 6.1.0 - -* The method getXPathNodeName is added to the Node interface, which removes the - use of `toString` of a node to get its XPath element name (see [#569](https://github.com/pmd/pmd/issues/569)). - * The default implementation provided in AbstractNode, will be removed with 7.0.0 - * With 7.0.0, the `Node.toString` method will not necessarily provide its XPath node - name anymore. - -* The interface net.sourceforge.pmd.cpd.Renderer has been deprecated. A new interface - CPDRenderer has been introduced to replace it. The main - difference is that the new interface is meant to render directly to a `java.io.Writer` - rather than to a String. This allows to greatly reduce the memory footprint of CPD, as on - large projects, with many duplications, it was causing `OutOfMemoryError`s (see [#795](https://github.com/pmd/pmd/issues/795)). - - net.sourceforge.pmd.cpd.FileReporter has also been deprecated as part of this change, as it's no longer needed. - -#### 6.0.1 - -* The constant PMD#VERSION has been deprecated and will be removed with PMD 7.0.0. - Please use PMDVersion#VERSION instead. - - -## 🐛 Fixed Issues - -* miscellaneous - * [#881](https://github.com/pmd/pmd/issues/881): \[all] Breaking API changes for 7.0.0 - * [#896](https://github.com/pmd/pmd/issues/896): \[all] Use slf4j - * [#1431](https://github.com/pmd/pmd/pull/1431): \[ui] Remove old GUI applications (designerold, bgastviewer) - * [#1451](https://github.com/pmd/pmd/issues/1451): \[core] RulesetFactoryCompatibility stores the whole ruleset file in memory as a string - * [#2496](https://github.com/pmd/pmd/issues/2496): Update PMD 7 Logo on landing page - * [#2497](https://github.com/pmd/pmd/issues/2497): PMD 7 Logo page - * [#2498](https://github.com/pmd/pmd/issues/2498): Update PMD 7 Logo in documentation - * [#3797](https://github.com/pmd/pmd/issues/3797): \[all] Use JUnit5 - * [#4462](https://github.com/pmd/pmd/issues/4462): Provide Software Bill of Materials (SBOM) - * [#4460](https://github.com/pmd/pmd/pull/4460): Fix assembly-plugin warnings - * [#4582](https://github.com/pmd/pmd/issues/4582): \[dist] Download link broken - * [#4586](https://github.com/pmd/pmd/pull/4586): Use explicit encoding in ruleset xml files - * [#4642](https://github.com/pmd/pmd/issues/4642): Update regression tests with Java 21 language features - * [#4691](https://github.com/pmd/pmd/issues/4691): \[CVEs] Critical and High CEVs reported on PMD and PMD dependencies - * [#4699](https://github.com/pmd/pmd/pull/4699): Make PMD buildable with java 21 - * [#4736](https://github.com/pmd/pmd/issues/4736): \[ci] Improve build procedure - * [#4741](https://github.com/pmd/pmd/pull/4741): Add pmd-compat6 module for maven-pmd-plugin - * [#4749](https://github.com/pmd/pmd/pull/4749): Fixes NoSuchMethodError on processing errors in pmd-compat6 - * [#4776](https://github.com/pmd/pmd/issues/4776): \[ci] Upgrade to ruby 3 - * [#4796](https://github.com/pmd/pmd/pull/4796): Remove deprecated and release rulesets - * [#4823](https://github.com/pmd/pmd/pull/4823): Update to use renamed pmd-designer - * [#4827](https://github.com/pmd/pmd/pull/4827): \[compat6] Support config errors and cpd for csharp - * [#4830](https://github.com/pmd/pmd/issues/4830): Consolidate packages in each maven module - * [#4867](https://github.com/pmd/pmd/issues/4867): \[dist] ./mvnw command not found in dist-src -* ant - * [#4080](https://github.com/pmd/pmd/issues/4080): \[ant] Split off Ant integration into a new submodule -* core - * [#880](https://github.com/pmd/pmd/issues/880): \[core] Make visitors generic - * [#1027](https://github.com/pmd/pmd/issues/1027): \[core] Apply the new PropertyDescriptor<Pattern> type where applicable - * [#1204](https://github.com/pmd/pmd/issues/1204): \[core] Allow numeric properties in XML to be within an unbounded range - * [#1622](https://github.com/pmd/pmd/pull/1622): \[core] NodeStream API - * [#1687](https://github.com/pmd/pmd/issues/1687): \[core] Deprecate and Remove XPath 1.0 support - * [#1785](https://github.com/pmd/pmd/issues/1785): \[core] Allow abstract node types to be valid rulechain visits - * [#1825](https://github.com/pmd/pmd/pull/1825): \[core] Support NoAttribute for XPath - * [#2038](https://github.com/pmd/pmd/issues/2038): \[core] Remove DCD - * [#2218](https://github.com/pmd/pmd/issues/2218): \[core] `isFindBoundary` should not be an attribute - * [#2234](https://github.com/pmd/pmd/issues/2234): \[core] Consolidate PMD CLI into a single command - * [#2239](https://github.com/pmd/pmd/issues/2239): \[core] Merging Javacc build scripts - * [#2500](https://github.com/pmd/pmd/issues/2500): \[core] Clarify API for ANTLR based languages - * [#2518](https://github.com/pmd/pmd/issues/2518): \[core] Language properties - * [#2602](https://github.com/pmd/pmd/issues/2602): \[core] Remove ParserOptions - * [#2614](https://github.com/pmd/pmd/pull/2614): \[core] Upgrade Saxon, add XPath 3.1, remove Jaxen - * [#2696](https://github.com/pmd/pmd/pull/2696): \[core] Remove DFA - * [#2821](https://github.com/pmd/pmd/issues/2821): \[core] Rule processing error filenames are missing paths - * [#2873](https://github.com/pmd/pmd/issues/2873): \[core] Utility classes in pmd 7 - * [#2885](https://github.com/pmd/pmd/issues/2885): \[core] Error recovery mode - * [#3203](https://github.com/pmd/pmd/issues/3203): \[core] Replace RuleViolationFactory implementations with ViolationDecorator - * [#3692](https://github.com/pmd/pmd/pull/3692): \[core] Analysis listeners - * [#3782](https://github.com/pmd/pmd/issues/3782): \[core] Language lifecycle - * [#3815](https://github.com/pmd/pmd/issues/3815): \[core] Update Saxon HE to 10.7 - * [#3893](https://github.com/pmd/pmd/pull/3893): \[core] Text documents - * [#3902](https://github.com/pmd/pmd/issues/3902): \[core] Violation decorators - * [#3903](https://github.com/pmd/pmd/issues/3903): \[core] Consolidate `n.s.pmd.reporting` package - * [#3905](https://github.com/pmd/pmd/issues/3905): \[core] Stabilize tree export API - * [#3917](https://github.com/pmd/pmd/issues/3917): \[core] Consolidate `n.s.pmd.lang.rule` package - * [#3918](https://github.com/pmd/pmd/issues/3918): \[core] Make LanguageRegistry non static - * [#3919](https://github.com/pmd/pmd/issues/3919): \[core] Merge CPD and PMD language - * [#3922](https://github.com/pmd/pmd/pull/3922): \[core] Better error reporting for the ruleset parser - * [#4035](https://github.com/pmd/pmd/issues/4035): \[core] ConcurrentModificationException in DefaultRuleViolationFactory - * [#4065](https://github.com/pmd/pmd/issues/4065): \[core] Rename TokenMgrError to LexException, Tokenizer to CpdLexer - * [#4120](https://github.com/pmd/pmd/issues/4120): \[core] Explicitly name all language versions - * [#4204](https://github.com/pmd/pmd/issues/4204): \[core] Provide a CpdAnalysis class as a programmatic entry point into CPD - * [#4301](https://github.com/pmd/pmd/issues/4301): \[core] Remove deprecated property concrete classes - * [#4302](https://github.com/pmd/pmd/issues/4302): \[core] Migrate Property Framework API to Java 8 - * [#4309](https://github.com/pmd/pmd/issues/4309): \[core] Cleanups in XPath area - * [#4312](https://github.com/pmd/pmd/issues/4312): \[core] Remove unnecessary property `color` and system property `pmd.color` in `TextColorRenderer` - * [#4313](https://github.com/pmd/pmd/issues/4313): \[core] Remove support for <lang>-<ruleset> hyphen notation for ruleset references - * [#4314](https://github.com/pmd/pmd/issues/4314): \[core] Remove ruleset compatibility filter (RuleSetFactoryCompatibility) and CLI option `--no-ruleset-compatibility` - * [#4323](https://github.com/pmd/pmd/issues/4323): \[core] Refactor CPD integration - * [#4348](https://github.com/pmd/pmd/issues/4348): \[core] Consolidate @InternalApi classes - * [#4349](https://github.com/pmd/pmd/issues/4349): \[core] Cleanup remaining experimental and deprecated API - * [#4353](https://github.com/pmd/pmd/pull/4353): \[core] Micro optimizations for Node API - * [#4365](https://github.com/pmd/pmd/pull/4365): \[core] Improve benchmarking - * [#4397](https://github.com/pmd/pmd/pull/4397): \[core] Refactor CPD - * [#4378](https://github.com/pmd/pmd/issues/4378): \[core] Ruleset loading processes commented rules - * [#4420](https://github.com/pmd/pmd/pull/4420): \[core] Remove PMD.EOL - * [#4425](https://github.com/pmd/pmd/pull/4425): \[core] Replace TextFile::pathId - * [#4454](https://github.com/pmd/pmd/issues/4454): \[core] "Unknown option: '-min'" but is referenced in documentation - * [#4611](https://github.com/pmd/pmd/pull/4611): \[core] Fix loading language properties from env vars - * [#4621](https://github.com/pmd/pmd/issues/4621): \[core] Make `ClasspathClassLoader::getResource` child first - * [#4674](https://github.com/pmd/pmd/issues/4674): \[core] WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass - * [#4694](https://github.com/pmd/pmd/pull/4694): \[core] Fix line/col numbers in TokenMgrError - * [#4717](https://github.com/pmd/pmd/issues/4717): \[core] XSLTRenderer doesn't close report file - * [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer - * [#4782](https://github.com/pmd/pmd/pull/4782): \[core] Avoid using getImage/@Image -* cli - * [#2234](https://github.com/pmd/pmd/issues/2234): \[core] Consolidate PMD CLI into a single command - * [#3828](https://github.com/pmd/pmd/issues/3828): \[core] Progress reporting - * [#4079](https://github.com/pmd/pmd/issues/4079): \[cli] Split off CLI implementation into a pmd-cli submodule - * [#4423](https://github.com/pmd/pmd/pull/4423): \[cli] Fix NPE when only `--file-list` is specified - * [#4482](https://github.com/pmd/pmd/issues/4482): \[cli] pmd.bat can only be executed once - * [#4484](https://github.com/pmd/pmd/issues/4484): \[cli] ast-dump with no properties produce an NPE - * [#4594](https://github.com/pmd/pmd/pull/4594): \[cli] Change completion generation to runtime - * [#4685](https://github.com/pmd/pmd/pull/4685): \[cli] Clarify CPD documentation, fix positional parameter handling - * [#4723](https://github.com/pmd/pmd/issues/4723): \[cli] Launch fails for "bash pmd" -* doc - * [#995](https://github.com/pmd/pmd/issues/995): \[doc] Document API evolution principles as ADR - * [#2501](https://github.com/pmd/pmd/issues/2501): \[doc] Verify ANTLR Documentation - * [#2511](https://github.com/pmd/pmd/issues/2511): \[doc] Review guides for writing java/xpath rules for correctness with PMD 7 - * [#3175](https://github.com/pmd/pmd/issues/3175): \[doc] Document language module features - * [#4294](https://github.com/pmd/pmd/issues/4294): \[doc] Migration Guide for upgrading PMD 6 ➡️ 7 - * [#4303](https://github.com/pmd/pmd/issues/4303): \[doc] Document new property framework - * [#4308](https://github.com/pmd/pmd/issues/4308): \[doc] Document XPath API @DeprecatedAttribute - * [#4319](https://github.com/pmd/pmd/issues/4319): \[doc] Document TypeRes API and Symbols API - * [#4438](https://github.com/pmd/pmd/issues/4438): \[doc] Documentation links in VS Code are outdated - * [#4521](https://github.com/pmd/pmd/issues/4521): \[doc] Website is not mobile friendly - * [#4676](https://github.com/pmd/pmd/issues/4676): \[doc] Clarify how CPD `--ignore-literals` and `--ignore-identifiers` work - * [#4659](https://github.com/pmd/pmd/pull/4659): \[doc] Improve ant documentation - * [#4669](https://github.com/pmd/pmd/pull/4669): \[doc] Add bld PMD Extension to Tools / Integrations - * [#4704](https://github.com/pmd/pmd/issues/4704): \[doc] Multivalued properties do not accept \| as a separator -* testing - * [#2435](https://github.com/pmd/pmd/issues/2435): \[test] Remove duplicated Dummy language module - * [#4234](https://github.com/pmd/pmd/issues/4234): \[test] Tests that change the logging level do not work - -Language specific fixes: - -* apex - * [#1937](https://github.com/pmd/pmd/issues/1937): \[apex] Apex should only have a single RootNode - * [#1648](https://github.com/pmd/pmd/issues/1648): \[apex,vf] Remove CodeClimate dependency - * [#1750](https://github.com/pmd/pmd/pull/1750): \[apex] Remove apex statistical rules - * [#2836](https://github.com/pmd/pmd/pull/2836): \[apex] Remove Apex ProjectMirror - * [#3766](https://github.com/pmd/pmd/issues/3766): \[apex] Replace Jorje with fully open source front-end - * [#3973](https://github.com/pmd/pmd/issues/3973): \[apex] Update parser to support new 'as user' keywords (User Mode for Database Operations) - * [#4427](https://github.com/pmd/pmd/issues/4427): \[apex] ApexBadCrypto test failing to detect inline code - * [#4453](https://github.com/pmd/pmd/issues/4453): \[apex] \[7.0-rc1] Exception while initializing Apexlink (Index 34812 out of bounds for length 34812) - * [#4828](https://github.com/pmd/pmd/issues/4828): \[apex] Support null coalescing operator ?? (apex 60) - * [#4845](https://github.com/pmd/pmd/issues/4845): \[apex] Use same ANLTR version for apex-parser -* apex-design - * [#2667](https://github.com/pmd/pmd/issues/2667): \[apex] Integrate nawforce/ApexLink to build robust Unused rule - * [#4509](https://github.com/pmd/pmd/issues/4509): \[apex] ExcessivePublicCount doesn't consider inner classes correctly - * [#4596](https://github.com/pmd/pmd/issues/4596): \[apex] ExcessivePublicCount ignores properties -* apex-documentation - * [#4774](https://github.com/pmd/pmd/issues/4774): \[apex] ApexDoc false-positive for the first method of an annotated Apex class -* apex-performance - * [#4675](https://github.com/pmd/pmd/issues/4675): \[apex] New Rule: OperationWithHighCostInLoop -* apex-security - * [#4646](https://github.com/pmd/pmd/issues/4646): \[apex] ApexSOQLInjection does not recognise SObjectType or SObjectField as safe variable types -* groovy - * [#4726](https://github.com/pmd/pmd/pull/4726): \[groovy] Support Groovy to 3 and 4 and CPD suppressions -* java - * [#520](https://github.com/pmd/pmd/issues/520): \[java] Allow `@SuppressWarnings` with constants instead of literals - * [#864](https://github.com/pmd/pmd/issues/864): \[java] Similar/duplicated implementations for determining FQCN - * [#905](https://github.com/pmd/pmd/issues/905): \[java] Add new node for anonymous class declaration - * [#910](https://github.com/pmd/pmd/issues/910): \[java] AST inconsistency between primitive and reference type arrays - * [#997](https://github.com/pmd/pmd/issues/997): \[java] Java8 parsing corner case with annotated array types - * [#998](https://github.com/pmd/pmd/issues/998): \[java] AST inconsistencies around FormalParameter - * [#1019](https://github.com/pmd/pmd/issues/1019): \[java] Breaking Java Grammar changes for PMD 7.0.0 - * [#1124](https://github.com/pmd/pmd/issues/1124): \[java] ImmutableList implementation in the qname codebase - * [#1128](https://github.com/pmd/pmd/issues/1128): \[java] Improve ASTLocalVariableDeclaration - * [#1150](https://github.com/pmd/pmd/issues/1150): \[java] ClassOrInterfaceType AST improvements - * [#1207](https://github.com/pmd/pmd/issues/1207): \[java] Resolve explicit types using FQCNs, without hitting the classloader - * [#1307](https://github.com/pmd/pmd/issues/1307): \[java] AccessNode API changes - * [#1367](https://github.com/pmd/pmd/issues/1367): \[java] Parsing error on annotated inner class - * [#1661](https://github.com/pmd/pmd/issues/1661): \[java] About operator nodes - * [#2366](https://github.com/pmd/pmd/pull/2366): \[java] Remove qualified names - * [#2819](https://github.com/pmd/pmd/issues/2819): \[java] GLB bugs in pmd 7 - * [#3642](https://github.com/pmd/pmd/issues/3642): \[java] Parse error on rare extra dimensions on method return type on annotation methods - * [#3763](https://github.com/pmd/pmd/issues/3763): \[java] Ambiguous reference error in valid code - * [#3749](https://github.com/pmd/pmd/issues/3749): \[java] Improve `isOverridden` in ASTMethodDeclaration - * [#3750](https://github.com/pmd/pmd/issues/3750): \[java] Make symbol table support instanceof pattern bindings - * [#3751](https://github.com/pmd/pmd/issues/3751): \[java] Rename some node types - * [#3752](https://github.com/pmd/pmd/issues/3752): \[java] Expose annotations in symbol API - * [#4237](https://github.com/pmd/pmd/pull/4237): \[java] Cleanup handling of Java comments - * [#4317](https://github.com/pmd/pmd/issues/4317): \[java] Some AST nodes should not be TypeNodes - * [#4359](https://github.com/pmd/pmd/issues/4359): \[java] Type resolution fails with NPE when the scope is not a type declaration - * [#4367](https://github.com/pmd/pmd/issues/4367): \[java] Move testrule TypeResTest into internal - * [#4383](https://github.com/pmd/pmd/issues/4383): \[java] IllegalStateException: Object is not an array type! - * [#4401](https://github.com/pmd/pmd/issues/4401): \[java] PMD 7 fails to build under Java 19 - * [#4405](https://github.com/pmd/pmd/issues/4405): \[java] Processing error with ArrayIndexOutOfBoundsException - * [#4583](https://github.com/pmd/pmd/issues/4583): \[java] Support JDK 21 (LTS) - * [#4628](https://github.com/pmd/pmd/pull/4628): \[java] Support loading classes from java runtime images - * [#4753](https://github.com/pmd/pmd/issues/4753): \[java] PMD crashes while using generics and wildcards - * [#4757](https://github.com/pmd/pmd/issues/4757): \[java] Intermittent NPEs while analyzing Java code - * [#4794](https://github.com/pmd/pmd/issues/4794): \[java] Support JDK 22 -* java-bestpractices - * [#342](https://github.com/pmd/pmd/issues/342): \[java] AccessorMethodGeneration: Name clash with another public field not properly handled - * [#755](https://github.com/pmd/pmd/issues/755): \[java] AccessorClassGeneration false positive for private constructors - * [#770](https://github.com/pmd/pmd/issues/770): \[java] UnusedPrivateMethod yields false positive for counter-variant arguments - * [#807](https://github.com/pmd/pmd/issues/807): \[java] AccessorMethodGeneration false positive with overloads - * [#833](https://github.com/pmd/pmd/issues/833): \[java] ForLoopCanBeForeach should consider iterating on this - * [#1189](https://github.com/pmd/pmd/issues/1189): \[java] UnusedPrivateMethod false positive from inner class via external class - * [#1205](https://github.com/pmd/pmd/issues/1205): \[java] Improve ConstantsInInterface message to mention alternatives - * [#1212](https://github.com/pmd/pmd/issues/1212): \[java] Don't raise JUnitTestContainsTooManyAsserts on JUnit 5's assertAll - * [#1422](https://github.com/pmd/pmd/issues/1422): \[java] JUnitTestsShouldIncludeAssert false positive with inherited @Rule field - * [#1455](https://github.com/pmd/pmd/issues/1455): \[java] JUnitTestsShouldIncludeAssert: False positives for assert methods named "check" and "verify" - * [#1563](https://github.com/pmd/pmd/issues/1563): \[java] ForLoopCanBeForeach false positive with method call using index variable - * [#1565](https://github.com/pmd/pmd/issues/1565): \[java] JUnitAssertionsShouldIncludeMessage false positive with AssertJ - * [#1747](https://github.com/pmd/pmd/issues/1747): \[java] PreserveStackTrace false-positive - * [#1969](https://github.com/pmd/pmd/issues/1969): \[java] MissingOverride false-positive triggered by package-private method overwritten in another package by extending class - * [#1998](https://github.com/pmd/pmd/issues/1998): \[java] AccessorClassGeneration false-negative: subclass calls private constructor - * [#2130](https://github.com/pmd/pmd/issues/2130): \[java] UnusedLocalVariable: false-negative with array - * [#2147](https://github.com/pmd/pmd/issues/2147): \[java] JUnitTestsShouldIncludeAssert - false positives with lambdas and static methods - * [#2464](https://github.com/pmd/pmd/issues/2464): \[java] LooseCoupling must ignore class literals: ArrayList.class - * [#2542](https://github.com/pmd/pmd/issues/2542): \[java] UseCollectionIsEmpty can not detect the case `foo.bar().size()` - * [#2650](https://github.com/pmd/pmd/issues/2650): \[java] UseTryWithResources false positive when AutoCloseable helper used - * [#2796](https://github.com/pmd/pmd/issues/2796): \[java] UnusedAssignment false positive with call chains - * [#2797](https://github.com/pmd/pmd/issues/2797): \[java] MissingOverride long-standing issues - * [#2806](https://github.com/pmd/pmd/issues/2806): \[java] SwitchStmtsShouldHaveDefault false-positive with Java 14 switch non-fallthrough branches - * [#2822](https://github.com/pmd/pmd/issues/2822): \[java] LooseCoupling rule: Extend to cover user defined implementations and interfaces - * [#2843](https://github.com/pmd/pmd/pull/2843): \[java] Fix UnusedAssignment FP with field accesses - * [#2882](https://github.com/pmd/pmd/issues/2882): \[java] UseTryWithResources - false negative for explicit close - * [#2883](https://github.com/pmd/pmd/issues/2883): \[java] JUnitAssertionsShouldIncludeMessage false positive with method call - * [#2890](https://github.com/pmd/pmd/issues/2890): \[java] UnusedPrivateMethod false positive with generics - * [#2946](https://github.com/pmd/pmd/issues/2946): \[java] SwitchStmtsShouldHaveDefault false positive on enum inside enums - * [#3672](https://github.com/pmd/pmd/pull/3672): \[java] LooseCoupling - fix false positive with generics - * [#3675](https://github.com/pmd/pmd/pull/3675): \[java] MissingOverride - fix false positive with mixing type vars - * [#3858](https://github.com/pmd/pmd/issues/3858): \[java] UseCollectionIsEmpty should infer local variable type from method invocation - * [#4433](https://github.com/pmd/pmd/issues/4433): \[java] \[7.0-rc1] ReplaceHashtableWithMap on java.util.Properties - * [#4492](https://github.com/pmd/pmd/issues/4492): \[java] GuardLogStatement gives false positive when argument is a Java method reference - * [#4503](https://github.com/pmd/pmd/issues/4503): \[java] JUnitTestsShouldIncludeAssert: false negative with TestNG - * [#4516](https://github.com/pmd/pmd/issues/4516): \[java] UnusedLocalVariable: false-negative with try-with-resources - * [#4517](https://github.com/pmd/pmd/issues/4517): \[java] UnusedLocalVariable: false-negative with compound assignments - * [#4518](https://github.com/pmd/pmd/issues/4518): \[java] UnusedLocalVariable: false-positive with multiple for-loop indices - * [#4603](https://github.com/pmd/pmd/issues/4603): \[java] UnusedAssignment false positive in record compact constructor - * [#4625](https://github.com/pmd/pmd/issues/4625): \[java] UnusedPrivateMethod false positive: Autoboxing into Number - * [#4634](https://github.com/pmd/pmd/issues/4634): \[java] JUnit4TestShouldUseTestAnnotation false positive with TestNG - * [#4817](https://github.com/pmd/pmd/issues/4817): \[java] UnusedPrivateMethod false-positive used in lambda -* java-codestyle - * [#1208](https://github.com/pmd/pmd/issues/1208): \[java] PrematureDeclaration rule false-positive on variable declared to measure time - * [#1429](https://github.com/pmd/pmd/issues/1429): \[java] PrematureDeclaration as result of method call (false positive) - * [#1480](https://github.com/pmd/pmd/issues/1480): \[java] IdenticalCatchBranches false positive with return expressions - * [#1673](https://github.com/pmd/pmd/issues/1673): \[java] UselessParentheses false positive with conditional operator - * [#1790](https://github.com/pmd/pmd/issues/1790): \[java] UnnecessaryFullyQualifiedName false positive with enum constant - * [#1918](https://github.com/pmd/pmd/issues/1918): \[java] UselessParentheses false positive with boolean operators - * [#2134](https://github.com/pmd/pmd/issues/2134): \[java] PreserveStackTrace not handling `Throwable.addSuppressed(...)` - * [#2299](https://github.com/pmd/pmd/issues/2299): \[java] UnnecessaryFullyQualifiedName false positive with similar package name - * [#2391](https://github.com/pmd/pmd/issues/2391): \[java] UseDiamondOperator FP when expected type and constructed type have a different parameterization - * [#2528](https://github.com/pmd/pmd/issues/2528): \[java] MethodNamingConventions - JUnit 5 method naming not support ParameterizedTest - * [#2739](https://github.com/pmd/pmd/issues/2739): \[java] UselessParentheses false positive for string concatenation - * [#2748](https://github.com/pmd/pmd/issues/2748): \[java] UnnecessaryCast false positive with unchecked cast - * [#2847](https://github.com/pmd/pmd/issues/2847): \[java] New Rule: Use Explicit Types - * [#2973](https://github.com/pmd/pmd/issues/2973): \[java] New rule: UnnecessaryBoxing - * [#3195](https://github.com/pmd/pmd/pull/3195): \[java] Improve rule UnnecessaryReturn to detect more cases - * [#3218](https://github.com/pmd/pmd/pull/3218): \[java] Generalize UnnecessaryCast to flag all unnecessary casts - * [#3221](https://github.com/pmd/pmd/issues/3221): \[java] PrematureDeclaration false positive for unused variables - * [#3238](https://github.com/pmd/pmd/issues/3238): \[java] Improve ExprContext, fix FNs of UnnecessaryCast - * [#3500](https://github.com/pmd/pmd/pull/3500): \[java] UnnecessaryBoxing - check for Integer.valueOf(String) calls - * [#4239](https://github.com/pmd/pmd/issues/4239): \[java] UnnecessaryLocalBeforeReturn - false positive with catch clause - * [#4268](https://github.com/pmd/pmd/issues/4268): \[java] CommentDefaultAccessModifier: false positive with TestNG annotations - * [#4273](https://github.com/pmd/pmd/issues/4273): \[java] CommentDefaultAccessModifier ignoredAnnotations should include "org.junit.jupiter.api.extension.RegisterExtension" by default - * [#4357](https://github.com/pmd/pmd/pull/4357): \[java] Fix IllegalStateException in UseDiamondOperator rule - * [#4432](https://github.com/pmd/pmd/issues/4432): \[java] \[7.0-rc1] UnnecessaryImport - Unused static import is being used - * [#4455](https://github.com/pmd/pmd/issues/4455): \[java] FieldNamingConventions: false positive with lombok's @UtilityClass - * [#4487](https://github.com/pmd/pmd/issues/4487): \[java] UnnecessaryConstructor: false-positive with @Inject and @Autowired - * [#4511](https://github.com/pmd/pmd/issues/4511): \[java] LocalVariableCouldBeFinal shouldn't report unused variables - * [#4512](https://github.com/pmd/pmd/issues/4512): \[java] MethodArgumentCouldBeFinal shouldn't report unused parameters - * [#4557](https://github.com/pmd/pmd/issues/4557): \[java] UnnecessaryImport FP with static imports of overloaded methods - * [#4578](https://github.com/pmd/pmd/issues/4578): \[java] CommentDefaultAccessModifier comment needs to be before annotation if present - * [#4631](https://github.com/pmd/pmd/issues/4631): \[java] UnnecessaryFullyQualifiedName fails to recognize illegal self reference in enums - * [#4645](https://github.com/pmd/pmd/issues/4645): \[java] CommentDefaultAccessModifier - False Positive with JUnit5's ParameterizedTest - * [#4754](https://github.com/pmd/pmd/pull/4754): \[java] EmptyControlStatementRule: Add allowCommentedBlocks property - * [#4816](https://github.com/pmd/pmd/issues/4816): \[java] UnnecessaryImport false-positive on generic method call with on lambda -* java-design - * [#174](https://github.com/pmd/pmd/issues/174): \[java] SingularField false positive with switch in method that both assigns and reads field - * [#1014](https://github.com/pmd/pmd/issues/1014): \[java] LawOfDemeter: False positive with lambda expression - * [#1605](https://github.com/pmd/pmd/issues/1605): \[java] LawOfDemeter: False positive for standard UTF-8 charset name - * [#2160](https://github.com/pmd/pmd/issues/2160): \[java] Issues with Law of Demeter - * [#2175](https://github.com/pmd/pmd/issues/2175): \[java] LawOfDemeter: False positive for chained methods with generic method call - * [#2179](https://github.com/pmd/pmd/issues/2179): \[java] LawOfDemeter: False positive with static property access - should treat class-level property as global object, not dot-accessed property - * [#2180](https://github.com/pmd/pmd/issues/2180): \[java] LawOfDemeter: False positive with Thread and ThreadLocalRandom - * [#2182](https://github.com/pmd/pmd/issues/2182): \[java] LawOfDemeter: False positive with package-private access - * [#2188](https://github.com/pmd/pmd/issues/2188): \[java] LawOfDemeter: False positive with fields assigned to local vars - * [#2536](https://github.com/pmd/pmd/issues/2536): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal can't detect inner class - * [#3668](https://github.com/pmd/pmd/pull/3668): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal - fix FP with inner private classes - * [#3754](https://github.com/pmd/pmd/issues/3754): \[java] SingularField false positive with read in while condition - * [#3786](https://github.com/pmd/pmd/issues/3786): \[java] SimplifyBooleanReturns should consider operator precedence - * [#3840](https://github.com/pmd/pmd/issues/3840): \[java] LawOfDemeter disallows method call on locally created object - * [#4238](https://github.com/pmd/pmd/pull/4238): \[java] Make LawOfDemeter not use the rulechain - * [#4254](https://github.com/pmd/pmd/issues/4254): \[java] ImmutableField - false positive with Lombok @Setter - * [#4434](https://github.com/pmd/pmd/issues/4434): \[java] \[7.0-rc1] ExceptionAsFlowControl when simply propagating - * [#4456](https://github.com/pmd/pmd/issues/4456): \[java] FinalFieldCouldBeStatic: false positive with lombok's @UtilityClass - * [#4477](https://github.com/pmd/pmd/issues/4477): \[java] SignatureDeclareThrowsException: false-positive with TestNG annotations - * [#4490](https://github.com/pmd/pmd/issues/4490): \[java] ImmutableField - false negative with Lombok @Getter - * [#4549](https://github.com/pmd/pmd/pull/4549): \[java] Make LawOfDemeter results deterministic -* java-documentation - * [#4369](https://github.com/pmd/pmd/pull/4369): \[java] Improve CommentSize - * [#4416](https://github.com/pmd/pmd/pull/4416): \[java] Fix reported line number in CommentContentRule -* java-errorprone - * [#659](https://github.com/pmd/pmd/issues/659): \[java] MissingBreakInSwitch - last default case does not contain a break - * [#718](https://github.com/pmd/pmd/issues/718): \[java] BrokenNullCheck false positive with parameter/field confusion - * [#932](https://github.com/pmd/pmd/issues/932): \[java] SingletonClassReturningNewInstance false positive with double assignment - * [#1005](https://github.com/pmd/pmd/issues/1005): \[java] CloneMethodMustImplementCloneable triggers for interfaces - * [#1669](https://github.com/pmd/pmd/issues/1669): \[java] NullAssignment - FP with ternay and null as constructor argument - * [#1831](https://github.com/pmd/pmd/issues/1831): \[java] DetachedTestCase reports abstract methods - * [#1899](https://github.com/pmd/pmd/issues/1899): \[java] Recognize @SuppressWanings("fallthrough") for MissingBreakInSwitch - * [#2320](https://github.com/pmd/pmd/issues/2320): \[java] NullAssignment - FP with ternary and null as method argument - * [#2532](https://github.com/pmd/pmd/issues/2532): \[java] AvoidDecimalLiteralsInBigDecimalConstructor can not detect the case `new BigDecimal(Expression)` - * [#2579](https://github.com/pmd/pmd/issues/2579): \[java] MissingBreakInSwitch detects the lack of break in the last case - * [#2880](https://github.com/pmd/pmd/issues/2880): \[java] CompareObjectsWithEquals - false negative with type res - * [#2893](https://github.com/pmd/pmd/issues/2893): \[java] Remove special cases from rule EmptyCatchBlock - * [#2894](https://github.com/pmd/pmd/issues/2894): \[java] Improve MissingBreakInSwitch - * [#3071](https://github.com/pmd/pmd/issues/3071): \[java] BrokenNullCheck FP with PMD 6.30.0 - * [#3087](https://github.com/pmd/pmd/issues/3087): \[java] UnnecessaryBooleanAssertion overlaps with SimplifiableTestAssertion - * [#3100](https://github.com/pmd/pmd/issues/3100): \[java] UseCorrectExceptionLogging FP in 6.31.0 - * [#3173](https://github.com/pmd/pmd/issues/3173): \[java] UseProperClassLoader false positive - * [#3351](https://github.com/pmd/pmd/issues/3351): \[java] ConstructorCallsOverridableMethod ignores abstract methods - * [#3400](https://github.com/pmd/pmd/issues/3400): \[java] AvoidUsingOctalValues FN with underscores - * [#3843](https://github.com/pmd/pmd/issues/3843): \[java] UseEqualsToCompareStrings should consider return type - * [#4063](https://github.com/pmd/pmd/issues/4063): \[java] AvoidBranchingStatementAsLastInLoop: False-negative about try/finally block - * [#4356](https://github.com/pmd/pmd/pull/4356): \[java] Fix NPE in CloseResourceRule - * [#4449](https://github.com/pmd/pmd/issues/4449): \[java] AvoidAccessibilityAlteration: Possible false positive in AvoidAccessibilityAlteration rule when using Lambda expression - * [#4457](https://github.com/pmd/pmd/issues/4457): \[java] OverrideBothEqualsAndHashcode: false negative with anonymous classes - * [#4493](https://github.com/pmd/pmd/issues/4493): \[java] MissingStaticMethodInNonInstantiatableClass: false-positive about @Inject - * [#4505](https://github.com/pmd/pmd/issues/4505): \[java] ImplicitSwitchFallThrough NPE in PMD 7.0.0-rc1 - * [#4510](https://github.com/pmd/pmd/issues/4510): \[java] ConstructorCallsOverridableMethod: false positive with lombok's @Value - * [#4513](https://github.com/pmd/pmd/issues/4513): \[java] UselessOperationOnImmutable various false negatives with String - * [#4514](https://github.com/pmd/pmd/issues/4514): \[java] AvoidLiteralsInIfCondition false positive and negative for String literals when ignoreExpressions=true - * [#4546](https://github.com/pmd/pmd/issues/4546): \[java] OverrideBothEqualsAndHashCode ignores records - * [#4719](https://github.com/pmd/pmd/pull/4719): \[java] UnnecessaryCaseChange: example doc toUpperCase() should compare to a capitalized string -* java-multithreading - * [#2537](https://github.com/pmd/pmd/issues/2537): \[java] DontCallThreadRun can't detect the case that call run() in `this.run()` - * [#2538](https://github.com/pmd/pmd/issues/2538): \[java] DontCallThreadRun can't detect the case that call run() in `foo.bar.run()` - * [#2577](https://github.com/pmd/pmd/issues/2577): \[java] UseNotifyAllInsteadOfNotify falsely detect a special case with argument: `foo.notify(bar)` - * [#4483](https://github.com/pmd/pmd/issues/4483): \[java] NonThreadSafeSingleton false positive with double-checked locking -* java-performance - * [#1224](https://github.com/pmd/pmd/issues/1224): \[java] InefficientEmptyStringCheck false negative in anonymous class - * [#2587](https://github.com/pmd/pmd/issues/2587): \[java] AvoidArrayLoops could also check for list copy through iterated List.add() - * [#2712](https://github.com/pmd/pmd/issues/2712): \[java] SimplifyStartsWith false-positive with AssertJ - * [#3486](https://github.com/pmd/pmd/pull/3486): \[java] InsufficientStringBufferDeclaration: Fix NPE - * [#3848](https://github.com/pmd/pmd/issues/3848): \[java] StringInstantiation: false negative when using method result - * [#4070](https://github.com/pmd/pmd/issues/4070): \[java] A false positive about the rule RedundantFieldInitializer - * [#4458](https://github.com/pmd/pmd/issues/4458): \[java] RedundantFieldInitializer: false positive with lombok's @Value -* javascript - * [#4673](https://github.com/pmd/pmd/pull/4673): \[javascript] CPD: Added support for decorator notation -* kotlin - * [#419](https://github.com/pmd/pmd/issues/419): \[kotlin] Add support for Kotlin - * [#4389](https://github.com/pmd/pmd/pull/4389): \[kotlin] Update grammar to version 1.8 -* plsql - * [#4820](https://github.com/pmd/pmd/issues/4820): \[plsql] WITH clause is ignored for SELECT INTO statements -* swift - * [#1877](https://github.com/pmd/pmd/pull/1877): \[swift] Feature/swift rules - * [#1882](https://github.com/pmd/pmd/pull/1882): \[swift] UnavailableFunction Swift rule - * [#4697](https://github.com/pmd/pmd/issues/4697): \[swift] Support Swift 5.9 features (mainly macros expansion expressions) -* xml - * [#1800](https://github.com/pmd/pmd/pull/1800): \[xml] Unimplement org.w3c.dom.Node from the XmlNodeWrapper -* xml-bestpractices - * [#4592](https://github.com/pmd/pmd/pull/4592): \[xml] Add MissingEncoding rule - -## ✨ External Contributions - -* [#1658](https://github.com/pmd/pmd/pull/1658): \[core] Node support for Antlr-based languages - [Matías Fraga](https://github.com/matifraga) (@matifraga) -* [#1698](https://github.com/pmd/pmd/pull/1698): \[core] [swift] Antlr Base Parser adapter and Swift Implementation - [Lucas Soncini](https://github.com/lsoncini) (@lsoncini) -* [#1774](https://github.com/pmd/pmd/pull/1774): \[core] Antlr visitor rules - [Lucas Soncini](https://github.com/lsoncini) (@lsoncini) -* [#1877](https://github.com/pmd/pmd/pull/1877): \[swift] Feature/swift rules - [Matías Fraga](https://github.com/matifraga) (@matifraga) -* [#1881](https://github.com/pmd/pmd/pull/1881): \[doc] Add ANTLR documentation - [Matías Fraga](https://github.com/matifraga) (@matifraga) -* [#1882](https://github.com/pmd/pmd/pull/1882): \[swift] UnavailableFunction Swift rule - [Tomás de Lucca](https://github.com/tomidelucca) (@tomidelucca) -* [#2830](https://github.com/pmd/pmd/pull/2830): \[apex] Apexlink POC - [Kevin Jones](https://github.com/nawforce) (@nawforce) -* [#3866](https://github.com/pmd/pmd/pull/3866): \[core] Add CLI Progress Bar - [@JerritEic](https://github.com/JerritEic) (@JerritEic) -* [#4093](https://github.com/pmd/pmd/pull/4093): \[apex] Summit-AST Apex module - Part 1 - [Edward Klimoshenko](https://github.com/eklimo) (@eklimo) -* [#4151](https://github.com/pmd/pmd/pull/4151): \[apex] Summit-AST Apex module - Part 2 - expression nodes - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) -* [#4171](https://github.com/pmd/pmd/pull/4171): \[apex] Summit-AST Apex module - Part 3 - initializers - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) -* [#4206](https://github.com/pmd/pmd/pull/4206): \[apex] Summit-AST Apex module - Part 4 - statements - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) -* [#4219](https://github.com/pmd/pmd/pull/4219): \[apex] Summit-AST Apex module - Part 5 - annotations, triggers, misc. - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) -* [#4242](https://github.com/pmd/pmd/pull/4242): \[apex] Merge 6.52 into experimental-apex-parser - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) -* [#4251](https://github.com/pmd/pmd/pull/4251): \[apex] Summit-AST Apex module - Part 6 Passing testsuite - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) -* [#4402](https://github.com/pmd/pmd/pull/4402): \[javascript] CPD: add support for Typescript using antlr4 grammar - [Paul Guyot](https://github.com/pguyot) (@pguyot) -* [#4403](https://github.com/pmd/pmd/pull/4403): \[julia] CPD: Add support for Julia code duplication - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) -* [#4412](https://github.com/pmd/pmd/pull/4412): \[doc] Added new error msg to ConstantsInInterface - [David Ljunggren](https://github.com/dague1) (@dague1) -* [#4426](https://github.com/pmd/pmd/pull/4426): \[cpd] New XML to HTML XLST report format for PMD CPD - [mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) (@mohan-chinnappan-n) -* [#4428](https://github.com/pmd/pmd/pull/4428): \[apex] ApexBadCrypto bug fix for #4427 - inline detection of hard coded values - [Steven Stearns](https://github.com/sfdcsteve) (@sfdcsteve) -* [#4431](https://github.com/pmd/pmd/pull/4431): \[coco] CPD: Coco support for code duplication detection - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) -* [#4444](https://github.com/pmd/pmd/pull/4444): \[java] CommentDefaultAccessModifier - ignore org.junit.jupiter.api.extension.RegisterExtension by default - [Nirvik Patel](https://github.com/nirvikpatel) (@nirvikpatel) -* [#4448](https://github.com/pmd/pmd/pull/4448): \[apex] Bump summit-ast to new release 2.1.0 (and remove workaround) - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) -* [#4450](https://github.com/pmd/pmd/pull/4450): \[java] Fix #4449 AvoidAccessibilityAlteration: Correctly handle Lambda expressions in PrivilegedAction scenarios - [Seren](https://github.com/mohui1999) (@mohui1999) -* [#4452](https://github.com/pmd/pmd/pull/4452): \[doc] Update PMD_APEX_ROOT_DIRECTORY documentation reference - [nwcm](https://github.com/nwcm) (@nwcm) -* [#4470](https://github.com/pmd/pmd/pull/4470): \[cpp] CPD: Added strings as literal and ignore identifiers in sequences - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) -* [#4474](https://github.com/pmd/pmd/pull/4474): \[java] ImmutableField: False positive with lombok (fixes #4254) - [Pim van der Loos](https://github.com/PimvanderLoos) (@PimvanderLoos) -* [#4479](https://github.com/pmd/pmd/pull/4479): \[apex] Merge main (7.x) branch into experimental-apex-parser and fix tests - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) -* [#4488](https://github.com/pmd/pmd/pull/4488): \[java] Fix #4477: A false-positive about SignatureDeclareThrowsException - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4494](https://github.com/pmd/pmd/pull/4494): \[java] Fix #4487: A false-positive about UnnecessaryConstructor and @Inject and @Autowired - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4495](https://github.com/pmd/pmd/pull/4495): \[java] Fix #4493: false-positive about MissingStaticMethodInNonInstantiatableClass and @Inject - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4507](https://github.com/pmd/pmd/pull/4507): \[java] Fix #4503: A false negative about JUnitTestsShouldIncludeAssert and testng - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4520](https://github.com/pmd/pmd/pull/4520): \[doc] Fix typo: missing closing quotation mark after CPD-END - [João Dinis Ferreira](https://github.com/joaodinissf) (@joaodinissf) -* [#4528](https://github.com/pmd/pmd/pull/4528): \[apex] Update to apexlink - [Kevin Jones](https://github.com/nawforce) (@nawforce) -* [#4533](https://github.com/pmd/pmd/pull/4533): \[java] Fix #4063: False-negative about try/catch block in Loop - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4536](https://github.com/pmd/pmd/pull/4536): \[java] Fix #4268: CommentDefaultAccessModifier - false positive with TestNG's @Test annotation - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4537](https://github.com/pmd/pmd/pull/4537): \[java] Fix #4455: A false positive about FieldNamingConventions and UtilityClass - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4538](https://github.com/pmd/pmd/pull/4538): \[java] Fix #4456: A false positive about FinalFieldCouldBeStatic and UtilityClass - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4540](https://github.com/pmd/pmd/pull/4540): \[java] Fix #4457: false negative about OverrideBothEqualsAndHashcode - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4541](https://github.com/pmd/pmd/pull/4541): \[java] Fix #4458: A false positive about RedundantFieldInitializer and @Value - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4542](https://github.com/pmd/pmd/pull/4542): \[java] Fix #4510: A false positive about ConstructorCallsOverridableMethod and @Value - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) -* [#4553](https://github.com/pmd/pmd/pull/4553): \[java] Fix #4492: GuardLogStatement gives false positive when argument is a Java method reference - [Anastasiia Koba](https://github.com/anastasiia-koba) (@anastasiia-koba) -* [#4562](https://github.com/pmd/pmd/pull/4562): \[apex] Fixes #4556 - Update Apex bind regex match for all possible combinations - [nwcm](https://github.com/nwcm) (@nwcm) -* [#4637](https://github.com/pmd/pmd/pull/4637): \[java] fix #4634 - JUnit4TestShouldUseTestAnnotation false positive with TestNG - [Krystian Dabrowski](https://github.com/krdabrowski) (@krdabrowski) -* [#4640](https://github.com/pmd/pmd/pull/4640): \[cli] Launch script fails if run via "bash pmd" - [Shai Bennathan](https://github.com/shai-bennathan) (@shai-bennathan) -* [#4649](https://github.com/pmd/pmd/pull/4649): \[apex] Add SObjectType and SObjectField to list of injectable SOQL variable types - [Richard Corfield](https://github.com/rcorfieldffdc) (@rcorfieldffdc) -* [#4651](https://github.com/pmd/pmd/pull/4651): \[doc] Add "Tencent Cloud Code Analysis" in Tools / Integrations - [yale](https://github.com/cyw3) (@cyw3) -* [#4664](https://github.com/pmd/pmd/pull/4664): \[cli] CPD: Fix NPE when only `--file-list` is specified - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) -* [#4665](https://github.com/pmd/pmd/pull/4665): \[java] Doc: Fix references AutoClosable -> AutoCloseable - [Andrey Bozhko](https://github.com/AndreyBozhko) (@AndreyBozhko) -* [#4673](https://github.com/pmd/pmd/pull/4673): \[javascript] CPD: Added support for decorator notation - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) -* [#4677](https://github.com/pmd/pmd/pull/4677): \[apex] Add new rule: OperationWithHighCostInLoop - [Thomas Prouvot](https://github.com/tprouvot) (@tprouvot) -* [#4698](https://github.com/pmd/pmd/pull/4698): \[swift] Add macro expansion support for swift 5.9 - [Richard B.](https://github.com/kenji21) (@kenji21) -* [#4706](https://github.com/pmd/pmd/pull/4706): \[java] DetachedTestCase should not report on abstract methods - [Debamoy Datta](https://github.com/Debamoy) (@Debamoy) -* [#4719](https://github.com/pmd/pmd/pull/4719): \[java] UnnecessaryCaseChange: example doc toUpperCase() should compare to a capitalized string - [ciufudean](https://github.com/ciufudean) (@ciufudean) -* [#4738](https://github.com/pmd/pmd/pull/4738): \[doc] Added reference to the PMD extension for bld - [Erik C. Thauvin](https://github.com/ethauvin) (@ethauvin) -* [#4749](https://github.com/pmd/pmd/pull/4749): Fixes NoSuchMethodError on processing errors in pmd-compat6 - [Andreas Bergander](https://github.com/bergander) (@bergander) -* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer - [219sansim](https://github.com/219sansim) (@219sansim) -* [#4752](https://github.com/pmd/pmd/pull/4752): \[core] Fix flaky LatticeRelationTest - [219sansim](https://github.com/219sansim) (@219sansim) -* [#4754](https://github.com/pmd/pmd/pull/4754): \[java] EmptyControlStatementRule: Add allowCommentedBlocks property - [Andreas Bergander](https://github.com/bergander) (@bergander) -* [#4759](https://github.com/pmd/pmd/pull/4759): \[java] fix: remove delimiter attribute from ruleset category/java/errorprone.xml - [Marcin Dąbrowski](https://github.com/marcindabrowski) (@marcindabrowski) -* [#4825](https://github.com/pmd/pmd/pull/4825): \[plsql] Fix ignored WITH clause for SELECT INTO statements - [Laurent Bovet](https://github.com/lbovet) (@lbovet) -* [#4857](https://github.com/pmd/pmd/pull/4857): \[javascript] Fix UnnecessaryBlock issues with empty statements - [Oleksandr Shvets](https://github.com/oleksandr-shvets) (@oleksandr-shvets) diff --git a/pmd-ant/pom.xml b/pmd-ant/pom.xml index 3c47ac7843..ce517cdd1a 100644 --- a/pmd-ant/pom.xml +++ b/pmd-ant/pom.xml @@ -7,7 +7,7 @@ pmd net.sourceforge.pmd - 7.1.0 + 7.2.0-SNAPSHOT 4.0.0 diff --git a/pmd-apex/pom.xml b/pmd-apex/pom.xml index 125cc7225b..42af8646ed 100644 --- a/pmd-apex/pom.xml +++ b/pmd-apex/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-cli/pom.xml b/pmd-cli/pom.xml index 9145c0bf72..9b7a284ad1 100644 --- a/pmd-cli/pom.xml +++ b/pmd-cli/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-coco/pom.xml b/pmd-coco/pom.xml index 61894b4bd0..fe97db0606 100644 --- a/pmd-coco/pom.xml +++ b/pmd-coco/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-compat6/pom.xml b/pmd-compat6/pom.xml index e4133ae530..c2f957d9a1 100644 --- a/pmd-compat6/pom.xml +++ b/pmd-compat6/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT pmd-compat6 diff --git a/pmd-core/pom.xml b/pmd-core/pom.xml index 43c5c7750c..62e389fde9 100644 --- a/pmd-core/pom.xml +++ b/pmd-core/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-cpp/pom.xml b/pmd-cpp/pom.xml index 966136b0a1..83e10131b0 100644 --- a/pmd-cpp/pom.xml +++ b/pmd-cpp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-cs/pom.xml b/pmd-cs/pom.xml index fd9e9108ba..35d1e15296 100644 --- a/pmd-cs/pom.xml +++ b/pmd-cs/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-dart/pom.xml b/pmd-dart/pom.xml index 7fb657f2f9..795188bfe7 100644 --- a/pmd-dart/pom.xml +++ b/pmd-dart/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index 92c78888f7..72a6d4c1d5 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-doc/pom.xml b/pmd-doc/pom.xml index 472d0a0c42..2d9a5acba0 100644 --- a/pmd-doc/pom.xml +++ b/pmd-doc/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-fortran/pom.xml b/pmd-fortran/pom.xml index 9d83a46377..754de6aa55 100644 --- a/pmd-fortran/pom.xml +++ b/pmd-fortran/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-gherkin/pom.xml b/pmd-gherkin/pom.xml index 7062166114..79f5588ae7 100644 --- a/pmd-gherkin/pom.xml +++ b/pmd-gherkin/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-go/pom.xml b/pmd-go/pom.xml index 49b3b2d271..e3e1490468 100644 --- a/pmd-go/pom.xml +++ b/pmd-go/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-groovy/pom.xml b/pmd-groovy/pom.xml index f15a81bc87..677f0d4559 100644 --- a/pmd-groovy/pom.xml +++ b/pmd-groovy/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-html/pom.xml b/pmd-html/pom.xml index 4e07912b1e..c1168e66f5 100644 --- a/pmd-html/pom.xml +++ b/pmd-html/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-java/pom.xml b/pmd-java/pom.xml index 97951c5875..b85f32cfb0 100644 --- a/pmd-java/pom.xml +++ b/pmd-java/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-javascript/pom.xml b/pmd-javascript/pom.xml index eae383689d..72383cc5f4 100644 --- a/pmd-javascript/pom.xml +++ b/pmd-javascript/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-jsp/pom.xml b/pmd-jsp/pom.xml index dd6830dce2..eec8282f65 100644 --- a/pmd-jsp/pom.xml +++ b/pmd-jsp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-julia/pom.xml b/pmd-julia/pom.xml index f4871dc9ea..6ec7333e73 100644 --- a/pmd-julia/pom.xml +++ b/pmd-julia/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-kotlin/pom.xml b/pmd-kotlin/pom.xml index d0fa0cab92..d27eaa6d4f 100644 --- a/pmd-kotlin/pom.xml +++ b/pmd-kotlin/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-lang-test/pom.xml b/pmd-lang-test/pom.xml index 095312b601..f4a8683885 100644 --- a/pmd-lang-test/pom.xml +++ b/pmd-lang-test/pom.xml @@ -12,7 +12,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-languages-deps/pom.xml b/pmd-languages-deps/pom.xml index 1a97f9dbb6..1a85089052 100644 --- a/pmd-languages-deps/pom.xml +++ b/pmd-languages-deps/pom.xml @@ -4,7 +4,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT pmd-languages-deps diff --git a/pmd-lua/pom.xml b/pmd-lua/pom.xml index 58f4434b59..90ee0372cc 100644 --- a/pmd-lua/pom.xml +++ b/pmd-lua/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-matlab/pom.xml b/pmd-matlab/pom.xml index e719086307..7c4720f2e0 100644 --- a/pmd-matlab/pom.xml +++ b/pmd-matlab/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-modelica/pom.xml b/pmd-modelica/pom.xml index a1cc5bf932..f58bc85456 100644 --- a/pmd-modelica/pom.xml +++ b/pmd-modelica/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-objectivec/pom.xml b/pmd-objectivec/pom.xml index ea1da86146..2604418fa1 100644 --- a/pmd-objectivec/pom.xml +++ b/pmd-objectivec/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-perl/pom.xml b/pmd-perl/pom.xml index 9520bcf5f3..87f9b71de0 100644 --- a/pmd-perl/pom.xml +++ b/pmd-perl/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-php/pom.xml b/pmd-php/pom.xml index f434480005..2a0024663e 100644 --- a/pmd-php/pom.xml +++ b/pmd-php/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-plsql/pom.xml b/pmd-plsql/pom.xml index 314856817f..a5d78eb138 100644 --- a/pmd-plsql/pom.xml +++ b/pmd-plsql/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-python/pom.xml b/pmd-python/pom.xml index eb840fe60a..544653426a 100644 --- a/pmd-python/pom.xml +++ b/pmd-python/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-ruby/pom.xml b/pmd-ruby/pom.xml index 9ba43f87ce..b3f4438adb 100644 --- a/pmd-ruby/pom.xml +++ b/pmd-ruby/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-scala-modules/pmd-scala-common/pom.xml b/pmd-scala-modules/pmd-scala-common/pom.xml index 9c4022628e..53c5eb2fc4 100644 --- a/pmd-scala-modules/pmd-scala-common/pom.xml +++ b/pmd-scala-modules/pmd-scala-common/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../../pom.xml diff --git a/pmd-scala-modules/pmd-scala_2.12/pom.xml b/pmd-scala-modules/pmd-scala_2.12/pom.xml index 8ccdf84c96..baaab7828f 100644 --- a/pmd-scala-modules/pmd-scala_2.12/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.12/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd-scala-common - 7.1.0 + 7.2.0-SNAPSHOT ../pmd-scala-common/pom.xml diff --git a/pmd-scala-modules/pmd-scala_2.13/pom.xml b/pmd-scala-modules/pmd-scala_2.13/pom.xml index 2be8020812..4de45c6687 100644 --- a/pmd-scala-modules/pmd-scala_2.13/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.13/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd-scala-common - 7.1.0 + 7.2.0-SNAPSHOT ../pmd-scala-common/pom.xml diff --git a/pmd-swift/pom.xml b/pmd-swift/pom.xml index 2f2a970c9a..266dba8c63 100644 --- a/pmd-swift/pom.xml +++ b/pmd-swift/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-test-schema/pom.xml b/pmd-test-schema/pom.xml index e5ce4edbdd..0e823d7615 100644 --- a/pmd-test-schema/pom.xml +++ b/pmd-test-schema/pom.xml @@ -11,7 +11,7 @@ pmd net.sourceforge.pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-test/pom.xml b/pmd-test/pom.xml index f89c707f40..9ffded1716 100644 --- a/pmd-test/pom.xml +++ b/pmd-test/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-tsql/pom.xml b/pmd-tsql/pom.xml index b629638f87..9be8d9d168 100644 --- a/pmd-tsql/pom.xml +++ b/pmd-tsql/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-velocity/pom.xml b/pmd-velocity/pom.xml index 5ed458e262..06340fa7b1 100644 --- a/pmd-velocity/pom.xml +++ b/pmd-velocity/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-visualforce/pom.xml b/pmd-visualforce/pom.xml index d59bd04a4d..735f07a958 100644 --- a/pmd-visualforce/pom.xml +++ b/pmd-visualforce/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml index 63fd135277..183347631e 100644 --- a/pmd-xml/pom.xml +++ b/pmd-xml/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index a7937c209c..ac3ec783f2 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.sourceforge.pmd pmd - 7.1.0 + 7.2.0-SNAPSHOT pom PMD @@ -60,7 +60,7 @@ scm:git:git://github.com/pmd/pmd.git scm:git:ssh://git@github.com/pmd/pmd.git https://github.com/pmd/pmd - pmd_releases/7.1.0 + HEAD From 656330c937ea459acddb1357ab967d88ef31a123 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 12:03:53 +0200 Subject: [PATCH 077/142] Use pmd 7.1.0 for checks --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index ac3ec783f2..11d7bef738 100644 --- a/pom.xml +++ b/pom.xml @@ -546,22 +546,22 @@ net.sourceforge.pmd pmd-core - 7.0.0 + 7.1.0 net.sourceforge.pmd pmd-java - 7.0.0 + 7.1.0 net.sourceforge.pmd pmd-jsp - 7.0.0 + 7.1.0 net.sourceforge.pmd pmd-javascript - 7.0.0 + 7.1.0 From 6a1c7de03c92d9c98bdc10102068bb04a307e4a0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 12:42:04 +0200 Subject: [PATCH 078/142] [doc] Restore release_notes_pmd7.md Was accidentally removed by 339e1d4f436a27f6bb7d1891d835d3f8b4d173d0 --- docs/pages/release_notes_pmd7.md | 3544 ++++++++++++++++++++++++++++++ 1 file changed, 3544 insertions(+) diff --git a/docs/pages/release_notes_pmd7.md b/docs/pages/release_notes_pmd7.md index 8b13789179..b8024d9779 100644 --- a/docs/pages/release_notes_pmd7.md +++ b/docs/pages/release_notes_pmd7.md @@ -1 +1,3545 @@ +--- +title: Detailed Release Notes for PMD 7 +summary: "These are the detailed release notes for PMD 7." +permalink: pmd_release_notes_pmd7.html +keywords: changelog, release notes +--- +## 🚀 Major Features and Enhancements + +### New official logo + +Many of you probably have already seen the new logo, but now it's time to actually ship it. The new logo +was long ago decided (see [#1663](https://github.com/pmd/pmd/issues/1663)). + +We decided it's time to have a modernized logo and get rid of the gun. This allows to include +the logo anywhere without offense. + +The official logo is also without a tagline (such as "Code Quality Matters!") as the tagline created some +controversies. Without a tagline, we are not limited in the direction of future development of PMD. + +![New PMD Logo](images/logo/pmd-logo-300px.png) + +The new logo is available from the [Logo Project Page](pmd_projectdocs_logo.html). + +### Revamped Java + +The Java grammar has been refactored substantially in order to make it easier to maintain and more correct +regarding the Java Language Specification. It supports now also the edge-cases where PMD 6 was failing +(e.g. annotations were not supported everywhere). Changing the grammar entails a changed AST and therefore changed +rules. The PMD built-in rules have all been upgraded and many bugs have been fixed on the way. +Unfortunately, if you are using custom rules, you will most probably need to accommodate these changes yourself. + +The type resolution framework has been rewritten from scratch and should now cover the entire Java spec correctly. +The same is true for the symbol table. +PMD 6 on the other hand has always had problems with advanced type inference, e.g. with lambdas and call chains. +Since it was built on the core reflection API, it also was prone to linkage errors and classloader leaks for instance. +PMD 7 does not need to load classes, and does not have these problems. + +The AST exposes much more semantic information now. For instance, you can jump from a method call to +the declaration of the method being called, or from a field access to the field declaration. These +improvements allow interesting rules to be written that need precise knowledge of the types +in the program, for instance to detect [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) +or [`UseDiamondOperator`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#usediamondoperator). +These are just a small preview of the new rules we will be adding in the PMD 7 release cycle. + +Overall, the changes to the parser, AST, type resolution and symbol table code has made PMD for +Java **significantly faster**. On average, we have seen ~2-3X faster analysis, but as usual, this may change +depending on your workload, configuration and ruleset. + +Contributors: [Clément Fournier](https://github.com/oowekyala) (@oowekyala), +[Andreas Dangel](https://github.com/adangel) (@adangel), +[Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod) + + + +### Revamped Command Line Interface + +PMD now ships with a unified Command Line Interface for both Linux/Unix and Windows. Instead of having a collection +of scripts for the different utilities shipped with PMD, a single script `pmd` (`pmd.bat` for Windows) can now +launch all utilities using subcommands, e.g. `pmd check`, `pmd designer`. All commands and options are thoroughly +documented in the help, with full color support where available. Moreover, efforts were made to provide consistency +in the usage of all PMD utilities. + +```shell +$ Usage: pmd [-hV] [COMMAND] + -h, --help Show this help message and exit. + -V, --version Print version information and exit. +Commands: + check The PMD standard source code analyzer + cpd Copy/Paste Detector - find duplicate code + designer The PMD visual rule designer + cpd-gui GUI for the Copy/Paste Detector + Warning: May not support the full CPD feature set + ast-dump Experimental: dumps the AST of parsing source code +Exit Codes: + 0 Successful analysis, no violations found + 1 An unexpected error occurred during execution + 2 Usage error, please refer to the command help + 4 Successful analysis, at least 1 violation found +``` + +For instance, where you previously would have run +```shell +run.sh pmd -d src -R ruleset.xml +``` +you should now use +```shell +pmd check -d src -R ruleset.xml +``` +or even better, omit using `-d` / `--dir` and simply pass the sources at the end of the parameter list + +```shell +pmd check -R ruleset.xml src +``` + +Multiple source directories can be passed, such as: +```shell +pmd check -R ruleset.xml src/main/java src/test/java +``` + +And the exact same applies to CPD: +```shell +pmd cpd --minimum-tokens 100 src/main/java +``` + +Additionally, the CLI for the `check` command has been enhanced with a progress bar, which interactively displays the +current progress of the analysis. + +![Demo](images/userdocs/pmd-demo.gif) + +This can be disabled with the `--no-progress` flag. + +Finally, we now provide a completion script for Bash/Zsh to further help daily usage. +To use it, edit your `~/.bashrc` / `~/.zshrc` file and add the following line: + +``` +source <(pmd generate-completion) +``` + +Contributors: [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod) + +### Full Antlr support + +PMD 6 only supported JavaCC based grammars, but with [Antlr](https://www.antlr.org/) parsers +can be generated as well. Languages backed by an Antlr grammar are now fully supported. This means, it's now +possible not only to use Antlr grammars for CPD, but we can actually build full-fledged PMD rules for them as well. +Both the traditional Java visitor rules, and the simpler XPath rules are available to users. This allows +to leverage existing grammars. + +We expect this to enable both our dev team and external contributors to largely extend PMD usage for more languages. + +Two languages (Swift and Kotlin) already use this new possibility. + +See the documentation page [Adding a new language with ANTLR](pmd_devdocs_major_adding_new_language_antlr.html) +for instructions on how to use this new feature. + +Contributors: [Lucas Soncini](https://github.com/lsoncini) (@lsoncini), +[Matías Fraga](https://github.com/matifraga) (@matifraga), +[Tomás De Lucca](https://github.com/tomidelucca) (@tomidelucca) + +### Updated PMD Designer + +This PMD release ships a new version of the pmd-designer. The designer artifact has been +renamed from "pmd-ui" to "pmd-designer". While the designer still works with Java 8, the +recommended Java Runtime is Java 11 (or later) with OpenJFX 17 (or later). + +For the detailed changes, see +* [PMD Designer Changelog (7.0.0)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0). +* [PMD Designer Changelog (7.0.0-rc4)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0-rc4). +* [PMD Designer Changelog (7.0.0-rc1)](https://github.com/pmd/pmd-designer/releases/tag/7.0.0-rc1). + +### New CPD report format cpdhtml-v2.xslt + +Thanks to @mohan-chinnappan-n a new CPD report format has been added which features a data table. +It uses an XSLT stylesheet to convert CPD's XML format into HTML. + +See [the example report](report-examples/cpdhtml-v2.html). + +Contributors: [Mohan Chinnappan](https://github.com/mohan-chinnappan-n) (@mohan-chinnappan-n) + +## 🎉 Language Related Changes + +### New: CPD support for Apache Velocity Template Language (VTL) + +PMD supported Apache Velocity for a very long time, but the CPD integration never got finished. +This is now done and CPD supports Apache Velocity Template language for detecting copy and paste. +It is shipped in the module `pmd-velocity`. + +### New: CPD support for Coco + +Thanks to a contribution, CPD now supports Coco, a modern programming language +designed specifically for building event-driven software. It is shipped in the new +module `pmd-coco`. + +Contributors: [Wener](https://github.com/wener-tiobe) (@wener-tiobe) + +### New: CPD support for Julia + +Thanks to a contribution, CPD now supports the Julia language. It is shipped +in the new module `pmd-julia`. + +Contributors: [Wener](https://github.com/wener-tiobe) (@wener-tiobe) + +### New: CPD support for TypeScript + +Thanks to a contribution, CPD now supports the TypeScript language. It is shipped +with the rest of the JavaScript support in the module `pmd-javascript`. + +Contributors: [Paul Guyot](https://github.com/pguyot) (@pguyot) + +### New: Java 21 and 22 Support + +This release of PMD brings support for Java 21 and 22. There are the following new standard language features, +that are supported now: + +* [JEP 456: Unnamed Variables & Patterns](https://openjdk.org/jeps/456) (Java 22) +* [JEP 440: Record Patterns](https://openjdk.org/jeps/440) (Java 21) +* [JEP 441: Pattern Matching for switch](https://openjdk.org/jeps/441) (Java 21) + +PMD also supports the following preview language features: + +* [JEP 447: Statements before super(...) (Preview)](https://openjdk.org/jeps/447) (Java 22) +* [JEP 459: String Templates (Second Preview)](https://openjdk.org/jeps/459) (Java 21 and 22) +* [JEP 463: Implicitly Declared Classes and Instance Main Methods (Second Preview)](https://openjdk.org/jeps/463) (Java 21 and 22) + +In order to analyze a project with PMD that uses these preview language features, +you'll need to enable it via the environment variable `PMD_JAVA_OPTS` and select the new language +version `22-preview`: + + export PMD_JAVA_OPTS=--enable-preview + pmd check --use-version java-22-preview ... + +Note: Support for Java 19 and Java 20 preview language features have been removed. The versions "19-preview" and +"20-preview" are no longer available. + +### New: Kotlin support + +PMD now supports Kotlin as an additional language for analyzing source code. It is based on +the official kotlin Antlr grammar for Kotlin 1.8. Java-based rules and XPath-based rules are supported. + +We are shipping the following rules: + +* [`FunctionNameTooShort`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_kotlin_bestpractices.html#functionnametooshort) finds functions with a too + short name. +* [`OverrideBothEqualsAndHashcode`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_kotlin_errorprone.html#overridebothequalsandhashcode) finds classes with only + either `equals` or `hashCode` overridden, but not both. This leads to unexpected behavior once instances + of such classes are used in collections (Lists, HashMaps, ...). + +Contributors: [Jeroen Borgers](https://github.com/jborgers) (@jborgers), +[Peter Paul Bakker](https://github.com/stokpop) (@stokpop) + +### New: Swift support + +Given the full Antlr support, PMD now fully supports Swift for creating rules. Previously only CPD was supported. + +Note: There is only limited support for newer Swift language features in the parser, e.g. Swift 5.9 (Macro Expansions) +are supported, but other features are not. + +We are pleased to announce we are shipping a number of rules starting with PMD 7. + +* [`ForceCast`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_errorprone.html#forcecast) flags all force casts, making sure you are + defensively considering all types. Having the application crash shouldn't be an option. +* [`ForceTry`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_errorprone.html#forcetry) flags all force tries, making sure you are + defensively handling exceptions. Having the application crash shouldn't be an option. +* [`ProhibitedInterfaceBuilder`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_bestpractices.html#prohibitedinterfacebuilder) flags any usage of interface + builder. Interface builder files are prone to merge conflicts, and are impossible to code review, so larger + teams usually try to avoid it or reduce its usage. +* [`UnavailableFunction`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_bestpractices.html#unavailablefunction) flags any function throwing + a `fatalError` not marked as `@available(*, unavailable)` to ensure no calls are actually performed in + the codebase. + +Contributors: [Lucas Soncini](https://github.com/lsoncini) (@lsoncini), +[Matías Fraga](https://github.com/matifraga) (@matifraga), +[Tomás De Lucca](https://github.com/tomidelucca) (@tomidelucca) + +### Changed: Apex Support: Replaced Jorje with fully open source front-end + +When PMD added Apex support with version 5.5.0, it utilized the Apex Jorje library to parse Apex source +and generate an AST. This library is however a binary-blob provided as part of the +[Salesforce Extensions for VS Code](https://github.com/forcedotcom/salesforcedx-vscode), and it is closed-source. + +This causes problems, if binary blobs are not allowed by e.g. a company-wide policy. In that case, the Jorje +library prevented that PMD Apex could be used at all. + +Also having access to the source code, enhancements and modifications are easier to do. + +Under the hood, we use two open source libraries instead: + +* [apex-parser](https://github.com/apex-dev-tools/apex-parser) originally by + [Kevin Jones](https://github.com/nawforce) (@nawforce). + This project provides the grammar for a ANTLR based parser. +* [Summit-AST](https://github.com/google/summit-ast) by [Google](https://github.com/google) (@google) + This project translates the ANTLR parse tree into an AST, that is similar to the AST Jorje provided. + Note: This is not an official Google product. + +Although the parsers is completely switched, there are only little known changes to the AST. +These are documented in the [Migration Guide for PMD 7: Apex AST](pmd_userdocs_migrating_to_pmd7.html#apex-ast). +With the new Apex parser, the new language constructs like +[User Mode Database Operations](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_enforce_usermode.htm) +and the new [Null Coalescing Operator `??`](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_NullCoalescingOperator.htm) +can be parsed now. PMD should be able to parse Apex code up to version 60.0 (Spring '24). + +See [#3766](https://github.com/pmd/pmd/issues/3766) for details. + +Contributors: [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google), +[Edward Klimoshenko](https://github.com/eklimo) (@eklimo) + +### Changed: CPP can now ignore identifiers in sequences (CPD) + +* New command line option for CPD: `--ignore-sequences`. +* This option is used for CPP only: with the already existing option `--ignore-literal-sequences`, only + literals were ignored. The new option additionally ignores identifiers as well in sequences. +* See [PR #4470](https://github.com/pmd/pmd/pull/4470) for details. + +### Changed: Groovy Support (CPD) + +* We now support parsing all Groovy features from Groovy 3 and 4. +* We now support [suppression](pmd_userdocs_cpd.html#suppression) through `CPD-ON`/`CPD-OFF` comment pairs. +* See [PR #4726](https://github.com/pmd/pmd/pull/4726) for details. + +### Changed: HTML support + +Support for HTML was introduced in PMD 6.55.0 as an experimental feature. With PMD 7.0.0 this +is now considered stable. + +### Changed: JavaScript support + +The JS specific parser options have been removed. The parser now always retains comments and uses version ES6. +The language module registers a couple of different versions. The latest version, which supports ES6 and also some +new constructs (see [Rhino](https://github.com/mozilla/rhino)), is the default. This should be fine for most +use cases. + +### Changed: Language versions + +We revisited the versions that were defined by each language module. Now many more versions are defined for each +language. In general, you can expect that PMD can parse all these different versions. There might be situations +where this fails and this can be considered a bug. Usually the latest version is selected as the default +language version. + +The language versions can be used to mark rules to be useful only for a specific language version via +the `minimumLanguageVersion` and `maximumLanguageVersion` attributes. While this feature is currently only used by +the Java module, listing all possible versions enables other languages as well to use this feature. + +Related issue: [[core] Explicitly name all language versions (#4120)](https://github.com/pmd/pmd/issues/4120) + +### Changed: Rule properties + +* The old deprecated classes like `IntProperty` and `StringProperty` have been removed. Please use + PropertyFactory to create properties. +* All properties which accept multiple values now use a comma (`,`) as a delimiter. The previous default was a + pipe character (`|`). The delimiter is not configurable anymore. If needed, the comma can be escaped + with a backslash. +* The `min` and `max` attributes in property definitions in the XML are now optional and can appear separately + or be omitted. + +### Changed: Velocity Template Language (VTL) + +The module was named just "vm" which was not a good name. Its module name, language id and +package names have been renamed to "velocity". + +If you import rules, you also need to adjust the paths, e.g. + +* `category/vm/...` ➡️ `category/velocity/...` + +### Changed: Visualforce + +There was an inconsistency between the naming of the maven module and the language id. The language id +used the abbreviation "vf", while the maven module used the longer name "visualforce". This has been +solved by renaming the language module to its full name "visualforce". The java packages have +been renamed as well. + +If you import rules, you also need to adjust the paths, e.g. + +* `category/vf/security.xml` ➡️ `category/visualforce/security.xml` + +## 🌟 New and changed rules + +### New Rules + +**Apex** +* [`OperationWithHighCostInLoop`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_performance.html#operationwithhighcostinloop) finds Schema class methods called in a loop, which is a + potential performance issue. +* [`UnusedMethod`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#unusedmethod) finds unused methods in your code. + +**Java** +* [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) reports boxing and unboxing conversions that may be made implicit. +* [`UseExplicitTypes`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#useexplicittypes) reports usages of `var` keyword, which was introduced with Java 10. + +**Kotlin** +* [`FunctionNameTooShort`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_kotlin_bestpractices.html#functionnametooshort) finds functions with a too short name. +* [`OverrideBothEqualsAndHashcode`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_kotlin_errorprone.html#overridebothequalsandhashcode) finds classes with only + either `equals` or `hashCode` overridden, but not both. This leads to unexpected behavior once instances + of such classes are used in collections (Lists, HashMaps, ...). + +**Swift** +* [`ForceCast`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_errorprone.html#forcecast) flags all force casts, making sure you are + defensively considering all types. Having the application crash shouldn't be an option. +* [`ForceTry`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_errorprone.html#forcetry) flags all force tries, making sure you are + defensively handling exceptions. Having the application crash shouldn't be an option. +* [`ProhibitedInterfaceBuilder`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_bestpractices.html#prohibitedinterfacebuilder) flags any usage of interface + builder. Interface builder files are prone to merge conflicts, and are impossible to code review, so larger + teams usually try to avoid it or reduce its usage. +* [`UnavailableFunction`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_swift_bestpractices.html#unavailablefunction) flags any function throwing + a `fatalError` not marked as `@available(*, unavailable)` to ensure no calls are actually performed in + the codebase. + +**XML** +* [`MissingEncoding`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_xml_bestpractices.html#missingencoding) finds XML files without explicit encoding. + +### Changed Rules + +**General changes** + +* All statistical rules (like ExcessiveClassLength, ExcessiveParameterList) have been simplified and unified. + The properties `topscore` and `sigma` have been removed. The property `minimum` is still there, however the type is not + a decimal number anymore but has been changed to an integer. This affects rules in the languages Apex, Java, PLSQL + and Velocity Template Language (velocity): + * Apex: [`ExcessiveClassLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#excessiveclasslength), [`ExcessiveParameterList`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#excessiveparameterlist), + [`ExcessivePublicCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#excessivepubliccount), [`NcssConstructorCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#ncssconstructorcount), + [`NcssMethodCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#ncssmethodcount), [`NcssTypeCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_design.html#ncsstypecount) + * Java: [`ExcessiveImports`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#excessiveimports), [`ExcessiveParameterList`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#excessiveparameterlist), + [`ExcessivePublicCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#excessivepubliccount), [`SwitchDensity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#switchdensity) + * PLSQL: [`ExcessiveMethodLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessivemethodlength), [`ExcessiveObjectLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessiveobjectlength), + [`ExcessivePackageBodyLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessivepackagebodylength), [`ExcessivePackageSpecificationLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessivepackagespecificationlength), + [`ExcessiveParameterList`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessiveparameterlist), [`ExcessiveTypeLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#excessivetypelength), + [`NcssMethodCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#ncssmethodcount), [`NcssObjectCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#ncssobjectcount), + [`NPathComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_plsql_design.html#npathcomplexity) + * Velocity: [`ExcessiveTemplateLength`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_velocity_design.html#excessivetemplatelength) + +* The general property `violationSuppressXPath` which is available for all rules to + [suppress warnings](pmd_userdocs_suppressing_warnings.html) now uses XPath version 3.1 by default. + This version of the XPath language is mostly identical to XPath 2.0. In PMD 6, XPath 1.0 has been used. + If you upgrade from PMD 6, you need to verify your `violationSuppressXPath` properties. + +**Apex General changes** + +* The properties `cc_categories`, `cc_remediation_points_multiplier`, `cc_block_highlighting` have been removed + from all rules. These properties have been deprecated since PMD 6.13.0. + See [issue #1648](https://github.com/pmd/pmd/issues/1648) for more details. + +**Apex Codestyle** + +* [`MethodNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#methodnamingconventions): The deprecated rule property `skipTestMethodUnderscores` has + been removed. It was actually deprecated since PMD 6.15.0, but was not mentioned in the release notes + back then. Use the property `testPattern` instead to configure valid names for test methods. + +**Java General changes** + +* Violations reported on methods or classes previously reported the line range of the entire method + or class. With PMD 7.0.0, the reported location is now just the identifier of the method or class. + This affects various rules, e.g. [`CognitiveComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cognitivecomplexity). + + The report location is controlled by the overrides of the method Node#getReportLocation + in different node types. + + See [issue #4439](https://github.com/pmd/pmd/issues/4439) and [issue #730](https://github.com/pmd/pmd/issues/730) + for more details. + +**Java Best Practices** + +* [`ArrayIsStoredDirectly`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#arrayisstoreddirectly): Violations are now reported on the assignment and not + anymore on the formal parameter. The reported line numbers will probably move. +* [`AvoidReassigningLoopVariables`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#avoidreassigningloopvariables): This rule might not report anymore all + reassignments of the control variable in for-loops when the property `forReassign` is set to `skip`. + See [issue #4500](https://github.com/pmd/pmd/issues/4500) for more details. +* [`LooseCoupling`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#loosecoupling): The rule has a new property to allow some types to be coupled + to (`allowedTypes`). +* [`UnusedLocalVariable`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#unusedlocalvariable): This rule has some important false-negatives fixed + and finds many more cases now. For details see issues [#2130](https://github.com/pmd/pmd/issues/2130), + [#4516](https://github.com/pmd/pmd/issues/4516), and [#4517](https://github.com/pmd/pmd/issues/4517). + +**Java Codestyle** + +* [`MethodNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#methodnamingconventions): The property `checkNativeMethods` has been removed. The + property was deprecated since PMD 6.3.0. Use the property `nativePattern` to control whether native methods + should be considered or not. +* [`ShortVariable`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#shortvariable): This rule now also reports short enum constant names. +* [`UseDiamondOperator`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#usediamondoperator): The property `java7Compatibility` has been removed. The rule now + handles Java 7 properly without a property. +* [`UnnecessaryFullyQualifiedName`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname): The rule has two new properties, + to selectively disable reporting on static field and method qualifiers. The rule also has been improved + to be more precise. +* [`UselessParentheses`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#uselessparentheses): The rule has two new properties which control how strict + the rule should be applied. With `ignoreClarifying` (default: true) parentheses that are strictly speaking + not necessary are allowed, if they separate expressions of different precedence. + The other property `ignoreBalancing` (default: true) is similar, in that it allows parentheses that help + reading and understanding the expressions. +* [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement): The rule has a new property to allow empty blocks when + they contain a comment (`allowCommentedBlocks`). + +**Java Design** + +* [`CyclomaticComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cyclomaticcomplexity): The property `reportLevel` has been removed. The property was + deprecated since PMD 6.0.0. The report level can now be configured separated for classes and methods using + `classReportLevel` and `methodReportLevel` instead. +* [`ImmutableField`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#immutablefield): The property `ignoredAnnotations` has been removed. The property was + deprecated since PMD 6.52.0. +* [`LawOfDemeter`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#lawofdemeter): The rule has a new property `trustRadius`. This defines the maximum degree + of trusted data. The default of 1 is the most restrictive. +* [`NPathComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#npathcomplexity): The property `minimum` has been removed. It was deprecated since PMD 6.0.0. + Use the property `reportLevel` instead. +* [`SingularField`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#singularfield): The properties `checkInnerClasses` and `disallowNotAssignment` have been removed. + The rule is now more precise and will check these cases properly. +* [`UseUtilityClass`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#useutilityclass): The property `ignoredAnnotations` has been removed. + +**Java Documentation** + +* [`CommentContent`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_documentation.html#commentcontent): The properties `caseSensitive` and `disallowedTerms` are removed. The + new property `forbiddenRegex` can be used now to define the disallowed terms with a single regular + expression. +* [`CommentRequired`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_documentation.html#commentrequired): + * Overridden methods are now detected even without the `@Override` + annotation. This is relevant for the property `methodWithOverrideCommentRequirement`. + See also [pull request #3757](https://github.com/pmd/pmd/pull/3757). + * Elements in annotation types are now detected as well. This might lead to an increased number of violations + for missing public method comments. + * The deprecated property `headerCommentRequirement` has been removed. Use the property `classCommentRequirement` + instead. +* [`CommentSize`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_documentation.html#commentsize): When determining the line-length of a comment, the leading comment + prefix markers (e.g. `*` or `//`) are ignored and don't add up to the line-length. + See also [pull request #4369](https://github.com/pmd/pmd/pull/4369). + +**Java Error Prone** + +* [`AvoidDuplicateLiterals`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#avoidduplicateliterals): The property `exceptionfile` has been removed. The property was + deprecated since PMD 6.10.0. Use the property `exceptionList` instead. +* [`DontImportSun`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#dontimportsun): `sun.misc.Signal` is not special-cased anymore. +* [`EmptyCatchBlock`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#emptycatchblock): `CloneNotSupportedException` and `InterruptedException` are not + special-cased anymore. Rename the exception parameter to `ignored` to ignore them. +* [`ImplicitSwitchFallThrough`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#implicitswitchfallthrough): Violations are now reported on the case statements + rather than on the switch statements. This is more accurate but might result in more violations now. +* [`NonSerializableClass`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#nonserializableclass): The deprecated property `prefix` has been removed + without replacement. In a serializable class all fields have to be serializable regardless of the name. + +### Deprecated Rules + +In PMD 7.0.0, there are no deprecated rules. + +### Removed Rules + +The following previously deprecated rules have been finally removed: + +**Apex** + +* performance.xml/AvoidSoqlInLoops (deleted) ➡️ use [`OperationWithLimitsInLoop`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_performance.html#operationwithlimitsinloop) +* performance.xml/AvoidSoslInLoops (deleted) ➡️ use [`OperationWithLimitsInLoop`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_performance.html#operationwithlimitsinloop) +* performance.xml/AvoidDmlStatementsInLoops (deleted) ➡️ use [`OperationWithLimitsInLoop`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_performance.html#operationwithlimitsinloop) +* codestyle.xml/VariableNamingConventions (deleted) ➡️ use [`FieldNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#fieldnamingconventions), + [`FormalParameterNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#formalparameternamingconventions), [`LocalVariableNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#localvariablenamingconventions), + or [`PropertyNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_codestyle.html#propertynamingconventions) +* security.xml/ApexCSRF (deleted) ➡️ use [`ApexCSRF`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_errorprone.html#apexcsrf) + +**Java** + +* codestyle.xml/AbstractNaming (deleted) ➡️ use [`ClassNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#classnamingconventions) +* codestyle.xml/AvoidFinalLocalVariable (deleted) ➡️ not replaced +* codestyle.xml/AvoidPrefixingMethodParameters (deleted) ➡️ use [`FormalParameterNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#formalparameternamingconventions) +* performance.xml/AvoidUsingShortType (deleted) ➡️ not replaced +* errorprone.xml/BadComparison (deleted) ➡️ use [`ComparisonWithNaN`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#comparisonwithnan) +* errorprone.xml/BeanMembersShouldSerialize (deleted) ➡️ use [`NonSerializableClass`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#nonserializableclass) +* performance.xml/BooleanInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) + and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) +* performance.xml/ByteInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) + and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) +* errorprone.xml/CloneThrowsCloneNotSupportedException (deleted) ➡️ not replaced +* errorprone.xml/DataflowAnomalyAnalysis (deleted) ➡️ use [`UnusedAssignment`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#unusedassignment) +* codestyle.xml/DefaultPackage (deleted) ➡️ use [`CommentDefaultAccessModifier`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#commentdefaultaccessmodifier) +* errorprone.xml/DoNotCallSystemExit (deleted) ➡️ use [`DoNotTerminateVM`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#donotterminatevm) +* codestyle.xml/DontImportJavaLang (deleted) ➡️ use [`UnnecessaryImport`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport) +* codestyle.xml/DuplicateImports (deleted) ➡️ use [`UnnecessaryImport`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport) +* errorprone.xml/EmptyFinallyBlock (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) +* errorprone.xml/EmptyIfStmt (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) +* errorprone.xml/EmptyInitializer (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) +* errorprone.xml/EmptyStatementBlock (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) +* errorprone.xml/EmptyStatementNotInLoop (deleted) ➡️ use [`UnnecessarySemicolon`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessarysemicolon) +* errorprone.xml/EmptySwitchStatements (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) +* errorprone.xml/EmptySynchronizedBlock (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) +* errorprone.xml/EmptyTryBlock (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) +* errorprone.xml/EmptyWhileStmt (deleted) ➡️ use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#emptycontrolstatement) +* design.xml/ExcessiveClassLength (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) +* design.xml/ExcessiveMethodLength (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) +* codestyle.xml/ForLoopsMustUseBraces (deleted) ➡️ use [`ControlStatementBraces`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#controlstatementbraces) +* codestyle.xml/IfElseStmtsMustUseBraces (deleted) ➡️ use [`ControlStatementBraces`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#controlstatementbraces) +* codestyle.xml/IfStmtsMustUseBraces (deleted) ➡️ use [`ControlStatementBraces`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#controlstatementbraces) +* errorprone.xml/ImportFromSamePackage (deleted) ➡️ use [`UnnecessaryImport`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport) +* performance.xml/IntegerInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) + and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) +* errorprone.xml/InvalidSlf4jMessageFormat (deleted) ➡️ use [`InvalidLogMessageFormat`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#invalidlogmessageformat) +* errorprone.xml/LoggerIsNotStaticFinal (deleted) ➡️ use [`ProperLogger`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#properlogger) +* performance.xml/LongInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) + and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) +* codestyle.xml/MIsLeadingVariableName (deleted) ➡️ use [`FieldNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#fieldnamingconventions), + [`FormalParameterNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#formalparameternamingconventions), + or [`LocalVariableNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#localvariablenamingconventions) +* errorprone.xml/MissingBreakInSwitch (deleted) ➡️ use [`ImplicitSwitchFallThrough`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#implicitswitchfallthrough) +* design.xml/ModifiedCyclomaticComplexity (deleted) ➡️ use [`CyclomaticComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cyclomaticcomplexity) +* design.xml/NcssConstructorCount (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) +* design.xml/NcssMethodCount (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) +* design.xml/NcssTypeCount (deleted) ➡️ use [`NcssCount`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#ncsscount) +* bestpractices.xml/PositionLiteralsFirstInCaseInsensitiveComparisons (deleted) ➡️ + use [`LiteralsFirstInComparisons`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#literalsfirstincomparisons) +* bestpractices.xml/PositionLiteralsFirstInComparisons (deleted) ➡️ + use [`LiteralsFirstInComparisons`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#literalsfirstincomparisons) +* errorprone.xml/ReturnEmptyArrayRatherThanNull (deleted) ➡️ + use [`ReturnEmptyCollectionRatherThanNull`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull) +* performance.xml/ShortInstantiation (deleted) ➡️ use [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) + and [`PrimitiveWrapperInstantiation`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) +* design.xml/SimplifyBooleanAssertion (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) +* performance.xml/SimplifyStartsWith (deleted) ➡️ not replaced +* design.xml/StdCyclomaticComplexity (deleted) ➡️ use [`CyclomaticComplexity`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_design.html#cyclomaticcomplexity) +* codestyle.xml/SuspiciousConstantFieldName (deleted) ➡️ use [`FieldNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#fieldnamingconventions) +* performance.xml/UnnecessaryWrapperObjectCreation (deleted) ➡️ use the new rule [`UnnecessaryBoxing`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryboxing) +* multithreading.xml/UnsynchronizedStaticDateFormatter (deleted) ➡️ use [`UnsynchronizedStaticFormatter`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_multithreading.html#unsynchronizedstaticformatter) +* bestpractices.xml/UnusedImports (deleted) ➡️ use [`UnnecessaryImport`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#unnecessaryimport) +* bestpractices.xml/UseAssertEqualsInsteadOfAssertTrue (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) +* bestpractices.xml/UseAssertNullInsteadOfAssertEquals (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) +* bestpractices.xml/UseAssertSameInsteadOfAssertEquals (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) +* bestpractices.xml/UseAssertTrueInsteadOfAssertEquals (deleted) ➡️ use [`SimplifiableTestAssertion`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_bestpractices.html#simplifiabletestassertion) +* codestyle.xml/VariableNamingConventions (deleted) ➡️ use [`FieldNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#fieldnamingconventions), + [`FormalParameterNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#formalparameternamingconventions), or [`LocalVariableNamingConventions`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#localvariablenamingconventions) +* codestyle.xml/WhileLoopsMustUseBraces (deleted) ➡️ use [`ControlStatementBraces`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_java_codestyle.html#controlstatementbraces) + +### Removed rulesets + +The following previously deprecated rulesets have been removed. These were the left-over rulesets from PMD 5. +The rules have been moved into categories with PMD 6. + +* rulesets/apex/apexunit.xml +* rulesets/apex/braces.xml +* rulesets/apex/complexity.xml +* rulesets/apex/empty.xml +* rulesets/apex/metrics.xml +* rulesets/apex/performance.xml +* rulesets/apex/ruleset.xml +* rulesets/apex/securty.xml +* rulesets/apex/style.xml +* rulesets/java/android.xml +* rulesets/java/basic.xml +* rulesets/java/clone.xml +* rulesets/java/codesize.xml +* rulesets/java/comments.xml +* rulesets/java/controversial.xml +* rulesets/java/coupling.xml +* rulesets/java/design.xml +* rulesets/java/empty.xml +* rulesets/java/finalizers.xml +* rulesets/java/imports.xml +* rulesets/java/j2ee.xml +* rulesets/java/javabeans.xml +* rulesets/java/junit.xml +* rulesets/java/logging-jakarta-commons.xml +* rulesets/java/logging-java.xml +* rulesets/java/metrics.xml +* rulesets/java/migrating.xml +* rulesets/java/migrating_to_13.xml +* rulesets/java/migrating_to_14.xml +* rulesets/java/migrating_to_15.xml +* rulesets/java/migrating_to_junit4.xml +* rulesets/java/naming.xml +* rulesets/java/optimizations.xml +* rulesets/java/strictexception.xml +* rulesets/java/strings.xml +* rulesets/java/sunsecure.xml +* rulesets/java/typeresolution.xml +* rulesets/java/unnecessary.xml +* rulesets/java/unusedcode.xml +* rulesets/ecmascript/basic.xml +* rulesets/ecmascript/braces.xml +* rulesets/ecmascript/controversial.xml +* rulesets/ecmascript/unnecessary.xml +* rulesets/jsp/basic.xml +* rulesets/jsp/basic-jsf.xml +* rulesets/plsql/codesize.xml +* rulesets/plsql/dates.xml +* rulesets/plsql/strictsyntax.xml +* rulesets/plsql/TomKytesDespair.xml +* rulesets/vf/security.xml +* rulesets/vm/basic.xml +* rulesets/pom/basic.xml +* rulesets/xml/basic.xml +* rulesets/xsl/xpath.xml +* rulesets/releases/* + +## 💥 Compatibility and Migration Notes + + + +### For endusers + +* PMD 7 requires Java 8 or above to execute. +* CLI changed: Custom scripts need to be updated (`run.sh pmd ...` ➡️ `pmd check ...`, `run.sh cpd ...` ➡️ `pmd cpd ...`). +* Java module revamped: Custom rules need to be updated. +* Removed rules: Custom rulesets need to be reviewed. See above for a list of new and removed rules. +* XPath 1.0 and 2.0 support is removed, `violationSuppressXPath` now requires XPath 3.1: Custom rulesets need + to be reviewed. +* Custom rules using rulechains: Need to override AbstractRule#buildTargetSelector + using RuleTargetSelector#forTypes. +* The asset filenames of PMD on [GitHub Releases](https://github.com/pmd/pmd/releases) are + now `pmd-dist--bin.zip`, `pmd-dist--src.zip` and `pmd-dist--doc.zip`. + Keep that in mind, if you have an automated download script. + + The structure inside the ZIP files stay the same, e.g. we still provide inside the binary distribution + ZIP file the base directory `pmd-bin-`. +* For maven-pmd-plugin usage, see [Using PMD 7 with maven-pmd-plugin](pmd_userdocs_tools_maven.html#using-pmd-7-with-maven-pmd-plugin). +* For gradle users, at least gradle 8.6 is required for PMD 7. + +### For integrators + +* PMD 7 is a major release where many things have been moved or rewritten. +* All integrators will require some level of change to adapt to the change in the API. +* For more details look at the deprecations notes of the past PMD 6 releases. These are collected below + under [API Changes](#api-changes). +* The PMD Ant tasks, which were previously in the module `pmd-core` has been moved into its own module `pmd-ant`, + which needs to be added explicitly now as an additional dependency. +* The CLI classes have also been moved out of `pmd-core` into its own module `pmd-cli`. The old entry point, the + main class PMD is gone. + +## 🚨 API + +The API of PMD has been growing over the years and needed some cleanup. The goal is, to +have a clear separation between a well-defined API and the implementation, which is internal. +This should help us in future development. + +This however entails some incompatibilities and deprecations. + +See [ADR 3 - API evolution principles](pmd_projectdocs_decisions_adr_3.html) and +[API changes](#api-changes) below. + +### Small Changes and cleanups + +* [#1648](https://github.com/pmd/pmd/issues/1648): \[apex,vf] Remove CodeClimate dependency - [Robert Sösemann](https://github.com/rsoesemann) + Properties "cc_categories", "cc_remediation_points_multiplier", "cc_block_highlighting" can no longer be overridden in rulesets. + They were deprecated without replacement. + +* The old GUI applications accessible through `run.sh designerold` and `run.sh bgastviewer` + (and corresponding Batch scripts) have been removed from the PMD distribution. Please use the newer rule designer + with `pmd designer`. The corresponding classes in packages `java.net.sourceforge.pmd.util.viewer` and + `java.net.sourceforge.pmd.util.designer` have all been removed. + +* All API related to XPath support has been moved to the package net.sourceforge.pmd.lang.rule.xpath. + This includes API that was previously dispersed over `net.sourceforge.pmd.lang`, `net.sourceforge.pmd.lang.ast.xpath`, + `net.sourceforge.pmd.lang.rule.xpath`, `net.sourceforge.pmd.lang.rule`, and various language-specific packages + (which were made internal). + +* The implementation of the Ant integration has been moved from the module `pmd-core` to a new module `pmd-ant`. + This involves classes in package net.sourceforge.pmd.ant. The ant CPDTask class `net.sourceforge.pmd.cpd.CPDTask` + has been moved into the same package net.sourceforge.pmd.ant. You'll need to update your taskdef entries in your + build.xml files with the FQCN net.sourceforge.pmd.ant.CPDTask if you use it anywhere. + +* Utility classes in net.sourceforge.pmd.util, that have previously marked as `@InternalApi` have been finally + moved to an internal sub package and are now longer available. + This includes ClasspathClassLoader, FileFinder, FileUtil, and IOUtil. + +* The following utility classes in net.sourceforge.pmd.util are now considered public API: + * AssertionUtil + * CollectionUtil + * ContextedAssertionError + * ContextedStackOverflowError + * GraphUtil + * IteratorUtil + * StringUtil + +* Moved the two classes AntlrCpdLexer and JavaccCpdLexer from + `internal` package into package net.sourceforge.pmd.cpd.impl. These two classes are part of the API and + are base classes for CPD language implementations. Since 7.0.0-rc2. + Note: These two classes have been previously called "AntlrTokenizer" and "JavaCCTokenizer". +* `AntlrBaseRule` is gone in favor of AbstractVisitorRule. Since 7.0.0-rc2. +* The classes `net.sourceforge.pmd.lang.kotlin.ast.KotlinInnerNode` and + `net.sourceforge.pmd.lang.swift.ast.SwiftInnerNode` are package-private now. Since 7.0.0-rc2. + +### XPath 3.1 support + +Support for XPath versions 1.0, 1.0-compatibility, 2.0 was removed. The default +(and only) supported XPath version is now XPath 3.1. This version of the XPath language is mostly identical to +XPath 2.0. + +Notable changes: +* The deprecated support for sequence-valued attributes is removed. Sequence-valued properties are still supported. +* Refer to [the Saxonica documentation](https://www.saxonica.com/html/documentation/expressions/xpath31new.html) for + an introduction to new features in XPath 3.1. + +### Node stream API for AST traversal + +This version includes a powerful API to navigate trees, similar in usage to the Java 8 Stream API: +```java +node.descendants(ASTMethodCall.class) + .filter(m -> "toString".equals(m.getMethodName())) + .map(m -> m.getQualifier()) + .filter(q -> TypeTestUtil.isA(String.class, q)) + .foreach(System.out::println); +``` + +A pipeline like shown here traverses the tree lazily, which is more efficient than traversing eagerly to put all +descendants in a list. It is also much easier to change than the old imperative way. + +To make this API as accessible as possible, the Node interface has been fitted with new +methods producing node streams. Those methods replace previous tree traversal methods like `Node#findDescendantsOfType`. +In all cases, they should be more efficient and more convenient. + +See NodeStream for more details. + +Contributors: [Clément Fournier](https://github.com/oowekyala) (@oowekyala) + +### Metrics framework + +The metrics framework has been made simpler and more general. + +* The metric interface takes an additional type parameter, representing the result type of the metric. This is + usually `Integer` or `Double`. It avoids widening the result to a `double` just to narrow it down. + + This makes it so, that `Double.NaN` is not an appropriate sentinel value to represent "not supported" anymore. + Instead, `computeFor` may return `null` in that case (or a garbage value). The value `null` may have caused + problems with the narrowing casts, which through unboxing, might have thrown an NPE. But when we deprecated + the language-specific metrics façades to replace them with the generic MetricsUtil, + we took care of making + the new methods throw an exception if the metric cannot be computed on the parameter. This forces you to guard + calls to MetricsUtil#computeMetric (and other overloads) + with something like `if (metric.supports(node))`. If you're following + this pattern, then you won't observe the undefined behavior. + +* The `MetricKey` interface is not so useful and has been merged into the Metric + interface and removed. So the Metric interface has the new method + displayName. + +* The framework is not tied to at most 2 node types per language anymore. Previously those were nodes for + classes and for methods/constructors. Instead, many metrics support more node types. For example, NCSS can + be computed on any code block. + + For that reason, keeping around a hard distinction between "class metrics" and "operation metrics" is not + useful. So in the Java framework for example, we removed the interfaces `JavaClassMetric`, `JavaOperationMetric`, + abstract classes for those, `JavaClassMetricKey`, and `JavaOperationMetricKey`. Metric constants are now all + inside the JavaMetrics utility class. The same was done in the Apex framework. + + We don't really need abstract classes for metrics now. So `AbstractMetric` is also removed from pmd-core. + There is a factory method on the Metric interface to create a metric easily. + +* This makes it so, that LanguageMetricsProvider does not need type parameters. + It can just return a `Set>` to list available metrics. + +* Signatures, their implementations, and the interface `SignedNode` have been + removed. Node streams allow replacing their usages very easily. + +### Testing framework + +* PMD 7 has been upgraded to use JUnit 5 only. That means, that JUnit4 related classes have been removed, namely + * `net.sourceforge.pmd.testframework.PMDTestRunner` + * `net.sourceforge.pmd.testframework.RuleTestRunner` + * `net.sourceforge.pmd.testframework.TestDescriptor` +* Rule tests, that use SimpleAggregatorTst or + PmdRuleTst work as before without change, but use + now JUnit5 under the hood. If you added additional JUnit4 tests to your rule test classes, then you'll + need to upgrade them to use JUnit5. + +### Language Lifecycle and Language Properties + +* Language modules now provide a proper lifecycle and can store global information. This enables the implementation + of multifile analysis. +* Language modules can define [custom language properties](pmd_languages_configuration.html) + which can be set via environment variables. This allows to add and use language specific configuration options + without the need to change pmd-core. + +The documentation page has been updated: +[Adding a new language with JavaCC](pmd_devdocs_major_adding_new_language_javacc.html) +and [Adding a new language with ANTLR](pmd_devdocs_major_adding_new_language_antlr.html) + +Related issue: [[core] Language lifecycle (#3782)](https://github.com/pmd/pmd/issues/3782) + +### Rule properties + +* The old deprecated classes like `IntProperty` and `StringProperty` have been removed. Please use + PropertyFactory to create properties. +* All properties which accept multiple values now use a comma (`,`) as a delimiter. The previous default was a + pipe character (`|`). The delimiter is not configurable anymore. If needed, the comma can be escaped + with a backslash. +* The `min` and `max` attributes in property definitions in the XML are now optional and can appear separately + or be omitted. + +### New Programmatic API for CPD + +This release introduces a new programmatic API to replace the old class CPD. The new API uses a similar model to +PmdAnalysis and is called CpdAnalysis. Programmatic execution of CPD should now be +done with a CPDConfiguration and a CpdAnalysis, for instance: + +```java +CPDConfiguration config = new CPDConfiguration(); +config.setMinimumTileSize(100); +config.setOnlyRecognizeLanguage(config.getLanguageRegistry().getLanguageById("java")); +config.setSourceEncoding(StandardCharsets.UTF_8); +config.addInputPath(Path.of("src/main/java") + +config.setIgnoreAnnotations(true); +config.setIgnoreLiterals(false); + +config.setRendererName("text"); + +try (CpdAnalysis cpd = CpdAnalysis.create(config)) { + // note: don't use `config` once a CpdAnalysis has been created. + // optional: add more files + cpd.files().addFile(Paths.get("src", "main", "more-java", "ExtraSource.java")); + + cpd.performAnalysis(); +} +``` + +CPD can of course still be called via command line or using the module `pmd-cli`. But for tight integration +this new programmatic API is recommended. + +See [PR #4397](https://github.com/pmd/pmd/pull/4397) for details. + +### API changes + +#### 7.0.0 + +These are the changes between 7.0.0-rc4 and final 7.0.0. + +**pmd-java** + +* Support for Java 20 preview language features have been removed. The version "20-preview" is no longer available. +* ASTPattern, ASTRecordPattern, + ASTTypePattern, ASTUnnamedPattern + - method `getParenthesisDepth()` has been removed. +* ASTTemplateFragment: To get the content of the template, use now + getContent or `@Content` instead of `getImage()`/`@Image`. +* ASTUnnamedPattern is not experimental anymore. The language feature + has been standardized with Java 22. + +**New API** + +The API around TreeRenderer has been declared as stable. It was previously +experimental. It can be used via the CLI subcommand `ast-dump` or programmatically, as described +on [Creating XML dump of the AST](pmd_userdocs_extending_ast_dump.html). + +**General AST Changes to avoid `@Image`** + +See [General AST Changes to avoid @Image](pmd_userdocs_migrating_to_pmd7.html#general-ast-changes-to-avoid-image) +in the migration guide for details. + +**XPath Rules** + +* The property `version` was already deprecated and has finally been removed. Please don't define the version + property anymore in your custom XPath rules. By default, the latest XPath version will be used, which + is XPath 3.1. + +**Moved classes/consolidated packages** + +* pmd-core + * Many types have been moved from the base package `net.sourceforge.pmd` into subpackage net.sourceforge.pmd.lang.rule + * Rule + * RulePriority + * RuleSet + * `RuleSetFactory` + * RuleSetLoader + * RuleSetLoadException + * RuleSetWriter + * Many types have been moved from the base package `net.sourceforge.pmd` into subpackage net.sourceforge.pmd.reporting + * Report + * RuleContext + * RuleViolation + * ViolationSuppressor + * XPathRule has been moved into subpackage net.sourceforge.pmd.lang.rule.xpath. +* pmd-html + * `net.sourceforge.pmd.lang.html.ast.HtmlCpdLexer` moved into package `cpd`: HtmlCpdLexer. +* pmd-lang-test: All types have been moved under the new base package net.sourceforge.pmd.lang.test: + * AbstractMetricTestRule (moved from `net.sourceforge.pmd.test.AbstractMetricTestRule`) + * BaseTextComparisonTest (moved from `net.sourceforge.pmd.test.BaseTextComparisonTest`) + * CpdTextComparisonTest (moved from `net.sourceforge.pmd.cpd.test.CpdTextComparisonTest`) + * BaseTreeDumpTest (moved from `net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest`) + * And many other types have been moved from `net.sourceforge.pmd.lang.ast.test` to `net.sourceforge.pmd.lang.test`. +* pmd-scala + * ScalaCpdLexer (moved from `net.sourceforge.pmd.lang.scala.cpd.ScalaCpdLexer`) + * ScalaTokenAdapter (moved from `net.sourceforge.pmd.lang.scala.cpd.ScalaTokenAdapter`) +* pmd-test + * AbstractRuleSetFactoryTest (moved from `net.sourceforge.pmd.lang.rule.AbstractRuleSetFactoryTest`) + * AbstractAntTestHelper (moved from `net.sourceforge.pmd.ant.AbstractAntTestHelper`) + * AbstractLanguageVersionTest (moved from `net.sourceforge.pmd.AbstractLanguageVersionTest`) + * PmdRuleTst (moved from `net.sourceforge.pmd.testframework.PmdRuleTst`) + * RuleTst (moved from `net.sourceforge.pmd.testframework.RuleTst`) + * SimpleAggregatorTst (moved from `net.sourceforge.pmd.testframework.SimpleAggregatorTst`) +* pmd-xml + * PomLanguageModule (moved from `net.sourceforge.pmd.lang.pom.PomLanguageModule`) + * WsdlLanguageModule (moved from `net.sourceforge.pmd.lang.wsdl.WsdlLanguageModule`) + * XslLanguageModule (moved from `net.sourceforge.pmd.lang.xsl.XslLanguageModule`) +* pmd-visualforce + * The package `net.sourceforge.pmd.lang.vf` has been renamed to net.sourceforge.pmd.lang.visualforce. + * The language id of visualforce has been changed to `visualforce` (it was previously just "vf") + * The ruleset changed: `category/vf/security.xml` ➡️ `category/visualforce/security.xml` +* pmd-velocity (renamed from pmd-vm) + * The package `net.sourceforge.pmd.lang.vm` has been renamed to net.sourceforge.pmd.lang.velocity. + * The language id of the Velocity module has been changed to `velocity` (it was previously just "vm") + * The rulesets changed: `category/vm/...` ➡️ `category/velocity/...` + * Many classes used the prefix `Vm`, e.g. `VmLanguageModule`. This has been changed to be `Vtl`: + * VtlLanguageModule + * VtlNode + * VtlParser + * VtlCpdLexer + * AbstractVtlRule + +**Internalized classes and interfaces and methods** + +The following classes/methods have been marked as @InternalApi before and are now moved into a `internal` +package or made (package) private and are _not accessible_ anymore. + +* pmd-core + * `net.sourceforge.pmd.cache.AbstractAnalysisCache` (moved to internal, now package private) + * `net.sourceforge.pmd.cache.AnalysisCache` (moved to internal) + * `net.sourceforge.pmd.cache.AnalysisCacheListener` (moved to internal) + * `net.sourceforge.pmd.cache.AnalysisResult` (moved to internal) + * `net.sourceforge.pmd.cache.CachedRuleMapper` (moved to internal, now package private) + * `net.sourceforge.pmd.cache.CachedRuleViolation` (moved to internal, now package private) + * `net.sourceforge.pmd.cache.ChecksumAware` (moved to internal) + * `net.sourceforge.pmd.cache.FileAnalysisCache` (moved to internal) + * `net.sourceforge.pmd.cache.NoopAnalysisCache` (moved to internal) + * `net.sourceforge.pmd.util.ResourceLoader` (moved to internal) + * net.sourceforge.pmd.cpd.Tokens + * Constructor is now package private. + * net.sourceforge.pmd.lang.LanguageProcessor.AnalysisTask + * Constructor is now package private. + * Method `withFiles(java.util.List)` is now package private. Note: it was not previously marked with @InternalApi. + * net.sourceforge.pmd.lang.rule.RuleTargetSelector + * Method `isRuleChain()` has been removed. + * net.sourceforge.pmd.renderers.AbstractAccumulatingRenderer + * renderFileReport - this method is now final + and can't be overridden anymore. + * net.sourceforge.pmd.reporting.Report + * Constructor as well as the methods `addRuleViolation`, `addConfigError`, `addError` are now private. + * net.sourceforge.pmd.reporting.RuleContext + * Method `getRule()` is now package private. + * Method `create(FileAnalysisListener listener, Rule rule)` has been removed. + * `net.sourceforge.pmd.rules.RuleFactory`: moved into subpackage `lang.rule` and made package private. + It has now been hidden completely from public API. + * Many types have been moved from into subpackage `lang.rule.internal`. + * `net.sourceforge.pmd.RuleSetReference` + * `net.sourceforge.pmd.RuleSetReferenceId` + * `net.sourceforge.pmd.RuleSets` + * `net.sourceforge.pmd.lang.rule.ParametricRuleViolation` is now package private and moved to `net.sourceforge.pmd.reporting.ParametricRuleViolation`. + The only public API is RuleViolation. + * net.sourceforge.pmd.lang.rule.RuleSet + * Method `applies(Rule,LanguageVersion)` is now package private. + * Method `applies(TextFile)` has been removed. + * Method `applies(FileId)` is now package private. + * net.sourceforge.pmd.lang.rule.RuleSetLoader + * Method `loadRuleSetsWithoutException(java.util.List)` is now package private. + * net.sourceforge.pmd.lang.rule.RuleSetLoadException + * All constructors are package private now. + * net.sourceforge.pmd.lang.ast.LexException - the constructor `LexException(boolean, String, int, int, String, char)` is now package private. + It is only used by JavaCC-generated token managers. + * net.sourceforge.pmd.PMDConfiguration + * Method `setAnalysisCache(AnalysisCache)` is now package private. Use setAnalysisCacheLocation instead. + * Method `getAnalysisCache()` is now package private. + * net.sourceforge.pmd.lang.document.FileCollector + * Method `newCollector(LanguageVersionDiscoverer, PmdReporter)` is now package private. + * Method `newCollector(PmdReporter)` is now package private. + * In order to create a FileCollector, use files instead. + * net.sourceforge.pmd.lang.rule.xpath.Attribute + * Method `replacementIfDeprecated()` is now package private. + * `net.sourceforge.pmd.properties.PropertyTypeId` - moved in subpackage `internal`. + * net.sourceforge.pmd.properties.PropertyDescriptor - method `getTypeId()` is now package private. +* pmd-doc + * The whole maven module `pmd-doc` is now considered internal API even though it was not declared so before. + It's used to generate the rule documentation for the built-in rules. + * All the classes have been moved into package `net.sourceforge.pmd.doc.internal`. +* pmd-ant + * net.sourceforge.pmd.ant.Formatter + * Method `getRenderer()` has been removed. + * Method `start(String)` is private now. + * Method `end(Report)` has been removed. + * Method `isNoOutputSupplied()` is now package private. + * Method `newListener(Project)` is now package private. + * net.sourceforge.pmd.ant.PMDTask + * Method `getRelativizeRoots()` has been removed. + * `net.sourceforge.pmd.ant.ReportException` is now package private. Note: It was not marked with @InternalApi before. +* pmd-apex + * net.sourceforge.pmd.lang.apex.ast.ApexNode + * Method `getNode()` has been removed. It was only deprecated before and not marked with @InternalApi. + However, it gave access to the wrapped Jorje node and was thus internal API. + * `net.sourceforge.pmd.lang.apex.ast.AbstractApexNode` + * Method `getNode()` is now package private. + * net.sourceforge.pmd.lang.apex.multifile.ApexMultifileAnalysis + * Constructor is now package private. + * `net.sourceforge.pmd.lang.apex.rule.design.AbstractNcssCountRule` (now package private) + * `net.sourceforge.pmd.lang.apex.rule.AbstractApexUnitTestRule` (moved to package `net.sourceforge.pmd.apex.rule.bestpractices`, now package private) +* pmd-java + * `net.sourceforge.pmd.lang.java.rule.AbstractIgnoredAnnotationRule` (moved to internal) + * `net.sourceforge.pmd.lang.java.types.ast.LazyTypeResolver` (moved to internal) + * net.sourceforge.pmd.lang.java.types.JMethodSig + * Method `internalApi()` has been removed. + * net.sourceforge.pmd.lang.java.types.TypeOps + * Method `isSameTypeInInference(JTypeMirror,JTypeMirror)` is now package private. +* pmd-jsp + * net.sourceforge.pmd.lang.jsp.ast.JspParser + * Method `getTokenBehavior()` has been removed. +* pmd-modelica + * net.sourceforge.pmd.lang.modelica.ast.InternalApiBridge renamed from `InternalModelicaNodeApi`. + * net.sourceforge.pmd.lang.modelica.resolver.InternalApiBridge renamed from `InternalModelicaResolverApi`. + * `net.sourceforge.pmd.lang.modelica.resolver.ModelicaSymbolFacade` has been removed. + * `net.sourceforge.pmd.lang.modelica.resolver.ResolutionContext` (moved to internal) + * `net.sourceforge.pmd.lang.modelica.resolver.ResolutionState` (moved to internal). Note: it was not previously marked with @InternalApi. + * `net.sourceforge.pmd.lang.modelica.resolver.Watchdog` (moved to internal). Note: it was not previously marked with @InternalApi. +* pmd-plsql + * `net.sourceforge.pmd.lang.plsql.rule.design.AbstractNcssCountRule` is now package private. +* pmd-scala + * net.sourceforge.pmd.lang.scala.ScalaLanguageModule + * Method `dialectOf(LanguageVersion)` has been removed. + +**Removed classes and members (previously deprecated)** + +The annotation `@DeprecatedUntil700` has been removed. + +* pmd-core + * CpdLanguageProperties. The field `DEFAULT_SKIP_BLOCKS_PATTERN` has been removed. + * BaseAntlrNode - method `joinTokenText()` has been removed. + * Node - many methods have been removed: + * `getNthParent(int)` - Use ancestors instead, e.g. `node.ancestors().get(n-1)` + * `getFirstParentOfType(Class)` - Use ancestors instead, e.g. `node.ancestors(parentType).first()` + * `getParentsOfType(Class)` - Use ancestors instead, e.g. `node.ancestors(parentType).toList()` + * `findChildrenOfType(Class)` - Use children instead, e.g. `node.children(childType).toList()` + * `findDescendantsOfType(Class)` - Use descendants instead, e.g. `node.descendants(targetType).toList()` + * `findDescendantsOfType(Class,boolean)` - Use descendants instead, e.g. `node.descendants(targetType).crossFindBoundaries(b).toList()` + * `getFirstChildOfType(Class)` - Use firstChild instead + * `getFirstDescendantOfType(Class)` - Use descendants instead, e.g. `node.descendants(targetType).first()` + * `hasDescendantOfType(Class)` - Use descendants instead, e.g. `node.descendants(targetType).nonEmpty()` + * `findChildNodesWithXPath(String)` - Use the NodeStream API instead. + * GenericNode - method `getNthParent(int)` has been removed. Use ancestors instead, e.g. `node.ancestors().get(n-1)` + * FileCollector - method `addZipFile(java.nio.file.Path)` has been removed. Use addZipFileWithContent instead + * TextDocument - method `readOnlyString(CharSequence,String,LanguageVersion)` has been removed. + Use readOnlyString instead. + * TextFile - method `dataSourceCompat(DataSource,PMDConfiguration)` has been removed. + Use TextFile directly, e.g. forPath + * XPathVersion + * `XPATH_1_0` + * `XPATH_1_0_COMPATIBILITY` + * `XPATH_2_0` + * Only XPath version 3.1 is now supported. This version of the XPath language is mostly identical to + XPath 2.0. XPath rules by default use now XPATH_3_1. + * `net.sourceforge.pmd.lang.rule.AbstractDelegateRule` removed. It has been merged with RuleReference. + * AbstractRule - the following methods have been removed: + * `deepCopyValuesTo(AbstractRule)` - use deepCopy instead. + * `addRuleChainVisit(Class)` - override buildTargetSelector in order to register nodes for rule chain visits. + * `addViolation(...)` - use addViolation instead, e.g. via `asCtx(data).addViolation(...)`. + Note: These methods were only marked as deprecated in javadoc. + * `addViolationWithMessage(...)` - use addViolationWithMessage instead, e.g. via + `asCtx(data).addViolationWithMessage(...)`. Note: These methods were only marked as deprecated in javadoc. + * RuleReference - the following methods have been removed: + * `setRuleSetReference(RuleSetReference)` - without replacement. Just construct new RuleReference instead. + * `hasOverriddenProperty(PropertyDescriptor)` - use isPropertyOverridden instead. + * XPathRule + * The constant `XPATH_DESCRIPTOR` has been made private and is not accessible anymore. + * The default constructor has been made package-private and is not accessible anymore. + * Language - method `getTerseName()` removed. Use getId instead. + * LanguageModuleBase - method `getTerseName()` removed. Use getId instead. + * LanguageRegistry - the following methods have been removed: + * `getLanguage(String)` - use getLanguageByFullName + via PMD or CPD instead. + * `findLanguageByTerseName(String)` - use getLanguageById + via PMD or CPD instead. + * `findByExtension(String)` - removed without replacement. + * LanguageVersionDiscoverer - method `getLanguagesForFile(java.io.File)` removed. + Use getLanguagesForFile instead. + * AbstractPropertySource + * field `propertyDescriptors` has been made private and is not accessible anymore. + Use getPropertyDescriptors instead. + * field `propertyValuesByDescriptor` has been made private and is not accessible anymore. + Use getPropertiesByPropertyDescriptor + or getOverriddenPropertiesByPropertyDescriptor instead. + * method `copyPropertyDescriptors()` has been removed. Use getPropertyDescriptors instead. + * method `copyPropertyValues()` has been removed. Use getPropertiesByPropertyDescriptor + or getOverriddenPropertiesByPropertyDescriptor instead. + * Reportable - the following methods have been removed. Use getReportLocation instead + * `getBeginLine()` + * `getBeginColumn()` + * `getEndLine()` + * `getEndColumn()` + * `net.sourceforge.pmd.util.datasource.DataSource` - use TextFile instead. + * `net.sourceforge.pmd.util.datasource.FileDataSource` + * `net.sourceforge.pmd.util.datasource.ReaderDataSource` + * `net.sourceforge.pmd.util.datasource.ZipDataSource` + * CollectionUtil + * method `invertedMapFrom(...)` has been removed. + * method `mapFrom(...)` has been removed. + * AbstractConfiguration - the following methods have been removed: + * `setIgnoreFilePath(String)` - use setIgnoreFilePath instead. + * `setInputFilePath(String)` - use setInputFilePath instead. + * `setInputPaths(String)` - use setInputPathList or + addInputPath instead. + * `setInputUri(String)` - use setInputUri instead. + * PMDConfiguration - the following methods have been removed + * `prependClasspath(String)` - use prependAuxClasspath instead. + * `getRuleSets()` - use getRuleSetPaths instead. + * `setRuleSets(String)` - use setRuleSets or + addRuleSet instead. + * `setReportFile(String)` - use setReportFile instead. + * `getReportFile()` - use getReportFilePath instead. + * Report - method `merge(Report)` has been removed. Use union instead. + * RuleSetLoader - method `toFactory()` has been made package private and is not accessible anymore. + * RuleViolation - the following methods have been removed: + * `getPackageName()` - use getAdditionalInfo with PACKAGE_NAME instead, e.g. `getAdditionalInfo().get(PACKAGE_NAME)`. + * `getClassName()` - use getAdditionalInfo with CLASS_NAME instead, e.g. `getAdditionalInfo().get(CLASS_NAME)`. + * `getMethodName()` - use getAdditionalInfo with METHOD_NAME instead, e.g. `getAdditionalInfo().get(METHOD_NAME)`. + * `getVariableName()` - use getAdditionalInfo with VARIABLE_NAME instead, e.g. `getAdditionalInfo().get(VARIABLE_NAME)`. +* pmd-apex + * ApexNode and ASTApexFile + * `#getApexVersion()`: In PMD 6, this method has been deprecated but was defined in the class `ApexRootNode`. + The version returned is always "Version.CURRENT", as the apex compiler integration + doesn't use additional information which Apex version actually is used. Therefore, this method can't be + used to determine the Apex version of the project that is being analyzed. + + If the current version is needed, then `Node.getTextDocument().getLanguageVersion()` can be used. This + is the version that has been selected via CLI `--use-version` parameter. + * ApexNode + * method `jjtAccept()` has been removed. + Use acceptVisitor instead. + * method `getNode()` has been removed. The underlying node is only available in AST nodes, but not in rule implementations. + * AbstractApexNode - method `getNode()` is now package private. + AST nodes still have access to the underlying Jorje node via the protected property `node`. + * `net.sourceforge.pmd.lang.apex.ast.ApexParserVisitor` + Use ApexVisitor or ApexVisitorBase instead. + * `net.sourceforge.pmd.lang.apex.ast.ApexParserVisitorAdapter` + * ASTAssignmentExpression - method `getOperator()` removed. + Use getOp instead. + * ASTBinaryExpression - method `getOperator()` removed. + Use getOp instead. + * ASTBooleanExpression - method `getOperator()` removed. + Use getOp instead. + * ASTPostfixExpression - method `getOperator()` removed. + Use getOp instead. + * ASTPrefixExpression - method `getOperator()` removed. + Use getOp instead. + * `net.sourceforge.pmd.lang.apex.rule.security.Helper` removed. This was actually internal API. +* pmd-java + * AbstractPackageNameModuleDirective - method `getImage()` has been removed. + Use getPackageName instead. + * `AbstractTypeDeclaration` - method `getImage()` has been removed. + Use `getSimpleName()` instead. + * ASTAnnotation - method `getAnnotationName()` has been removed. + * ASTClassType + * constructor `ASTClassType(java.lang.String)` has been removed. + * method `getImage()` has been removed. + * method `isReferenceToClassSameCompilationUnit()` has been removed. + * ASTFieldDeclaration - method `getVariableName()` has been removed. + * ASTLiteral - the following methods have been removed: + * `isStringLiteral()` - use `node instanceof ASTStringLiteral` instead. + * `isCharLiteral()` - use `node instanceof ASTCharLiteral` instead. + * `isNullLiteral()` - use `node instanceof ASTNullLiteral` instead. + * `isBooleanLiteral()` - use `node instanceof ASTBooleanLiteral` instead. + * `isNumericLiteral()` - use `node instanceof ASTNumericLiteral` instead. + * `isIntLiteral()` - use isIntLiteral instead. + * `isLongLiteral()` - use isLongLiteral instead. + * `isFloatLiteral()` - use isFloatLiteral instead. + * `isDoubleLiteral()` - use isDoubleLiteral instead. + * ASTMethodDeclaration - methods `getImage()` and `getMethodName()` have been removed. + Use getName instead. + * ASTMethodReference - method `getImage()` has been removed. + * ASTModuleName - method `getImage()` has been removed. + * ASTPrimitiveType - method `getImage()` has been removed. + * ASTType + * `getTypeImage()` has been removed. + * `getArrayDepth()` has been removed. It's only available for arrays: getArrayDepth. + * `isPrimitiveType()` - use `node instanceof ASTPrimitiveType` instead. + * `isArrayType()` - use `node instanceof ASTArrayType` instead. + * `isClassOrInterfaceType()` - use `node instanceof ASTClassType` instead. + * ASTTypeDeclaration - method `getImage()` has been removed. + * ASTUnaryExpression - method `isPrefix()` has been removed. + Use getOperator`.isPrefix()` instead. + * ASTVariableId - methods `getImage()` and `getVariableName()` have been removed. + Use getName instead. + * JavaComment - method `getImage()` has been removed. + Use getText instead. + * JavaNode - method `jjtAccept()` has been removed. + Use acceptVisitor instead. + * `net.sourceforge.pmd.lang.java.ast.JavaParserVisitor` + Use JavaVisitor or JavaVisitorBase instead. + * `net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter` + * ModifierOwner + * `isFinal()` - This is still available in various subtypes, where it makes sense, e.g. isFinal. + * `isAbstract()` - This is still available in subtypes, e.g. isAbstract. + * `isStrictfp()` - Use hasModifiers instead, e.g. `hasModifiers(STRICTFP)`. + * `isSynchronized()` - Use hasModifiers instead, e.g. `hasModifiers(SYNCHRONIZED)`. + * `isNative()` - Use hasModifiers instead, e.g. `hasModifiers(NATIVE)`. + * `isStatic()` - This is still available in subtypes, e.g. isStatic. + * `isVolatile()` - Use hasModifiers instead, e.g. `hasModifiers(VOLATILE)`. + * `isTransient()` - Use hasModifiers instead, e.g. `hasModifiers(TRANSIENT)`. + * `isPrivate()` - Use getVisibility instead, e.g. `getVisibility() == Visibility.V_PRIVATE`. + * `isPublic()` - Use getVisibility instead, e.g. `getVisibility() == Visibility.V_PUBLIC`. + * `isProtected()` - Use getVisibility instead, e.g. `getVisibility() == Visibility.V_PROTECTED`. + * `isPackagePrivate()` - Use getVisibility instead, e.g. `getVisibility() == Visibility.V_PACKAGE`. + * `isSyntacticallyAbstract()` - Use hasExplicitModifiers instead, e.g. `hasExplicitModifiers(ABSTRACT)`. + * `isSyntacticallyPublic()` - Use hasExplicitModifiers instead, e.g. `hasExplicitModifiers(PUBLIC)`. + * `isSyntacticallyStatic()` - Use hasExplicitModifiers instead, e.g. `hasExplicitModifiers(STATIC)`. + * `isSyntacticallyFinal()` - Use hasExplicitModifiers instead, e.g. `hasExplicitModifiers(FINAL)`. + * TypeNode - method `getType()` has been removed. Use getTypeMirror instead. +* pmd-javascript + * AbstractEcmascriptNode - method `getNode()` has been removed. + AST nodes still have access to the underlying Rhino node via the protected property `node`. + * ASTFunctionNode - method `getBody(int)` removed. + Use getBody instead. + * ASTTryStatement + * method `isCatch()` has been removed. Use hasCatch instead. + * method `isFinally()` has been removed. Use hasFinally instead. + * EcmascriptNode + * method `jjtAccept()` has been removed. Use acceptVisitor instead. + * method `getNode()` has been removed. The underlying node is only available in AST nodes, but not in rule implementations. + * `net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParserVisitor` + Use EcmascriptVisitor or EcmascriptVisitorBase instead. + * `net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParserVisitorAdapter` +* pmd-jsp + * `net.sourceforge.pmd.lang.jsp.ast.JspParserVisitor` + Use JspVisitor or JspVisitorBase instead. + * `net.sourceforge.pmd.lang.jsp.ast.JspParserVisitorAdapter` + * JspNode - method `jjtAccept()` has been removed. + Use acceptVisitor instead. +* pmd-modelica + * `net.sourceforge.pmd.lang.modelica.ast.ModelicaParserVisitor` + Use ModelicaVisitor or ModelicaVisitorBase instead. + * `net.sourceforge.pmd.lang.modelica.ast.ModelicaParserVisitorAdapter` + * ModelicaNode - method `jjtAccept()` has been removed. + Use acceptVisitor instead. + * `net.sourceforge.pmd.lang.modelica.rule.AmbiguousResolutionRule` + Use AmbiguousResolutionRule instead. + * `net.sourceforge.pmd.lang.modelica.rule.ConnectUsingNonConnector` + Use ConnectUsingNonConnectorRule +* pmd-plsql + * `net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor` + Use PlsqlVisitor or PlsqlVisitorBase instead. + * `net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitorAdapter` + * PLSQLNode - method `jjtAccept()` has been removed. + Use acceptVisitor instead. +* pmd-scala + * The maven module `pmd-scala` has been removed. Use `pmd-scala_2.13` or `pmd-scala_2.12` instead. + * ScalaNode + * Method `accept()` has been removed. Use acceptVisitor instead. + * Method `getNode()` has been removed. The underlying node is only available in AST nodes, but not in rule implementations. + * `AbstractScalaNode` - method `getNode()` has been removed. AST nodes still have access + to the underlying Scala node via the protected property `node`. +* pmd-visualforce + * VfNode - method `jjtAccept()` has been removed. + Use acceptVisitor instead. + * `net.sourceforge.pmd.lang.vf.ast.VfParserVisitor` + Use VfVisitor or VfVisitorBase instead. + * `net.sourceforge.pmd.lang.vf.ast.VfParserVisitorAdapter` + * DataType - method `fromBasicType(BasicType)` has been removed. + Use fromTypeName instead. +* pmd-velocity (previously pmd-vm) + * VtlNode - method `jjtAccept()` has been removed. + Use acceptVisitor instead. + * `net.sourceforge.pmd.lang.vm.ast.VmParserVisitor` + Use VtlVisitor or VtlVisitorBase instead. + * `net.sourceforge.pmd.lang.vm.ast.VmParserVisitorAdapter` + +**Removed classes, interfaces and methods (not previously deprecated)** + +* pmd-apex + * The method `isSynthetic()` in ASTMethod has been removed. + With the switch from Jorje to Summit AST as underlying parser, no synthetic methods are generated by the + parser anymore. This also means, that there is no XPath attribute `@Synthetic` anymore. + * The constant `STATIC_INITIALIZER_METHOD_NAME` in FieldDeclarationsShouldBeAtStartRule + has been removed. It was used to filter out synthetic methods, but these are not generated anymore with the + new parser. + * The method `getContext()` in ASTReferenceExpression has been removed. + It was not used and always returned `null`. + * The method `getNamespace()` in all AST nodes (defined in ApexNode) has + been removed, as it was never fully implemented. It always returned an empty string. + * The method `getNameSpace()` in ApexQualifiedName has been removed. + * The class `net.sourceforge.pmd.lang.apex.ast.ASTBridgeMethodCreator` has been removed. This was a node that has + been generated by the old Jorje parser only. +* pmd-apex-jorje + * With the switch from Jorje to Summit AST, this maven module is no longer needed and has been removed. +* pmd-core + * `net.sourceforge.pmd.util.Predicate` has been removed. It was marked as Experimental before. Use + `java.util.function.Predicate` instead. +* pmd-java + * The interface `FinalizableNode` (introduced in 7.0.0-rc1) has been removed. + Its method `isFinal()` has been moved down to the + nodes where needed, e.g. ASTLocalVariableDeclaration#isFinal. + * The method `isPackagePrivate()` in ASTClassDeclaration (formerly ASTClassOrInterfaceDeclaration) + has been removed. + Use hasVisibility instead, + which can correctly differentiate between local and package private classes. + +**Renamed classes, interfaces, methods** + +* pmd-core + * MessageReporter has been renamed to PmdReporter + * TokenMgrError has been renamed to LexException + * Tokenizer has been renamed to CpdLexer. Along with this rename, + all the implementations have been renamed as well (`Tokenizer` -> `CpdLexer`), e.g. "CppCpdLexer", "JavaCpdLexer". + This affects all language modules. + * AnyTokenizer has been renamed to AnyCpdLexer. + +* pmd-java + * The interface `AccessNode` has been renamed to ModifierOwner. This is only relevant + for Java rules, which use that type directly e.g. through downcasting. + Or when using the XPath function `pmd-java:nodeIs()`. + * The node `ASTClassOrInterfaceType` has been renamed to ASTClassType. XPath rules + need to be adjusted. + * The node `ASTClassOrInterfaceDeclaration` has been renamed to ASTClassDeclaration. + XPath rules need to be adjusted. + * The interface `ASTAnyTypeDeclaration` has been renamed to ASTTypeDeclaration. + This is only relevant for Java rules, which use that type directly, e.g. through downcasting. + Or when using the XPath function `pmd-java:nodeIs()`. + * The interface `ASTMethodOrConstructorDeclaration` has been renamed to + ASTExecutableDeclaration. This is only relevant for Java rules, which use that type + directly, e.g. through downcasting. Or when using the XPath function `pmd-java:nodeIs()`. + * The node `ASTVariableDeclaratorId` has been renamed to ASTVariableId. XPath rules + need to be adjusted. + * The node `ASTClassOrInterfaceBody` has been renamed to ASTClassBody. XPath rules + need to be adjusted. +* pmd-scala + * The interface `ScalaParserVisitor` has been renamed to ScalaVisitor in order + to align the naming scheme for the different language modules. + * The class `ScalaParserVisitorAdapter` has been renamed to ScalaVisitorBase in order + to align the naming scheme for the different language modules. + +**New API** + +These were annotated with `@Experimental`, but can now be considered stable. + +* pmd-apex + * ASTCommentContainer + * ApexMultifileAnalysis +* pmd-core + * CPDReport#filterMatches + * AntlrToken#getKind + * AbstractJjtreeNode + * TokenDocument + * AstInfo#getSuppressionComments + * AstInfo#withSuppressMap + * GenericToken#getKind + * FileCollector#addZipFileWithContent + * net.sourceforge.pmd.lang.document + * LanguageVersionHandler#getLanguageMetricsProvider + * LanguageVersionHandler#getDesignerBindings + * PlainTextLanguage + * PropertyConstraint#getXmlConstraint + * PropertyConstraint#toOptionalConstraint + * PropertyConstraint#fromPredicate + * PropertyConstraint#fromPredicate + * AbstractRenderer#setReportFile + * Renderer#setReportFile + * DesignerBindings + * DesignerBindings.TreeIconId + * RelatedNodesSelector + * Report#filterViolations + * Report#union +* pmd-groovy + * GroovyToken#getKind +* pmd-html + * net.sourceforge.pmd.lang.html +* pmd-java + * ASTExpression#getConversionContext + * AbstractJavaRulechainRule#<init> + * JSymbolTable + * JElementSymbol + * net.sourceforge.pmd.lang.java.symbols + * ExprContext + * JIntersectionType#getInducedClassType + * JTypeMirror#streamMethods + * JTypeMirror#streamDeclaredMethods + * JTypeMirror#getConstructors +* pmd-kotlin + * KotlinLanguageModule +* pmd-test-schema + * TestSchemaParser + +**Removed functionality** + +* The CLI parameter `--no-ruleset-compatibility` has been removed. It was only used to allow loading + some rulesets originally written for PMD 5 also in PMD 6 without fixing the rulesets. +* The class RuleSetFactoryCompatibility has been removed without replacement. + The different ways to enable/disable this filter in PMDConfiguration + (Property "RuleSetFactoryCompatibilityEnabled") and + PMDTask (Property "noRuleSetCompatibility") have been removed as well. +* `textcolor` renderer (TextColorRenderer) now renders always in color. + The property `color` has been removed. The possibility to override this with the system property `pmd.color` + has been removed as well. If you don't want colors, use `text` renderer (TextRenderer). + +#### 7.0.0-rc4 + +**pmd-java** + +* Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available. + +**Rule properties** + +* The old deprecated classes like `IntProperty` and `StringProperty` have been removed. Please use + PropertyFactory to create properties. +* All properties which accept multiple values now use a comma (`,`) as a delimiter. The previous default was a + pipe character (`|`). The delimiter is not configurable anymore. If needed, the comma can be escaped + with a backslash. +* The `min` and `max` attributes in property definitions in the XML are now optional and can appear separately + or be omitted. + +**New Programmatic API for CPD** + +See [Detailed Release Notes for PMD 7](pmd_release_notes_pmd7.html#new-programmatic-api-for-cpd) +and [PR #4397](https://github.com/pmd/pmd/pull/4397) for details. + +**Removed classes and methods** + +The following previously deprecated classes have been removed: + +* pmd-core + * `net.sourceforge.pmd.cpd.AbstractTokenizer` ➡️ use AnyCpdLexer instead (previously known as AnyTokenizer) + * `net.sourceforge.pmd.cpd.CPD` ➡️ use PmdCli from `pmd-cli` module for CLI support or use + CpdAnalysis for programmatic API + * `net.sourceforge.pmd.cpd.GridBagHelper` (now package private) + * `net.sourceforge.pmd.cpd.TokenEntry.State` + * `net.sourceforge.pmd.lang.document.CpdCompat` + * `net.sourceforge.pmd.properties.BooleanMultiProperty` + * `net.sourceforge.pmd.properties.BooleanProperty` + * `net.sourceforge.pmd.properties.CharacterMultiProperty` + * `net.sourceforge.pmd.properties.CharacterProperty` + * `net.sourceforge.pmd.properties.DoubleMultiProperty` + * `net.sourceforge.pmd.properties.DoubleProperty` + * `net.sourceforge.pmd.properties.EnumeratedMultiProperty` + * `net.sourceforge.pmd.properties.EnumeratedProperty` + * `net.sourceforge.pmd.properties.EnumeratedPropertyDescriptor` + * `net.sourceforge.pmd.properties.FileProperty` (note: without replacement) + * `net.sourceforge.pmd.properties.FloatMultiProperty` + * `net.sourceforge.pmd.properties.FloatProperty` + * `net.sourceforge.pmd.properties.IntegerMultiProperty` + * `net.sourceforge.pmd.properties.IntegerProperty` + * `net.sourceforge.pmd.properties.LongMultiProperty` + * `net.sourceforge.pmd.properties.LongProperty` + * `net.sourceforge.pmd.properties.MultiValuePropertyDescriptor` + * `net.sourceforge.pmd.properties.NumericPropertyDescriptor` + * `net.sourceforge.pmd.properties.PropertyDescriptorField` + * `net.sourceforge.pmd.properties.RegexProperty` + * `net.sourceforge.pmd.properties.SingleValuePropertyDescriptor` + * `net.sourceforge.pmd.properties.StringMultiProperty` + * `net.sourceforge.pmd.properties.StringProperty` + * `net.sourceforge.pmd.properties.ValueParser` + * `net.sourceforge.pmd.properties.ValueParserConstants` + * `net.sourceforge.pmd.properties.builders.MultiNumericPropertyBuilder` + * `net.sourceforge.pmd.properties.builders.MultiPackagedPropertyBuilder` + * `net.sourceforge.pmd.properties.builders.MultiValuePropertyBuilder` + * `net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilder` + * `net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilderConversionWrapper` + * `net.sourceforge.pmd.properties.builders.PropertyDescriptorExternalBuilder` + * `net.sourceforge.pmd.properties.builders.SingleNumericPropertyBuilder` + * `net.sourceforge.pmd.properties.builders.SinglePackagedPropertyBuilder` + * `net.sourceforge.pmd.properties.builders.SingleValuePropertyBuilder` + * `net.sourceforge.pmd.properties.modules.EnumeratedPropertyModule` + * `net.sourceforge.pmd.properties.modules.NumericPropertyModule` + +The following previously deprecated methods have been removed: + +* pmd-core + * `net.sourceforge.pmd.properties.PropertyBuilder.GenericCollectionPropertyBuilder#delim(char)` + * `net.sourceforge.pmd.properties.PropertySource#setProperty(...)` + * `net.sourceforge.pmd.properties.internal.PropertyTypeId#factoryFor(...)` + * `net.sourceforge.pmd.properties.internal.PropertyTypeId#typeIdFor(...)` + * `net.sourceforge.pmd.properties.PropertyDescriptor`: removed methods errorFor, type, isMultiValue, + uiOrder, compareTo, isDefinedExternally, valueFrom, asDelimitedString + +The following methods have been removed: + +* pmd-core + * CPDConfiguration + * `#sourceCodeFor(File)`, `#postConstruct()`, `#tokenizer()`, `#filenameFilter()` removed + * Mark + * `#getSourceSlice()`, `#setLineCount(int)`, `#getLineCount()`, `#setSourceCode(SourceCode)` removed + * `#getBeginColumn()`, `#getBeginLine()`, `#getEndLine()`, `#getEndColumn()` removed + ➡️ use getLocation instead + * Match + * `#LABEL_COMPARATOR` removed + * `#setMarkSet(...)`, `#setLabel(...)`, `#getLabel()`, `#addTokenEntry(...)` removed + * `#getSourceCodeSlice()` removed + ➡️ use CPDReport#getSourceCodeSlice instead + * TokenEntry + * `#getEOF()`, `#clearImages()`, `#getIdentifier()`, `#getIndex()`, `#setHashCode(int)` removed + * `#EOF` removed ➡️ use isEof instead + * Parser.ParserTask + * `#getFileDisplayName()` removed ➡️ use getFileId instead + (`getFileId().getAbsolutePath()`) + +The following classes have been removed: + +* pmd-core + * `net.sourceforge.pmd.cpd.AbstractLanguage` + * `net.sourceforge.pmd.cpd.AnyLanguage` + * `net.sourceforge.pmd.cpd.Language` + * `net.sourceforge.pmd.cpd.LanguageFactory` + * `net.sourceforge.pmd.cpd.MatchAlgorithm` (now package private) + * `net.sourceforge.pmd.cpd.MatchCollector` (now package private) + * `net.sourceforge.pmd.cpd.SourceCode` (and all inner classes like `FileCodeLoader`, ...) + * `net.sourceforge.pmd.cpd.token.TokenFilter` + +**Moved packages** + +* pmd-core + * NumericConstraints (old package: `net.sourceforge.pmd.properties.constraints.NumericConstraints`) + * PropertyConstraint (old package: `net.sourceforge.pmd.properties.constraints.PropertyConstraint`) + * not experimental anymore + * ReportException (old package: `net.sourceforge.pmd.cpd`, moved to module `pmd-ant`) + * it is now a RuntimeException + * CPDReportRenderer (old package: `net.sourceforge.pmd.cpd.renderer`) + * AntlrTokenFilter (old package: `net.sourceforge.pmd.cpd.token`) + * BaseTokenFilter (old package: `net.sourceforge.pmd.cpd.token.internal`) + * JavaCCTokenFilter (old package: `net.sourceforge.pmd.cpd.token`) + +**Changed types and other changes** + +* pmd-core + * PropertyDescriptor is now a class (was an interface) + and it is not comparable anymore. + * AbstractConfiguration#setSourceEncoding + * previously this method took a simple String for the encoding. + * PMDConfiguration and CPDConfiguration + * many getters and setters have been moved to the parent class AbstractConfiguration + * CPDListener#addedFile + * no `File` parameter anymore + * CPDReport#getNumberOfTokensPerFile returns a `Map` of `FileId,Integer` instead of `String` + * CPDReport#filterMatches now takes a `java.util.function.Predicate` + as parameter + * CpdLexer + * Note: CpdLexer was previously named Tokenizer. + * constants are now PropertyDescriptor instead of `String`, + to be used as language properties + * tokenize + changed parameters. Now takes a TextDocument and a TokenFactory + (instead of `SourceCode` and `Tokens`). + * Language + * method `#createProcessor(LanguagePropertyBundle)` moved to PmdCapableLanguage + * StringUtil#linesWithTrimIndent now takes a `Chars` + instead of a `String`. +* All language modules (like pmd-apex, pmd-cpp, ...) + * consistent package naming: `net.sourceforge.pmd.lang..cpd` + * adapted to use CpdCapableLanguage + * consistent static method `#getInstance()` + * removed constants like `ID`, `TERSE_NAME` or `NAME`. Use `getInstance().getName()` etc. instead + +**Internal APIs** + +* `net.sourceforge.pmd.properties.internal.PropertyTypeId` + +**Deprecated API** + +* Language#getTerseName ➡️ use getId instead + +* The method ASTPattern#getParenthesisDepth has been deprecated and will be removed. + It was introduced for supporting parenthesized patterns, but that was removed with Java 21. It is only used when + parsing code as java-19-preview. + +**Experimental APIs** + +* To support the Java preview language features "String Templates" and "Unnamed Patterns and Variables", the following + AST nodes have been introduced as experimental: + * ASTTemplateExpression + * ASTTemplate + * ASTTemplateFragment + * ASTUnnamedPattern +* The AST nodes for supporting "Record Patterns" and "Pattern Matching for switch" are not experimental anymore: + * ASTRecordPattern + * ASTPatternList (Note: it was renamed from `ASTComponentPatternList`) + * ASTGuard (Note: it was renamed from `ASTSwitchGuard`) + +#### 7.0.0-rc3 + +**PMD Distribution** + +* The asset filenames of PMD on [GitHub Releases](https://github.com/pmd/pmd/releases) are + now `pmd-dist--bin.zip`, `pmd-dist--src.zip` and `pmd-dist--doc.zip`. + Keep that in mind, if you have an automated download script. + + The structure inside the ZIP files stay the same, e.g. we still provide inside the binary distribution + ZIP file the base directory `pmd-bin-`. + +**CLI** + +* The CLI option `--stress` (or `-stress`) has been removed without replacement. +* The CLI option `--minimum-priority` was changed with 7.0.0-rc1 to only take the following values: + High, Medium High, Medium, Medium Low, Low. With 7.0.0-rc2 compatibility has been restored, so that the equivalent + integer values (1 to 5) are supported as well. + +**pmd-core** + +* Replaced `RuleViolation::getFilename` with new RuleViolation#getFileId, that returns a + FileId. This is an identifier for a TextFile + and could represent a path name. This allows to have a separate display name, e.g. renderers use + FileNameRenderer to either display the full path name or a relative path name + (see Renderer#setFileNameRenderer and + ConfigurableFileNameRenderer). Many places where we used a simple String for + a path-like name before have been adapted to use the new FileId. + + See [PR #4425](https://github.com/pmd/pmd/pull/4425) for details. + +#### 7.0.0-rc2 + +**Removed classes and methods** + +The following previously deprecated classes have been removed: + +* pmd-core + * `net.sourceforge.pmd.PMD` + * `net.sourceforge.pmd.cli.PMDCommandLineInterface` + * `net.sourceforge.pmd.cli.PMDParameters` + * `net.sourceforge.pmd.cli.PmdParametersParseResult` + +**CLI** + +* The CLI option `--minimum-priority` was changed with 7.0.0-rc1 to only take the following values: + High, Medium High, Medium, Medium Low, Low. With 7.0.0-rc2 compatibility has been restored, so that the equivalent + integer values (1 to 5) are supported as well. + +#### 7.0.0-rc1 + +**CLI** + +* The CLI option `--stress` (or `-stress`) has been removed without replacement. +* The CLI option `--minimum-priority` now takes one of the following values instead of an integer: + High, Medium High, Medium, Medium Low, Low. + +#### 6.55.0 + +**Go** + +* The LanguageModule of Go, that only supports CPD execution, has been deprecated. This language + is not fully supported by PMD, so having a language module does not make sense. The functionality of CPD is + not affected by this change. The following class has been deprecated and will be removed with PMD 7.0.0: + * GoLanguageModule + +**Java** +* Support for Java 18 preview language features have been removed. The version "18-preview" is no longer available. +* The experimental class `net.sourceforge.pmd.lang.java.ast.ASTGuardedPattern` has been removed. + +#### 6.54.0 + +**PMD CLI** + +* PMD now supports a new `--relativize-paths-with` flag (or short `-z`), which replaces `--short-names`. + It serves the same purpose: Shortening the pathnames in the reports. However, with the new flag it's possible + to explicitly define one or more pathnames that should be used as the base when creating relative paths. + The old flag `--short-names` is deprecated. + +**Deprecated APIs** + +**For removal** + +* ApexRootNode#getApexVersion() has been deprecated for removal. The version returned is + always `Version.CURRENT`, as the apex compiler integration doesn't use additional information which Apex version + actually is used. Therefore, this method can't be used to determine the Apex version of the project + that is being analyzed. +* CPDConfiguration#setEncoding and + CPDConfiguration#getEncoding. Use the methods + getSourceEncoding and + setSourceEncoding instead. Both are available + for `CPDConfiguration` which extends `AbstractConfiguration`. +* BaseCLITest and BaseCPDCLITest have been deprecated for removal without + replacement. CLI tests should be done in pmd-core only (and in PMD7 in pmd-cli). Individual language modules + shouldn't need to test the CLI integration logic again. Instead, the individual language modules should test their + functionality as unit tests. +* CPDConfiguration.LanguageConverter + +* FileCollector#addZipFile has been deprecated. It is replaced + by FileCollector#addZipFileWithContent which directly adds the + content of the zip file for analysis. + +* PMDConfiguration#setReportShortNames and + PMDConfiguration#isReportShortNames have been deprecated for removal. + Use AbstractConfiguration#addRelativizeRoot instead. + +**Internal APIs** + +* CSVWriter +* Some fields in AbstractAntTestHelper + +**Experimental APIs** + +* CPDReport has a new method which limited mutation of a given report: + * filterMatches creates a new CPD report + with some matches removed with a given predicate based filter. + +#### 6.53.0 + +**Deprecated APIs** + +**For removal** + +These classes / APIs have been deprecated and will be removed with PMD 7.0.0. + +* ExcessiveLengthRule (Java) + +#### 6.52.0 + +**PMD CLI** + +* PMD now supports a new `--use-version` flag, which receives a language-version pair (such as `java-8` or `apex-54`). + This supersedes the usage of `-language` / `-l` and `-version` / `-v`, allowing for multiple versions to be set in a single run. + PMD 7 will completely remove support for `-language` and `-version` in favor of this new flag. + +* Support for `-V` is being deprecated in favor of `--verbose` in preparation for PMD 7. + In PMD 7, `-v` will enable verbose mode and `-V` will show the PMD version for consistency with most Unix/Linux tools. + +* Support for `-min` is being deprecated in favor of `--minimum-priority` for consistency with most Unix/Linux tools, where `-min` would be equivalent to `-m -i -n`. + +**CPD CLI** + +* CPD now supports using `-d` or `--dir` as an alias to `--files`, in favor of consistency with PMD. + PMD 7 will remove support for `--files` in favor of these new flags. + +**Linux run.sh parameters** + +* Using `run.sh cpdgui` will now warn about it being deprecated. Use `run.sh cpd-gui` instead. + +* The old designer (`run.sh designerold`) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: `run.sh designer`. + +* The old visual AST viewer (`run.sh bgastviewer`) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: `run.sh designer` for a visual tool, or use `run.sh ast-dump` for a text-based alternative. + +**Deprecated API** + +* The following core APIs have been marked as deprecated for removal in PMD 7: + - PMD and `PMD.StatusCode` - PMD 7 will ship with a revamped CLI split from pmd-core. To programmatically launch analysis you can use PmdAnalysis. + - PMDConfiguration#getAllInputPaths - It is now superseded by PMDConfiguration#getInputPathList + - PMDConfiguration#setInputPaths - It is now superseded by PMDConfiguration#setInputPathList + - PMDConfiguration#addInputPath - It is now superseded by PMDConfiguration#addInputPath + - PMDConfiguration#getInputFilePath - It is now superseded by PMDConfiguration#getInputFile + - PMDConfiguration#getIgnoreFilePath - It is now superseded by PMDConfiguration#getIgnoreFile + - PMDConfiguration#setInputFilePath - It is now superseded by PMDConfiguration#setInputFilePath + - PMDConfiguration#setIgnoreFilePath - It is now superseded by PMDConfiguration#setIgnoreFilePath + - PMDConfiguration#getInputUri - It is now superseded by PMDConfiguration#getUri + - PMDConfiguration#setInputUri - It is now superseded by PMDConfiguration#setInputUri + - PMDConfiguration#getReportFile - It is now superseded by PMDConfiguration#getReportFilePath + - PMDConfiguration#setReportFile - It is now superseded by PMDConfiguration#setReportFile + - PMDConfiguration#isStressTest and PMDConfiguration#setStressTest - Will be removed with no replacement. + - PMDConfiguration#isBenchmark and PMDConfiguration#setBenchmark - Will be removed with no replacement, the CLI will still support it. + - CPD and `CPD.StatusCode` - PMD 7 will ship with a revamped CLI split from pmd-core. An alternative to programmatically launch CPD analysis will be added in due time. + +* In order to reduce the dependency on Apex Jorje classes, the method DataType#fromBasicType + has been deprecated. The equivalent method fromTypeName should be used instead. + +#### 6.51.0 + +No changes. + +#### 6.50.0 + +**CPD CLI** + +* CPD now supports the `--ignore-literal-sequences` argument when analyzing Lua code. + +#### 6.49.0 + +**Deprecated API** + +* In order to reduce the dependency on Apex Jorje classes, the following methods have been deprecated. + These methods all leaked internal Jorje enums. These enums have been replaced now by enums the + PMD's AST package. + * ASTAssignmentExpression#getOperator + * ASTBinaryExpression#getOperator + * ASTBooleanExpression#getOperator + * ASTPostfixExpression#getOperator + * ASTPrefixExpression#getOperator + + All these classes have now a new `getOp()` method. Existing code should be refactored to use this method instead. + It returns the new enums, like AssignmentOperator, and avoids + the dependency to Jorje. + +#### 6.48.0 + +**CPD CLI** + +* CPD has a new CLI option `--debug`. This option has the same behavior as in PMD. It enables more verbose + logging output. + +**Rule Test Framework** + +* The module "pmd-test", which contains support classes to write rule tests, now **requires Java 8**. If you depend on + this module for testing your own custom rules, you'll need to make sure to use at least Java 8. +* The new module "pmd-test-schema" contains now the XSD schema and the code to parse the rule test XML files. The + schema has been extracted in order to easily share it with other tools like the Rule Designer or IDE plugins. +* Test schema changes: + * The attribute `isRegressionTest` of `test-code` is deprecated. The new + attribute `disabled` should be used instead for defining whether a rule test should be skipped or not. + * The attributes `reinitializeRule` and `useAuxClasspath` of `test-code` are deprecated and assumed true. + They will not be replaced. + * The new attribute `focused` of `test-code` allows disabling all tests except the focused one temporarily. +* More information about the rule test framework can be found in the documentation: + [Testing your rules](pmd_userdocs_extending_testing.html) + +**Deprecated API** + +* The experimental Java AST class `net.sourceforge.pmd.lang.java.ast.ASTGuardedPattern` has been deprecated and + will be removed. It was introduced for Java 17 and Java 18 Preview as part of pattern matching for switch, + but it is no longer supported with Java 19 Preview. +* The interface CPDRenderer is deprecated. For custom CPD renderers + the new interface CPDReportRenderer should be used. +* The class TestDescriptor is deprecated, replaced with RuleTestDescriptor. +* Many methods of RuleTst have been deprecated as internal API. + +**Experimental APIs** + +* To support the Java preview language features "Pattern Matching for Switch" and "Record Patterns", the following + AST nodes have been introduced as experimental: + * ASTSwitchGuard + * ASTRecordPattern + * ASTComponentPatternList + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* CPDConfiguration#setRenderer +* CPDConfiguration#setCPDRenderer +* CPDConfiguration#getRenderer +* CPDConfiguration#getCPDRenderer +* CPDConfiguration#getRendererFromString +* CPDConfiguration#getCPDRendererFromString +* CPDRendererAdapter + +#### 6.47.0 + +No changes. + +#### 6.46.0 + +**Deprecated ruleset references** + +Ruleset references with the following formats are now deprecated and will produce a warning +when used on the CLI or in a ruleset XML file: +- `-`, eg `java-basic`, which resolves to `rulesets/java/basic.xml` +- the internal release number, eg `600`, which resolves to `rulesets/releases/600.xml` + +Use the explicit forms of these references to be compatible with PMD 7. + +**Deprecated API** + +- toString is now deprecated. The format of this + method will remain the same until PMD 7. The deprecation is intended to steer users + away from relying on this format, as it may be changed in PMD 7. +- getInputPaths and + setInputPaths are now deprecated. + A new set of methods have been added, which use lists and do not rely on comma splitting. + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +- CPDCommandLineInterface has been internalized. In order to execute CPD either + CPD#runCpd or CPD#main + should be used. +- Several members of BaseCPDCLITest have been deprecated with replacements. +- The methods Formatter#start, + Formatter#end, Formatter#getRenderer, + and Formatter#isNoOutputSupplied have been internalized. + +#### 6.45.0 + +**Experimental APIs** + +* Report has two new methods which allow limited mutations of a given report: + * Report#filterViolations creates a new report with + some violations removed with a given predicate based filter. + * Report#union can combine two reports into a single new Report. +* net.sourceforge.pmd.util.Predicate will be replaced in PMD7 with the standard Predicate interface from java8. +* The module `pmd-html` is entirely experimental right now. Anything in the package + `net.sourceforge.pmd.lang.html` should be used cautiously. + +#### 6.44.0 + +**Deprecated API** + +* Several members of PMD have been newly deprecated, including: + - `PMD#EOL`: use `System#lineSeparator()` + - `PMD#SUPPRESS_MARKER`: use DEFAULT_SUPPRESS_MARKER + - `PMD#processFiles`: use the new programmatic API + - `PMD#getApplicableFiles`: is internal +* PMDConfiguration#prependClasspath is deprecated + in favour of prependAuxClasspath. +* PMDConfiguration#setRuleSets and + getRuleSets are deprecated. Use instead + setRuleSets, + addRuleSet, + and getRuleSetPaths. +* Several members of BaseCLITest have been deprecated with replacements. +* Several members of PMDCommandLineInterface have been explicitly deprecated. + The whole class however was deprecated long ago already with 6.30.0. It is internal API and should + not be used. + +* In modelica, the rule classes AmbiguousResolutionRule + and ConnectUsingNonConnector have been deprecated, + since they didn't comply to the usual rule class naming conventions yet. + The replacements are in the subpackage `bestpractices`. + +**Experimental APIs** + +* Together with the new programmatic API the interface + TextFile has been added as *experimental*. It intends + to replace DataSource and SourceCode in the long term. + + This interface will change in PMD 7 to support read/write operations + and other things. You don't need to use it in PMD 6, as FileCollector + decouples you from this. A file collector is available through PmdAnalysis#files. + +#### 6.43.0 + +**Deprecated API** + +Some API deprecations were performed in core PMD classes, to improve compatibility with PMD 7. +- Report: the constructor and other construction methods like addViolation or createReport +- RuleContext: all constructors, getters and setters. A new set + of stable methods, matching those in PMD 7, was added to replace the `addViolation` + overloads of AbstractRule. In PMD 7, `RuleContext` will + be the API to report violations, and it can already be used as such in PMD 6. +- The field configuration is unused and will be removed. + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +- RuleSet: methods that serve to apply rules, including `apply`, `start`, `end`, `removeDysfunctionalRules` +- AbstractAccumulatingRenderer#renderFileReport is internal API + and should not be overridden in own renderers. + +**Changed API** + +It is now forbidden to report a violation: +- With a `null` node +- With a `null` message +- With a `null` set of format arguments (prefer a zero-length array) + +Note that the message is set from the XML rule declaration, so this is only relevant +if you instantiate rules manually. + +RuleContext now requires setting the current rule before calling +apply. This is +done automatically by `RuleSet#apply` and such. Creating and configuring a +`RuleContext` manually is strongly advised against, as the lifecycle of `RuleContext` +will change drastically in PMD 7. + +#### 6.42.0 + +No changes. + +#### 6.41.0 + +**Command Line Interface** + +The command line options for PMD and CPD now use GNU-syle long options format. E.g. instead of `-rulesets` the +preferred usage is now `--rulesets`. Alternatively one can still use the short option `-R`. +Some options also have been renamed to a more consistent casing pattern at the same time +(`--fail-on-violation` instead of `-failOnViolation`). +The old single-dash options are still supported but are deprecated and will be removed with PMD 7. +This change makes the command line interface more consistent within PMD and also less surprising +compared to other cli tools. + +The changes in detail for PMD: + +| old option | new option | +|---------------------------|------------------------------| +| `-rulesets` | `--rulesets` (or `-R`) | +| `-uri` | `--uri` | +| `-dir` | `--dir` (or `-d`) | +| `-filelist` | `--file-list` | +| `-ignorelist` | `--ignore-list` | +| `-format` | `--format` (or `-f`) | +| `-debug` | `--debug` | +| `-verbose` | `--verbose` | +| `-help` | `--help` | +| `-encoding` | `--encoding` | +| `-threads` | `--threads` | +| `-benchmark` | `--benchmark` | +| `-stress` | `--stress` | +| `-shortnames` | `--short-names` | +| `-showsuppressed` | `--show-suppressed` | +| `-suppressmarker` | `--suppress-marker` | +| `-minimumpriority` | `--minimum-priority` | +| `-property` | `--property` | +| `-reportfile` | `--report-file` | +| `-force-language` | `--force-language` | +| `-auxclasspath` | `--aux-classpath` | +| `-failOnViolation` | `--fail-on-violation` | +| `--failOnViolation` | `--fail-on-violation` | +| `-norulesetcompatibility` | `--no-ruleset-compatibility` | +| `-cache` | `--cache` | +| `-no-cache` | `--no-cache` | + +The changes in detail for CPD: + +| old option | new option | +|---------------------|-----------------------| +| `--failOnViolation` | `--fail-on-violation` | +| `-failOnViolation` | `--fail-on-violation` | +| `--filelist` | `--file-list` | + +#### 6.40.0 + +**Experimental APIs** + +* The interface ASTCommentContainer has been added to the Apex AST. + It provides a way to check whether a node contains at least one comment. Currently, this is only implemented for + ASTCatchBlockStatement and used by the rule + [`EmptyCatchBlock`](https://docs.pmd-code.org/pmd-doc-7.0.0/pmd_rules_apex_errorprone.html#emptycatchblock). + This information is also available via XPath attribute `@ContainsComment`. + +#### 6.39.0 + +No changes. + +#### 6.38.0 + +No changes. + +#### 6.37.0 + +**PMD CLI** + +* PMD has a new CLI option `-force-language`. With that a language can be forced to be used for all input files, + irrespective of filenames. When using this option, the automatic language selection by extension is disabled + and all files are tried to be parsed with the given language. Parsing errors are ignored and unparsable files + are skipped. + + This option allows to use the xml language for files, that don't use xml as extension. + See also the examples on [PMD CLI reference](pmd_userdocs_cli_reference.html#analyze-other-xml-formats). + +**Experimental APIs** + +* The AST types and APIs around Sealed Classes are not experimental anymore: +* ASTClassOrInterfaceDeclaration#isSealed, + ASTClassOrInterfaceDeclaration#isNonSealed, + ASTClassOrInterfaceDeclaration#getPermittedSubclasses +* ASTPermitsList + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* The inner class net.sourceforge.pmd.cpd.TokenEntry.State is considered to be internal API. + It will probably be moved away with PMD 7. + +#### 6.36.0 + +No changes. + +#### 6.35.0 + +**Deprecated API** + +* PMD#doPMD is deprecated. + Use PMD#runPmd instead. +* PMD#run is deprecated. + Use PMD#runPmd instead. +* ThreadSafeReportListener and the methods to use them in Report + (addListener, + getListeners, addListeners) + are deprecated. This functionality will be replaced by another TBD mechanism in PMD 7. + +#### 6.34.0 + +No changes. + +#### 6.33.0 + +No changes. + +#### 6.32.0 + +**Experimental APIs** + +* The experimental class `ASTTypeTestPattern` has been renamed to ASTTypePattern + in order to align the naming to the JLS. +* The experimental class `ASTRecordConstructorDeclaration` has been renamed to ASTCompactConstructorDeclaration + in order to align the naming to the JLS. +* The AST types and APIs around Pattern Matching and Records are not experimental anymore: +* ASTVariableId#isPatternBinding +* ASTPattern +* ASTTypePattern +* ASTRecordDeclaration +* ASTRecordComponentList +* ASTRecordComponent +* ASTRecordBody +* ASTCompactConstructorDeclaration + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* The protected or public member of the Java rule AvoidUsingHardCodedIPRule + are deprecated and considered to be internal API. They will be removed with PMD 7. + +#### 6.31.0 + +**Deprecated API** + +* AbstractDomXmlRule +* AbstractWsdlRule +* A few methods of AbstractXmlRule + +**Experimental APIs** + +* The method GenericToken#getKind has been added as experimental. This + unifies the token interface for both JavaCC and Antlr. The already existing method + AntlrToken#getKind is therefore experimental as well. The + returned constant depends on the actual language and might change whenever the grammar + of the language is changed. + +#### 6.30.0 + +**Deprecated API** + +**Around RuleSet parsing** + +* RuleSetFactory and RulesetsFactoryUtils have been deprecated in favor of RuleSetLoader. This is easier to configure, and more maintainable than the multiple overloads of `RulesetsFactoryUtils`. +* Some static creation methods have been added to RuleSet for simple cases, eg forSingleRule. These replace some counterparts in RuleSetFactory +* Since RuleSets is also deprecated, many APIs that require a RuleSets instance now are deprecated, and have a counterpart that expects a `List`. +* RuleSetReferenceId, RuleSetReference, RuleSetFactoryCompatibility are deprecated. They are most likely not relevant outside of the implementation of pmd-core. + +**Around the `PMD` class** + +Many classes around PMD's entry point (PMD) have been deprecated as internal, including: +* The contents of the packages net.sourceforge.pmd.cli in pmd-core, net.sourceforge.pmd.processor +* SourceCodeProcessor +* The constructors of PMD (the class will be made a utility class) + +**Miscellaneous** + +* ASTPackageDeclaration#getPackageNameImage, + ASTTypeParameter#getParameterName + and the corresponding XPath attributes. In both cases they're replaced with a new method `getName`, + the attribute is `@Name`. +* ASTClassOrInterfaceBody#isAnonymousInnerClass, + and ASTClassOrInterfaceBody#isEnumChild, + refs [#905](https://github.com/pmd/pmd/issues/905) + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* net.sourceforge.pmd.lang.ecmascript.Ecmascript3Handler +* net.sourceforge.pmd.lang.ecmascript.Ecmascript3Parser +* EcmascriptParser#parserOptions +* EcmascriptParser#getSuppressMap +* net.sourceforge.pmd.lang.rule.ParametricRuleViolation +* ParserOptions#suppressMarker +* net.sourceforge.pmd.lang.modelica.rule.ModelicaRuleViolationFactory + +#### 6.29.0 + +No changes. + +#### 6.28.0 + +**Deprecated API** + +**For removal** + +* net.sourceforge.pmd.RuleViolationComparator. Use RuleViolation#DEFAULT_COMPARATOR instead. +* net.sourceforge.pmd.cpd.AbstractTokenizer. Use net.sourceforge.pmd.cpd.AnyCpdLexer instead (previously called AnyTokenizer). +* net.sourceforge.pmd.cpd.FortranTokenizer. Was replaced by an AnyCpdLexer. Use FortranLanguageModule#createCpdLexer anyway. +* net.sourceforge.pmd.cpd.PerlTokenizer. Was replaced by an AnyCpdLexer. Use PerlLanguageModule#createCpdLexer anyway. +* net.sourceforge.pmd.cpd.RubyTokenizer. Was replaced by an AnyCpdLexer. Use RubyLanguageModule#createCpdLexer anyway. +* RuleReference#getOverriddenLanguage and + RuleReference#setLanguage +* Antlr4 generated lexers: + * net.sourceforge.pmd.lang.cs.antlr4.CSharpLexer will be moved to package `net.sourceforge.pmd.lang.cs.ast` with PMD 7. + * net.sourceforge.pmd.lang.dart.antlr4.Dart2Lexer will be renamed to `DartLexer` and moved to package + `net.sourceforge.pmd.lang.dart.ast` with PMD 7. All other classes in the old package will be removed. + * net.sourceforge.pmd.lang.go.antlr4.GolangLexer will be moved to package + `net.sourceforge.pmd.lang.go.ast` with PMD 7. All other classes in the old package will be removed. + * net.sourceforge.pmd.lang.kotlin.antlr4.Kotlin will be renamed to `KotlinLexer` and moved to package + `net.sourceforge.pmd.lang.kotlin.ast` with PMD 7. + * net.sourceforge.pmd.lang.lua.antlr4.LuaLexer will be moved to package + `net.sourceforge.pmd.lang.lua.ast` with PMD 7. All other classes in the old package will be removed. + +#### 6.27.0 + +* XML rule definition in rulesets: In PMD 7, the `language` attribute will be required on all `rule` + elements that declare a new rule. Some base rule classes set the language implicitly in their + constructor, and so this is not required in all cases for the rule to work. But this + behavior will be discontinued in PMD 7, so missing `language` attributes are now + reported as a forward compatibility warning. + +**Deprecated API** + +**For removal** + +* Rule#getParserOptions +* Parser#getParserOptions +* AbstractParser +* RuleContext#removeAttribute +* RuleContext#getAttribute +* RuleContext#setAttribute +* ApexParserOptions +* ASTThrowStatement#getFirstClassOrInterfaceTypeImage +* EcmascriptParserOptions +* EcmascriptXPathRule +* XmlParserOptions +* XmlXPathRule +* Properties of AbstractXmlRule + +* net.sourceforge.pmd.Report.ReadableDuration +* Many methods of net.sourceforge.pmd.Report. They are replaced by accessors + that produce a List. For example, iterator() + (and implementing Iterable) and isEmpty() are both + replaced by getViolations(). + +* The dataflow codebase is deprecated for removal in PMD 7. This includes all code in the following packages, and their subpackages: + * net.sourceforge.pmd.lang.plsql.dfa + * net.sourceforge.pmd.lang.java.dfa + * net.sourceforge.pmd.lang.dfa + * and the class PLSQLDataFlowHandler + +* VfSimpleCharStream + +* ASTJspDeclarations +* ASTJspDocument +* ScalaParserVisitorAdapter#zero +* ScalaParserVisitorAdapter#combine +* ApexParserVisitorReducedAdapter +* JavaParserVisitorReducedAdapter + +* TypeHelper is deprecated in + favor of TypeTestUtil, which has the + same functionality, but a slightly changed API. +* Many of the classes in net.sourceforge.pmd.lang.java.symboltable + are deprecated as internal API. + +#### 6.26.0 + +**Deprecated API** + +**For removal** + +* RuleChainVisitor and all implementations in language modules +* AbstractRuleChainVisitor +* Language#getRuleChainVisitorClass +* BaseLanguageModule#<init> +* ImportWrapper + +#### 6.25.0 + +* The maven module `net.sourceforge.pmd:pmd-scala` is deprecated. Use `net.sourceforge.pmd:pmd-scala_2.13` + or `net.sourceforge.pmd:pmd-scala_2.12` instead. + +* Rule implementation classes are internal API and should not be used by clients directly. + The rules should only be referenced via their entry in the corresponding category ruleset + (e.g. ``). + + While we definitely won't move or rename the rule classes in PMD 6.x, we might consider changes + in PMD 7.0.0 and onwards. + +**Deprecated APIs** + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* AbstractIgnoredAnnotationRule (Java) +* AbstractInefficientZeroCheck (Java) +* AbstractJUnitRule (Java) +* AbstractJavaMetricsRule (Java) +* AbstractLombokAwareRule (Java) +* AbstractPoorMethodCall (Java) +* AbstractSunSecureRule (Java) +* AbstractNcssCountRule (Java) +* AbstractCommentRule (Java) +* AbstractOptimizationRule (Java) +* RegexHelper (Java) +* AbstractApexUnitTestRule (Apex) +* AbstractNcssCountRule (Apex) +* AbstractNcssCountRule (PLSQL) +* ApexParser +* ApexHandler +* RuleChain +* RuleSets +* RulesetsFactoryUtils#getRuleSets + +**For removal** + +* TokenEntry#TokenEntry +* AbstractTokenizerTest. Use CpdTextComparisonTest in module pmd-lang-test instead. + For details see + [Testing your implementation](pmd_devdocs_major_adding_new_cpd_language.html#testing-your-implementation) + in the developer documentation. +* ASTAnnotation#suppresses (Apex) +* ApexXPathRule (Apex) +* SymbolTableTestRule (Java) +* InefficientStringBufferingRule#isInStringBufferOperation + +#### 6.24.0 + +**Deprecated APIs** + +* BaseLanguageModule#addVersion(String, LanguageVersionHandler, boolean) +* Some members of TokenMgrError, in particular, a new constructor is available + that should be preferred to the old ones +* ANTLRSyntaxError + +**Experimental APIs** + +**Note:** Experimental APIs are identified with the annotation Experimental, +see its javadoc for details + +* The experimental methods in BaseLanguageModule have been replaced by a + definitive API. + +#### 6.23.0 + +**Deprecated APIs** + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* AbstractXPathRuleQuery +* JaxenXPathRuleQuery +* SaxonXPathRuleQuery +* XPathRuleQuery + +**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 **Apex**, **Javascript**, **PL/SQL**, **Scala** and **Visualforce** ASTs: + +* Manual instantiation of nodes. **Constructors of node classes are deprecated** and + marked InternalApi. Nodes should only be obtained from the parser, + which for rules, means that they 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**. The base classes are internal API + and will be hidden in version 7.0.0. You should not couple your code to them. +* In the meantime you should use interfaces like VfNode or + 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. +* The implementation classes of Parser (eg VfParser) are deprecated and should not be used directly. + Use LanguageVersionHandler#getParser instead. +* The implementation classes of TokenManager (eg VfTokenManager) are deprecated and should not be used outside of our implementation. + **This also affects CPD-only modules**. + +These deprecations are added to the following language modules in this release. +Please look at the package documentation to find out the full list of deprecations. +* Apex: net.sourceforge.pmd.lang.apex.ast +* Javascript: net.sourceforge.pmd.lang.ecmascript.ast +* PL/SQL: net.sourceforge.pmd.lang.plsql.ast +* Scala: net.sourceforge.pmd.lang.scala.ast +* Visualforce: net.sourceforge.pmd.lang.vf.ast + +These deprecations have already been rolled out in a previous version for the +following languages: +* Java: net.sourceforge.pmd.lang.java.ast +* Java Server Pages: net.sourceforge.pmd.lang.jsp.ast +* Velocity Template Language: net.sourceforge.pmd.lang.vm.ast + +Outside of these packages, these changes also concern the following TokenManager +implementations, and their corresponding Parser if it exists (in the same package): + +* CppTokenManager +* JavaTokenManager +* Ecmascript5TokenManager +* JspTokenManager +* MatlabTokenManager +* ModelicaTokenManager +* ObjectiveCTokenManager +* PLSQLTokenManager +* PythonTokenManager +* VfTokenManager +* VmTokenManager + + +In the **Java AST** the following attributes are deprecated and will issue a warning when used in XPath rules: + +* ASTAdditiveExpression#getImage - use `getOperator()` instead +* ASTVariableDeclaratorId#getImage - use `getName()` instead +* ASTVariableDeclaratorId#getVariableName - use `getName()` instead + +**For removal** + +* Parser#getTokenManager +* TokenManager#setFileName +* AbstractTokenManager#setFileName +* AbstractTokenManager#getFileName +* AntlrToken#getType - use `getKind()` instead. +* ImmutableLanguage +* MockRule +* Node#getFirstParentOfAnyType +* Node#getAsDocument +* AbstractNode#hasDescendantOfAnyType +* ASTRecordDeclaration#getComponentList +* Multiple fields, constructors and methods in XPathRule. See javadoc for details. + +#### 6.22.0 + +**Deprecated APIs** + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* JavaLanguageHandler +* JavaLanguageParser +* JavaDataFlowHandler +* Implementations of RuleViolationFactory in each + language module, eg JavaRuleViolationFactory. + See javadoc of RuleViolationFactory. +* Implementations of RuleViolation in each language module, + eg JavaRuleViolation. See javadoc of + RuleViolation. + +* RuleFactory +* RuleBuilder +* Constructors of RuleSetFactory, use factory methods from RulesetsFactoryUtils instead +* getRulesetFactory + +* AbstractApexNode +* AbstractApexNodeBase, and the related `visit` + methods on ApexParserVisitor and its implementations. + Use ApexNode instead, now considers comments too. + +**For removal** + +* pmd-core + * DFAGraphRule and its implementations + * DFAGraphMethod + * Many methods on the Node interface + and AbstractNode base class. See their javadoc for details. + * Node#isFindBoundary is deprecated for XPath queries. + * Many APIs of `net.sourceforge.pmd.lang.metrics`, though most of them were internal and + probably not used directly outside of PMD. Use MetricsUtil as + a replacement for the language-specific façades too. + * QualifiableNode, QualifiedName +* pmd-java + * AbstractJavaParser + * AbstractJavaHandler + * [`ASTAnyTypeDeclaration.TypeKind`](https://docs.pmd-code.org/apidocs/pmd-java/6.55.0/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeDeclaration.TypeKind.html) + * ASTAnyTypeDeclaration#getTypeKind + * JavaQualifiedName + * ASTCatchStatement#getBlock + * ASTCompilationUnit#declarationsAreInDefaultPackage + * JavaQualifiableNode + * ASTAnyTypeDeclaration#getQualifiedName + * ASTMethodOrConstructorDeclaration#getQualifiedName + * ASTLambdaExpression#getQualifiedName + * net.sourceforge.pmd.lang.java.qname and its contents + * MethodLikeNode + * Its methods will also be removed from its implementations, + ASTMethodOrConstructorDeclaration, + ASTLambdaExpression. + * ASTAnyTypeDeclaration#getImage will be removed. Please use `getSimpleName()` + instead. This affects ASTAnnotationTypeDeclaration#getImage, + ASTClassOrInterfaceDeclaration#getImage, and + ASTEnumDeclaration#getImage. + * Several methods of ASTTryStatement, replacements with other names + have been added. This includes the XPath attribute `@Finally`, replace it with a test for `child::FinallyStatement`. + * Several methods named `getGuardExpressionNode` are replaced with `getCondition`. This affects the + following nodes: WhileStatement, DoStatement, ForStatement, IfStatement, AssertStatement, ConditionalExpression. + * ASTYieldStatement will not implement TypeNode + anymore come 7.0.0. Test the type of the expression nested within it. + * JavaMetrics, JavaMetricsComputer + * ASTArguments#getArgumentCount. + Use size instead. + * ASTFormalParameters#getParameterCount. + Use size instead. +* pmd-apex + * ApexMetrics, ApexMetricsComputer + +**In ASTs (JSP)** + +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 JSP AST** (with other languages to come): + +* Manual instantiation of nodes. **Constructors of node classes are deprecated** and + marked InternalApi. Nodes should only be obtained from the parser, + which for rules, means that they 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**. The base classes are internal API + and will be hidden in version 7.0.0. You should not couple your code to them. +* In the meantime you should use interfaces like JspNode or + 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. +* The class JspParser is deprecated and should not be used directly. + Use LanguageVersionHandler#getParser instead. + +Please look at net.sourceforge.pmd.lang.jsp.ast to find out the full list of deprecations. + +**In ASTs (Velocity)** + +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 VM AST** (with other languages to come): + +* Manual instantiation of nodes. **Constructors of node classes are deprecated** and + marked InternalApi. Nodes should only be obtained from the parser, + which for rules, means that they 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**. The base classes are internal API + and will be hidden in version 7.0.0. You should not couple your code to them. +* In the meantime you should use interfaces like VtlNode or + 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. +* The package net.sourceforge.pmd.lang.vm.directive as well as the classes + DirectiveMapper and LogUtil are deprecated + for removal. They were only used internally during parsing. +* The class VmParser is deprecated and should not be used directly. + Use LanguageVersionHandler#getParser instead. + +Please look at net.sourceforge.pmd.lang.vm.ast to find out the full list of deprecations. + +**PLSQL AST** + +The production and node ASTCursorBody was unnecessary, not used and has been removed. Cursors have been already +parsed as ASTCursorSpecification. + +#### 6.21.0 + +**Deprecated APIs** + +**Internal API** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. +You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* JavaLanguageHandler +* JavaLanguageParser +* JavaDataFlowHandler +* Implementations of RuleViolationFactory in each + language module, eg JavaRuleViolationFactory. + See javadoc of RuleViolationFactory. +* Implementations of RuleViolation in each language module, + eg JavaRuleViolation. See javadoc of + RuleViolation. + +* RuleFactory +* RuleBuilder +* Constructors of RuleSetFactory, use factory methods from RulesetsFactoryUtils instead +* getRulesetFactory + +* AbstractApexNode +* AbstractApexNodeBase, and the related `visit` + methods on ApexParserVisitor and its implementations. + Use ApexNode instead, now considers comments too. + +* CharStream, JavaCharStream, + SimpleCharStream: these are APIs used by our JavaCC + implementations and that will be moved/refactored for PMD 7.0.0. They should not + be used, extended or implemented directly. +* All classes generated by JavaCC, eg JJTJavaParserState. + This includes token classes, which will be replaced with a single implementation, and + subclasses of ParseException, whose usages will be replaced + by just that superclass. + +**For removal** + +* pmd-core + * Many methods on the Node interface + and AbstractNode base class. See their javadoc for details. + * Node#isFindBoundary is deprecated for XPath queries. +* pmd-java + * AbstractJavaParser + * AbstractJavaHandler + * [`ASTAnyTypeDeclaration.TypeKind`](https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.55.0/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeDeclaration.TypeKind.html) + * ASTAnyTypeDeclaration#getTypeKind + * JavaQualifiedName + * ASTCatchStatement#getBlock + * ASTCompilationUnit#declarationsAreInDefaultPackage + * JavaQualifiableNode + * ASTAnyTypeDeclaration#getQualifiedName + * ASTMethodOrConstructorDeclaration#getQualifiedName + * ASTLambdaExpression#getQualifiedName + * net.sourceforge.pmd.lang.java.qname and its contents + * MethodLikeNode + * Its methods will also be removed from its implementations, + ASTMethodOrConstructorDeclaration, + ASTLambdaExpression. + * ASTAnyTypeDeclaration#getImage will be removed. Please use `getSimpleName()` + instead. This affects ASTAnnotationTypeDeclaration#getImage, + ASTClassOrInterfaceDeclaration#getImage, and + ASTEnumDeclaration#getImage. + * Several methods of ASTTryStatement, replacements with other names + have been added. This includes the XPath attribute `@Finally`, replace it with a test for `child::FinallyStatement`. + * Several methods named `getGuardExpressionNode` are replaced with `getCondition`. This affects the + following nodes: WhileStatement, DoStatement, ForStatement, IfStatement, AssertStatement, ConditionalExpression. + * ASTYieldStatement will not implement TypeNode + anymore come 7.0.0. Test the type of the expression nested within it. + +#### 6.20.0 + +No changes. + +#### 6.19.0 + +**Deprecated APIs** + +**For removal** + +* pmd-core + * All the package net.sourceforge.pmd.dcd and its subpackages. See DCD. + * In LanguageRegistry: + * commaSeparatedTerseNamesForLanguageVersion + * commaSeparatedTerseNamesForLanguage + * findAllVersions + * findLanguageVersionByTerseName + * getInstance + * RuleSet#getExcludePatterns. Use the new method getFileExclusions instead. + * RuleSet#getIncludePatterns. Use the new method getFileInclusions instead. + * Parser#canParse + * Parser#getSuppressMap + * RuleBuilder#RuleBuilder. Use the new constructor with the correct ResourceLoader instead. + * RuleFactory#RuleFactory. Use the new constructor with the correct ResourceLoader instead. +* pmd-java + * CanSuppressWarnings and its implementations + * isSuppressed + * getDeclaringType. + * isSupressed + * ASTMethodDeclarator + * getMethodName + * getBlock + * getParameterCount +* pmd-apex + * CanSuppressWarnings and its implementations + * isSupressed + +**Internal APIs** + +* pmd-core + * All the package net.sourceforge.pmd.util and its subpackages, + except net.sourceforge.pmd.util.datasource and net.sourceforge.pmd.util.database. + * GridBagHelper + * ColumnDescriptor + + +#### 6.18.0 + +**Changes to Renderer** + +* Each renderer has now a new method Renderer#setUseShortNames which + is used for implementing the "shortnames" CLI option. The method is automatically called by PMD, if this + CLI option is in use. When rendering filenames to the report, the new helper method + AbstractRenderer#determineFileName should be used. This will change + the filename to a short name, if the CLI option "shortnames" is used. + + Not adjusting custom renderers will make them render always the full file names and not honoring the + CLI option "shortnames". + +**Deprecated APIs** + +**For removal** + +* The methods ASTImportDeclaration#getImportedNameNode and + ASTImportDeclaration#getPackage have been deprecated and + will be removed with PMD 7.0.0. +* The method RuleContext#setSourceCodeFilename has been deprecated + and will be removed. The already existing method RuleContext#setSourceCodeFile + should be used instead. The method RuleContext#getSourceCodeFilename still + exists and returns just the filename without the full path. +* The method AbstractPMDProcessor#filenameFrom has been + deprecated. It was used to determine a "short name" of the file being analyzed, so that the report + can use short names. However, this logic has been moved to the renderers. +* The methods Report#metrics and Report#hasMetrics have + been deprecated. They were leftovers from a previous deprecation round targeting + StatisticalRule. + +**Internal APIs** + +Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning. + +* pmd-core + * net.sourceforge.pmd.cache +* pmd-java + * net.sourceforge.pmd.lang.java.typeresolution: Everything, including + subpackages, except TypeHelper and + JavaTypeDefinition. + * ASTCompilationUnit#getClassTypeResolver + + +#### 6.17.0 + +No changes. + +#### 6.16.0 + +**Deprecated APIs** + +> Reminder: Please don't use members marked with the 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 + 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 JavaNode or + 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 net.sourceforge.pmd.lang.java.ast to find out the full list +of deprecations. + + +#### 6.15.0 + +**Deprecated APIs** + +**For removal** + +* The `DumpFacades` in all languages, that could be used to transform a AST into a textual representation, + will be removed with PMD 7. The rule designer is a better way to inspect nodes. +* net.sourceforge.pmd.lang.apex.ast.DumpFacade +* net.sourceforge.pmd.lang.java.ast.DumpFacade +* net.sourceforge.pmd.lang.ecmascript.ast.DumpFacade +* net.sourceforge.pmd.lang.jsp.ast.DumpFacade +* net.sourceforge.pmd.lang.plsql.ast.DumpFacade +* net.sourceforge.pmd.lang.vf.ast.DumpFacade +* net.sourceforge.pmd.lang.vm.ast.AbstractVmNode#dump +* net.sourceforge.pmd.lang.xml.ast.DumpFacade +* The method LanguageVersionHandler#getDumpFacade will be + removed as well. It is deprecated, along with all its implementations in the subclasses of LanguageVersionHandler. + +#### 6.14.0 + +No changes. + +#### 6.13.0 + +**Command Line Interface** + +The start scripts `run.sh`, `pmd.bat` and `cpd.bat` support the new environment variable `PMD_JAVA_OPTS`. +This can be used to set arbitrary JVM options for running PMD, such as memory settings (e.g. `PMD_JAVA_OPTS=-Xmx512m`) +or enable preview language features (e.g. `PMD_JAVA_OPTS=--enable-preview`). + +The previously available variables such as `OPTS` or `HEAPSIZE` are deprecated and will be removed with PMD 7.0.0. + +**Deprecated API** + +* CodeClimateRule is deprecated in 7.0.0 because it was unused for 2 years and + created an unwanted dependency. + Properties "cc_categories", "cc_remediation_points_multiplier", "cc_block_highlighting" will also be removed. + See [#1702](https://github.com/pmd/pmd/pull/1702) for more. + +* The Apex ruleset `rulesets/apex/ruleset.xml` has been deprecated and will be removed in 7.0.0. Please use the new + quickstart ruleset `rulesets/apex/quickstart.xml` instead. + +#### 6.12.0 + +No changes. + +#### 6.11.0 + +* StatisticalRule and the related helper classes and base rule classes + are deprecated for removal in 7.0.0. This includes all of net.sourceforge.pmd.stat and net.sourceforge.pmd.lang.rule.stat, + and also AbstractStatisticalJavaRule, AbstractStatisticalApexRule and the like. + The methods Report#addMetric and metricAdded + will also be removed. +* setProperty is deprecated, + because MultiValuePropertyDescriptor is deprecated as well. + +#### 6.10.0 + +**Properties framework** + + + + + +The properties framework is about to get a lifting, and for that reason, we need to deprecate a lot of APIs +to remove them in 7.0.0. The proposed changes to the API are described [on the wiki](https://github.com/pmd/pmd/wiki/Property-framework-7-0-0) + +**Changes to how you define properties** + +* Construction of property descriptors has been possible through builders since 6.0.0. The 7.0.0 API will only allow + construction through builders. The builder hierarchy, currently found in the package net.sourceforge.pmd.properties.builders, + is being replaced by the simpler PropertyBuilder. Their APIs enjoy a high degree of source compatibility. + +* Concrete property classes like IntegerProperty and StringMultiProperty will gradually + all be deprecated until 7.0.0. Their usages should be replaced by direct usage of the PropertyDescriptor + interface, e.g. `PropertyDescriptor` or `PropertyDescriptor>`. + +* Instead of spreading properties across countless classes, the utility class PropertyFactory will become + from 7.0.0 on the only provider for property descriptor builders. Each current property type will be replaced + by a corresponding method on `PropertyFactory`: + * IntegerProperty is replaced by PropertyFactory#intProperty + * IntegerMultiProperty is replaced by PropertyFactory#intListProperty + + * FloatProperty and DoubleProperty are both replaced by PropertyFactory#doubleProperty. + Having a separate property for floats wasn't that useful. + * Similarly, FloatMultiProperty and DoubleMultiProperty are replaced by PropertyFactory#doubleListProperty. + + * StringProperty is replaced by PropertyFactory#stringProperty + * StringMultiProperty is replaced by PropertyFactory#stringListProperty + + * RegexProperty is replaced by PropertyFactory#regexProperty + + * EnumeratedProperty is replaced by PropertyFactory#enumProperty + * EnumeratedProperty is replaced by PropertyFactory#enumListProperty + + * BooleanProperty is replaced by PropertyFactory#booleanProperty + * Its multi-valued counterpart, BooleanMultiProperty, is not replaced, because it doesn't have a use case. + + * CharacterProperty is replaced by PropertyFactory#charProperty + * CharacterMultiProperty is replaced by PropertyFactory#charListProperty + + * LongProperty is replaced by PropertyFactory#longIntProperty + * LongMultiProperty is replaced by PropertyFactory#longIntListProperty + + * MethodProperty, FileProperty, TypeProperty and their multi-valued counterparts + are discontinued for lack of a use-case, and have no planned replacement in 7.0.0 for now. + + +Here's an example: +```java +// Before 7.0.0, these are equivalent: +IntegerProperty myProperty = new IntegerProperty("score", "Top score value", 1, 100, 40, 3.0f); +IntegerProperty myProperty = IntegerProperty.named("score").desc("Top score value").range(1, 100).defaultValue(40).uiOrder(3.0f); + +// They both map to the following in 7.0.0 +PropertyDescriptor myProperty = PropertyFactory.intProperty("score").desc("Top score value").require(inRange(1, 100)).defaultValue(40); +``` + +You're highly encouraged to migrate to using this new API as soon as possible, to ease your migration to 7.0.0. + + + +**Architectural simplifications** + +* EnumeratedPropertyDescriptor, NumericPropertyDescriptor, PackagedPropertyDescriptor, + and the related builders (in net.sourceforge.pmd.properties.builders) will be removed. + These specialized interfaces allowed additional constraints to be enforced on the + value of a property, but made the property class hierarchy very large and impractical + to maintain. Their functionality will be mapped uniformly to PropertyConstraints, + which will allow virtually any constraint to be defined, and improve documentation and error reporting. The + related methods PropertyTypeId#isPropertyNumeric and + PropertyTypeId#isPropertyPackaged are also deprecated. + +* MultiValuePropertyDescriptor and SingleValuePropertyDescriptor + are deprecated. 7.0.0 will introduce a new XML syntax which will remove the need for such a divide + between single- and multi-valued properties. The method PropertyDescriptor#isMultiValue will be removed + accordingly. + +**Changes to the PropertyDescriptor interface** + +* preferredRowCount is deprecated with no intended replacement. It was never implemented, and does not belong + in this interface. The methods uiOrder and `compareTo(PropertyDescriptor)` are deprecated for the + same reason. These methods mix presentation logic with business logic and are not necessary for PropertyDescriptors to work. + `PropertyDescriptor` will not extend `Comparable` anymore come 7.0.0. +* The method propertyErrorFor is deprecated and will be removed with no intended + replacement. It's really just a shortcut for `prop.errorFor(rule.getProperty(prop))`. +* `T `valueFrom(String) and `String `asDelimitedString`(T)` are deprecated and will be removed. These were + used to serialize and deserialize properties to/from a string, but 7.0.0 will introduce a more flexible + XML syntax which will make them obsolete. +* isMultiValue and type are deprecated and won't be replaced. The new XML syntax will remove the need + for a divide between multi- and single-value properties, and will allow arbitrary types to be represented. + Since arbitrary types may be represented, `type` will become obsolete as it can't represent generic types, + which will nevertheless be representable with the XML syntax. It was only used for documentation, but a + new way to document these properties exhaustively will be added with 7.0.0. +* errorFor is deprecated as its return type will be changed to `Optional` with the shift to Java 8. + +**Deprecated APIs** + + + + + + + + +**For internalization** + +* The implementation of the adapters for the XPath engines Saxon and Jaxen (package net.sourceforge.pmd.lang.ast.xpath) + are now deprecated. They'll be moved to an internal package come 7.0.0. Only Attribute remains public API. + +* The classes PropertyDescriptorField, PropertyDescriptorBuilderConversionWrapper, and the methods + PropertyDescriptor#attributeValuesById, PropertyDescriptor#isDefinedExternally and PropertyTypeId#getFactory. + These were used to read and write properties to and from XML, but were not intended as public API. + +* The class ValueParserConstants and the interface ValueParser. + +* All classes from net.sourceforge.pmd.lang.java.metrics.impl.visitors are now considered internal API. They're deprecated + and will be moved into an internal package with 7.0.0. To implement your own metrics visitors, + JavaParserVisitorAdapter should be directly subclassed. + +* LanguageVersionHandler#getDataFlowHandler(), LanguageVersionHandler#getDFAGraphRule() + +* VisitorStarter + +**For removal** + +* All classes from net.sourceforge.pmd.properties.modules will be removed. + +* The interface Dimensionable has been deprecated. + It gets in the way of a grammar change for 7.0.0 and won't be needed anymore (see [#997](https://github.com/pmd/pmd/issues/997)). + +* Several methods from ASTLocalVariableDeclaration and ASTFieldDeclaration have + also been deprecated: + +* ASTFieldDeclaration won't be a TypeNode come 7.0.0, so + getType and + getTypeDefinition are deprecated. + +* The method `getVariableName` on those two nodes will be removed, too. + +* All these are deprecated because those nodes may declare several variables at once, possibly + with different types (and obviously with different names). They both implement `Iterator<`ASTVariableId`>` + though, so you should iterate on each declared variable. See [#910](https://github.com/pmd/pmd/issues/910). + +* Visitor decorators are now deprecated and will be removed in PMD 7.0.0. They were originally a way to write + composable visitors, used in the metrics framework, but they didn't prove cost-effective. + +* In net.sourceforge.pmd.lang.java.ast: JavaParserDecoratedVisitor, JavaParserControllessVisitor, + JavaParserControllessVisitorAdapter, and JavaParserVisitorDecorator are deprecated with no intended replacement. + + +* The LanguageModules of several languages, that only support CPD execution, have been deprecated. These languages + are not fully supported by PMD, so having a language module does not make sense. The functionality of CPD is + not affected by this change. The following classes have been deprecated and will be removed with PMD 7.0.0: + +* CppHandler +* CppLanguageModule +* CppParser +* CsLanguageModule +* FortranLanguageModule +* GroovyLanguageModule +* MatlabHandler +* MatlabLanguageModule +* MatlabParser +* ObjectiveCHandler +* ObjectiveCLanguageModule +* ObjectiveCParser +* PhpLanguageModule +* PythonHandler +* PythonLanguageModule +* PythonParser +* RubyLanguageModule + + +* Optional AST processing stages like symbol table, type resolution or data-flow analysis will be reified + in 7.0.0 to factorise common logic and make them extensible. Further explanations about this change can be + found on [#1426](https://github.com/pmd/pmd/pull/1426). Consequently, the following APIs are deprecated for + removal: + * In Rule: isDfa(), isTypeResolution(), isMultifile() and their + respective setters. + * In RuleSet: usesDFA(Language), usesTypeResolution(Language), usesMultifile(Language) + * In RuleSets: usesDFA(Language), usesTypeResolution(Language), usesMultifile(Language) + * In LanguageVersionHandler: getDataFlowFacade(), getSymbolFacade(), getSymbolFacade(ClassLoader), + getTypeResolutionFacade(ClassLoader), getQualifiedNameResolutionFacade(ClassLoader) + +#### 6.9.0 + +No changes. + +#### 6.8.0 + +* A couple of methods and fields in net.sourceforge.pmd.properties.AbstractPropertySource have been + deprecated, as they are replaced by already existing functionality or expose internal implementation + details: `propertyDescriptors`, `propertyValuesByDescriptor`, + `copyPropertyDescriptors()`, `copyPropertyValues()`, `ignoredProperties()`, `usesDefaultValues()`, + `useDefaultValueFor()`. + +* Some methods in net.sourceforge.pmd.properties.PropertySource have been deprecated as well: + `usesDefaultValues()`, `useDefaultValueFor()`, `ignoredProperties()`. + +* The class net.sourceforge.pmd.lang.rule.AbstractDelegateRule has been deprecated and will + be removed with PMD 7.0.0. It is internally only in use by RuleReference. + +* The default constructor of net.sourceforge.pmd.lang.rule.RuleReference has been deprecated + and will be removed with PMD 7.0.0. RuleReferences should only be created by providing a Rule and + a RuleSetReference. Furthermore, the following methods are deprecated: `setRuleReference()`, + `hasOverriddenProperty()`, `usesDefaultValues()`, `useDefaultValueFor()`. + +#### 6.7.0 + +* All classes in the package net.sourceforge.pmd.lang.dfa.report have been deprecated and will be removed + with PMD 7.0.0. This includes the class net.sourceforge.pmd.lang.dfa.report.ReportTree. The reason is, + that this class is very specific to Java and not suitable for other languages. It has only been used for + `YAHTMLRenderer`, which has been rewritten to work without these classes. + +* The nodes RUNSIGNEDSHIFT and RSIGNEDSHIFT are deprecated and will be removed from the AST with PMD 7.0.0. + These represented the operator of ShiftExpression in two cases out of three, but they're not needed and + make ShiftExpression inconsistent. The operator of a ShiftExpression is now accessible through + ShiftExpression#getOperator. + +#### 6.5.0 + +* The utility class CommentUtil has been deprecated and will be removed + with PMD 7.0.0. Its methods have been intended to parse javadoc tags. A more useful solution will be added + around the AST node `FormalComment`, which contains as children `JavadocElement` nodes, which in + turn provide access to the `JavadocTag`. + + All comment AST nodes (`FormalComment`, `MultiLineComment`, `SingleLineComment`) have a new method + `getFilteredComment()` which provide access to the comment text without the leading `/*` markers. + +* The method `AbstractCommentRule.tagsIndicesIn()` has been deprecated and will be removed with + PMD 7.0.0. It is not very useful, since it doesn't extract the information + in a useful way. You would still need check, which tags have been found, and with which + data they might be accompanied. + +#### 6.4.0 + +* The following classes in package net.sourceforge.pmd.benchmark have been deprecated: Benchmark, Benchmarker, + BenchmarkReport, BenchmarkResult, RuleDuration, StringBuilderCR and TextReport. Their API is not supported anymore + and is disconnected from the internals of PMD. Use the newer API based around TimeTracker instead, which can be found + in the same package. +* The class TypeOfFunction has been deprecated. Use the newer TypeIsFunction in the same package. +* The `typeof` methods in JavaFunctions have been deprecated. + Use the newer `typeIs` method in the same class instead. +* The methods `isA`, `isEither` and `isNeither` of TypeHelper. + Use the new `isExactlyAny` and `isExactlyNone` methods in the same class instead. + +#### 6.2.0 + +* The static method PMDParameters#transformParametersIntoConfiguration is now deprecated, + for removal in 7.0.0. The new instance method toConfiguration replaces it. + +* The method ASTConstructorDeclaration#getParameters has been deprecated in favor of the new method + getFormalParameters. This method is available for both + ASTConstructorDeclaration and ASTMethodDeclaration. + +#### 6.1.0 + +* The method getXPathNodeName is added to the Node interface, which removes the + use of `toString` of a node to get its XPath element name (see [#569](https://github.com/pmd/pmd/issues/569)). + * The default implementation provided in AbstractNode, will be removed with 7.0.0 + * With 7.0.0, the `Node.toString` method will not necessarily provide its XPath node + name anymore. + +* The interface net.sourceforge.pmd.cpd.Renderer has been deprecated. A new interface + CPDRenderer has been introduced to replace it. The main + difference is that the new interface is meant to render directly to a `java.io.Writer` + rather than to a String. This allows to greatly reduce the memory footprint of CPD, as on + large projects, with many duplications, it was causing `OutOfMemoryError`s (see [#795](https://github.com/pmd/pmd/issues/795)). + + net.sourceforge.pmd.cpd.FileReporter has also been deprecated as part of this change, as it's no longer needed. + +#### 6.0.1 + +* The constant PMD#VERSION has been deprecated and will be removed with PMD 7.0.0. + Please use PMDVersion#VERSION instead. + + +## 🐛 Fixed Issues + +* miscellaneous + * [#881](https://github.com/pmd/pmd/issues/881): \[all] Breaking API changes for 7.0.0 + * [#896](https://github.com/pmd/pmd/issues/896): \[all] Use slf4j + * [#1431](https://github.com/pmd/pmd/pull/1431): \[ui] Remove old GUI applications (designerold, bgastviewer) + * [#1451](https://github.com/pmd/pmd/issues/1451): \[core] RulesetFactoryCompatibility stores the whole ruleset file in memory as a string + * [#2496](https://github.com/pmd/pmd/issues/2496): Update PMD 7 Logo on landing page + * [#2497](https://github.com/pmd/pmd/issues/2497): PMD 7 Logo page + * [#2498](https://github.com/pmd/pmd/issues/2498): Update PMD 7 Logo in documentation + * [#3797](https://github.com/pmd/pmd/issues/3797): \[all] Use JUnit5 + * [#4462](https://github.com/pmd/pmd/issues/4462): Provide Software Bill of Materials (SBOM) + * [#4460](https://github.com/pmd/pmd/pull/4460): Fix assembly-plugin warnings + * [#4582](https://github.com/pmd/pmd/issues/4582): \[dist] Download link broken + * [#4586](https://github.com/pmd/pmd/pull/4586): Use explicit encoding in ruleset xml files + * [#4642](https://github.com/pmd/pmd/issues/4642): Update regression tests with Java 21 language features + * [#4691](https://github.com/pmd/pmd/issues/4691): \[CVEs] Critical and High CEVs reported on PMD and PMD dependencies + * [#4699](https://github.com/pmd/pmd/pull/4699): Make PMD buildable with java 21 + * [#4736](https://github.com/pmd/pmd/issues/4736): \[ci] Improve build procedure + * [#4741](https://github.com/pmd/pmd/pull/4741): Add pmd-compat6 module for maven-pmd-plugin + * [#4749](https://github.com/pmd/pmd/pull/4749): Fixes NoSuchMethodError on processing errors in pmd-compat6 + * [#4776](https://github.com/pmd/pmd/issues/4776): \[ci] Upgrade to ruby 3 + * [#4796](https://github.com/pmd/pmd/pull/4796): Remove deprecated and release rulesets + * [#4823](https://github.com/pmd/pmd/pull/4823): Update to use renamed pmd-designer + * [#4827](https://github.com/pmd/pmd/pull/4827): \[compat6] Support config errors and cpd for csharp + * [#4830](https://github.com/pmd/pmd/issues/4830): Consolidate packages in each maven module + * [#4867](https://github.com/pmd/pmd/issues/4867): \[dist] ./mvnw command not found in dist-src +* ant + * [#4080](https://github.com/pmd/pmd/issues/4080): \[ant] Split off Ant integration into a new submodule +* core + * [#880](https://github.com/pmd/pmd/issues/880): \[core] Make visitors generic + * [#1027](https://github.com/pmd/pmd/issues/1027): \[core] Apply the new PropertyDescriptor<Pattern> type where applicable + * [#1204](https://github.com/pmd/pmd/issues/1204): \[core] Allow numeric properties in XML to be within an unbounded range + * [#1622](https://github.com/pmd/pmd/pull/1622): \[core] NodeStream API + * [#1687](https://github.com/pmd/pmd/issues/1687): \[core] Deprecate and Remove XPath 1.0 support + * [#1785](https://github.com/pmd/pmd/issues/1785): \[core] Allow abstract node types to be valid rulechain visits + * [#1825](https://github.com/pmd/pmd/pull/1825): \[core] Support NoAttribute for XPath + * [#2038](https://github.com/pmd/pmd/issues/2038): \[core] Remove DCD + * [#2218](https://github.com/pmd/pmd/issues/2218): \[core] `isFindBoundary` should not be an attribute + * [#2234](https://github.com/pmd/pmd/issues/2234): \[core] Consolidate PMD CLI into a single command + * [#2239](https://github.com/pmd/pmd/issues/2239): \[core] Merging Javacc build scripts + * [#2500](https://github.com/pmd/pmd/issues/2500): \[core] Clarify API for ANTLR based languages + * [#2518](https://github.com/pmd/pmd/issues/2518): \[core] Language properties + * [#2602](https://github.com/pmd/pmd/issues/2602): \[core] Remove ParserOptions + * [#2614](https://github.com/pmd/pmd/pull/2614): \[core] Upgrade Saxon, add XPath 3.1, remove Jaxen + * [#2696](https://github.com/pmd/pmd/pull/2696): \[core] Remove DFA + * [#2821](https://github.com/pmd/pmd/issues/2821): \[core] Rule processing error filenames are missing paths + * [#2873](https://github.com/pmd/pmd/issues/2873): \[core] Utility classes in pmd 7 + * [#2885](https://github.com/pmd/pmd/issues/2885): \[core] Error recovery mode + * [#3203](https://github.com/pmd/pmd/issues/3203): \[core] Replace RuleViolationFactory implementations with ViolationDecorator + * [#3692](https://github.com/pmd/pmd/pull/3692): \[core] Analysis listeners + * [#3782](https://github.com/pmd/pmd/issues/3782): \[core] Language lifecycle + * [#3815](https://github.com/pmd/pmd/issues/3815): \[core] Update Saxon HE to 10.7 + * [#3893](https://github.com/pmd/pmd/pull/3893): \[core] Text documents + * [#3902](https://github.com/pmd/pmd/issues/3902): \[core] Violation decorators + * [#3903](https://github.com/pmd/pmd/issues/3903): \[core] Consolidate `n.s.pmd.reporting` package + * [#3905](https://github.com/pmd/pmd/issues/3905): \[core] Stabilize tree export API + * [#3917](https://github.com/pmd/pmd/issues/3917): \[core] Consolidate `n.s.pmd.lang.rule` package + * [#3918](https://github.com/pmd/pmd/issues/3918): \[core] Make LanguageRegistry non static + * [#3919](https://github.com/pmd/pmd/issues/3919): \[core] Merge CPD and PMD language + * [#3922](https://github.com/pmd/pmd/pull/3922): \[core] Better error reporting for the ruleset parser + * [#4035](https://github.com/pmd/pmd/issues/4035): \[core] ConcurrentModificationException in DefaultRuleViolationFactory + * [#4065](https://github.com/pmd/pmd/issues/4065): \[core] Rename TokenMgrError to LexException, Tokenizer to CpdLexer + * [#4120](https://github.com/pmd/pmd/issues/4120): \[core] Explicitly name all language versions + * [#4204](https://github.com/pmd/pmd/issues/4204): \[core] Provide a CpdAnalysis class as a programmatic entry point into CPD + * [#4301](https://github.com/pmd/pmd/issues/4301): \[core] Remove deprecated property concrete classes + * [#4302](https://github.com/pmd/pmd/issues/4302): \[core] Migrate Property Framework API to Java 8 + * [#4309](https://github.com/pmd/pmd/issues/4309): \[core] Cleanups in XPath area + * [#4312](https://github.com/pmd/pmd/issues/4312): \[core] Remove unnecessary property `color` and system property `pmd.color` in `TextColorRenderer` + * [#4313](https://github.com/pmd/pmd/issues/4313): \[core] Remove support for <lang>-<ruleset> hyphen notation for ruleset references + * [#4314](https://github.com/pmd/pmd/issues/4314): \[core] Remove ruleset compatibility filter (RuleSetFactoryCompatibility) and CLI option `--no-ruleset-compatibility` + * [#4323](https://github.com/pmd/pmd/issues/4323): \[core] Refactor CPD integration + * [#4348](https://github.com/pmd/pmd/issues/4348): \[core] Consolidate @InternalApi classes + * [#4349](https://github.com/pmd/pmd/issues/4349): \[core] Cleanup remaining experimental and deprecated API + * [#4353](https://github.com/pmd/pmd/pull/4353): \[core] Micro optimizations for Node API + * [#4365](https://github.com/pmd/pmd/pull/4365): \[core] Improve benchmarking + * [#4397](https://github.com/pmd/pmd/pull/4397): \[core] Refactor CPD + * [#4378](https://github.com/pmd/pmd/issues/4378): \[core] Ruleset loading processes commented rules + * [#4420](https://github.com/pmd/pmd/pull/4420): \[core] Remove PMD.EOL + * [#4425](https://github.com/pmd/pmd/pull/4425): \[core] Replace TextFile::pathId + * [#4454](https://github.com/pmd/pmd/issues/4454): \[core] "Unknown option: '-min'" but is referenced in documentation + * [#4611](https://github.com/pmd/pmd/pull/4611): \[core] Fix loading language properties from env vars + * [#4621](https://github.com/pmd/pmd/issues/4621): \[core] Make `ClasspathClassLoader::getResource` child first + * [#4674](https://github.com/pmd/pmd/issues/4674): \[core] WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass + * [#4694](https://github.com/pmd/pmd/pull/4694): \[core] Fix line/col numbers in TokenMgrError + * [#4717](https://github.com/pmd/pmd/issues/4717): \[core] XSLTRenderer doesn't close report file + * [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer + * [#4782](https://github.com/pmd/pmd/pull/4782): \[core] Avoid using getImage/@Image +* cli + * [#2234](https://github.com/pmd/pmd/issues/2234): \[core] Consolidate PMD CLI into a single command + * [#3828](https://github.com/pmd/pmd/issues/3828): \[core] Progress reporting + * [#4079](https://github.com/pmd/pmd/issues/4079): \[cli] Split off CLI implementation into a pmd-cli submodule + * [#4423](https://github.com/pmd/pmd/pull/4423): \[cli] Fix NPE when only `--file-list` is specified + * [#4482](https://github.com/pmd/pmd/issues/4482): \[cli] pmd.bat can only be executed once + * [#4484](https://github.com/pmd/pmd/issues/4484): \[cli] ast-dump with no properties produce an NPE + * [#4594](https://github.com/pmd/pmd/pull/4594): \[cli] Change completion generation to runtime + * [#4685](https://github.com/pmd/pmd/pull/4685): \[cli] Clarify CPD documentation, fix positional parameter handling + * [#4723](https://github.com/pmd/pmd/issues/4723): \[cli] Launch fails for "bash pmd" +* doc + * [#995](https://github.com/pmd/pmd/issues/995): \[doc] Document API evolution principles as ADR + * [#2501](https://github.com/pmd/pmd/issues/2501): \[doc] Verify ANTLR Documentation + * [#2511](https://github.com/pmd/pmd/issues/2511): \[doc] Review guides for writing java/xpath rules for correctness with PMD 7 + * [#3175](https://github.com/pmd/pmd/issues/3175): \[doc] Document language module features + * [#4294](https://github.com/pmd/pmd/issues/4294): \[doc] Migration Guide for upgrading PMD 6 ➡️ 7 + * [#4303](https://github.com/pmd/pmd/issues/4303): \[doc] Document new property framework + * [#4308](https://github.com/pmd/pmd/issues/4308): \[doc] Document XPath API @DeprecatedAttribute + * [#4319](https://github.com/pmd/pmd/issues/4319): \[doc] Document TypeRes API and Symbols API + * [#4438](https://github.com/pmd/pmd/issues/4438): \[doc] Documentation links in VS Code are outdated + * [#4521](https://github.com/pmd/pmd/issues/4521): \[doc] Website is not mobile friendly + * [#4676](https://github.com/pmd/pmd/issues/4676): \[doc] Clarify how CPD `--ignore-literals` and `--ignore-identifiers` work + * [#4659](https://github.com/pmd/pmd/pull/4659): \[doc] Improve ant documentation + * [#4669](https://github.com/pmd/pmd/pull/4669): \[doc] Add bld PMD Extension to Tools / Integrations + * [#4704](https://github.com/pmd/pmd/issues/4704): \[doc] Multivalued properties do not accept \| as a separator +* testing + * [#2435](https://github.com/pmd/pmd/issues/2435): \[test] Remove duplicated Dummy language module + * [#4234](https://github.com/pmd/pmd/issues/4234): \[test] Tests that change the logging level do not work + +Language specific fixes: + +* apex + * [#1937](https://github.com/pmd/pmd/issues/1937): \[apex] Apex should only have a single RootNode + * [#1648](https://github.com/pmd/pmd/issues/1648): \[apex,vf] Remove CodeClimate dependency + * [#1750](https://github.com/pmd/pmd/pull/1750): \[apex] Remove apex statistical rules + * [#2836](https://github.com/pmd/pmd/pull/2836): \[apex] Remove Apex ProjectMirror + * [#3766](https://github.com/pmd/pmd/issues/3766): \[apex] Replace Jorje with fully open source front-end + * [#3973](https://github.com/pmd/pmd/issues/3973): \[apex] Update parser to support new 'as user' keywords (User Mode for Database Operations) + * [#4427](https://github.com/pmd/pmd/issues/4427): \[apex] ApexBadCrypto test failing to detect inline code + * [#4453](https://github.com/pmd/pmd/issues/4453): \[apex] \[7.0-rc1] Exception while initializing Apexlink (Index 34812 out of bounds for length 34812) + * [#4828](https://github.com/pmd/pmd/issues/4828): \[apex] Support null coalescing operator ?? (apex 60) + * [#4845](https://github.com/pmd/pmd/issues/4845): \[apex] Use same ANLTR version for apex-parser +* apex-design + * [#2667](https://github.com/pmd/pmd/issues/2667): \[apex] Integrate nawforce/ApexLink to build robust Unused rule + * [#4509](https://github.com/pmd/pmd/issues/4509): \[apex] ExcessivePublicCount doesn't consider inner classes correctly + * [#4596](https://github.com/pmd/pmd/issues/4596): \[apex] ExcessivePublicCount ignores properties +* apex-documentation + * [#4774](https://github.com/pmd/pmd/issues/4774): \[apex] ApexDoc false-positive for the first method of an annotated Apex class +* apex-performance + * [#4675](https://github.com/pmd/pmd/issues/4675): \[apex] New Rule: OperationWithHighCostInLoop +* apex-security + * [#4646](https://github.com/pmd/pmd/issues/4646): \[apex] ApexSOQLInjection does not recognise SObjectType or SObjectField as safe variable types +* groovy + * [#4726](https://github.com/pmd/pmd/pull/4726): \[groovy] Support Groovy to 3 and 4 and CPD suppressions +* java + * [#520](https://github.com/pmd/pmd/issues/520): \[java] Allow `@SuppressWarnings` with constants instead of literals + * [#864](https://github.com/pmd/pmd/issues/864): \[java] Similar/duplicated implementations for determining FQCN + * [#905](https://github.com/pmd/pmd/issues/905): \[java] Add new node for anonymous class declaration + * [#910](https://github.com/pmd/pmd/issues/910): \[java] AST inconsistency between primitive and reference type arrays + * [#997](https://github.com/pmd/pmd/issues/997): \[java] Java8 parsing corner case with annotated array types + * [#998](https://github.com/pmd/pmd/issues/998): \[java] AST inconsistencies around FormalParameter + * [#1019](https://github.com/pmd/pmd/issues/1019): \[java] Breaking Java Grammar changes for PMD 7.0.0 + * [#1124](https://github.com/pmd/pmd/issues/1124): \[java] ImmutableList implementation in the qname codebase + * [#1128](https://github.com/pmd/pmd/issues/1128): \[java] Improve ASTLocalVariableDeclaration + * [#1150](https://github.com/pmd/pmd/issues/1150): \[java] ClassOrInterfaceType AST improvements + * [#1207](https://github.com/pmd/pmd/issues/1207): \[java] Resolve explicit types using FQCNs, without hitting the classloader + * [#1307](https://github.com/pmd/pmd/issues/1307): \[java] AccessNode API changes + * [#1367](https://github.com/pmd/pmd/issues/1367): \[java] Parsing error on annotated inner class + * [#1661](https://github.com/pmd/pmd/issues/1661): \[java] About operator nodes + * [#2366](https://github.com/pmd/pmd/pull/2366): \[java] Remove qualified names + * [#2819](https://github.com/pmd/pmd/issues/2819): \[java] GLB bugs in pmd 7 + * [#3642](https://github.com/pmd/pmd/issues/3642): \[java] Parse error on rare extra dimensions on method return type on annotation methods + * [#3763](https://github.com/pmd/pmd/issues/3763): \[java] Ambiguous reference error in valid code + * [#3749](https://github.com/pmd/pmd/issues/3749): \[java] Improve `isOverridden` in ASTMethodDeclaration + * [#3750](https://github.com/pmd/pmd/issues/3750): \[java] Make symbol table support instanceof pattern bindings + * [#3751](https://github.com/pmd/pmd/issues/3751): \[java] Rename some node types + * [#3752](https://github.com/pmd/pmd/issues/3752): \[java] Expose annotations in symbol API + * [#4237](https://github.com/pmd/pmd/pull/4237): \[java] Cleanup handling of Java comments + * [#4317](https://github.com/pmd/pmd/issues/4317): \[java] Some AST nodes should not be TypeNodes + * [#4359](https://github.com/pmd/pmd/issues/4359): \[java] Type resolution fails with NPE when the scope is not a type declaration + * [#4367](https://github.com/pmd/pmd/issues/4367): \[java] Move testrule TypeResTest into internal + * [#4383](https://github.com/pmd/pmd/issues/4383): \[java] IllegalStateException: Object is not an array type! + * [#4401](https://github.com/pmd/pmd/issues/4401): \[java] PMD 7 fails to build under Java 19 + * [#4405](https://github.com/pmd/pmd/issues/4405): \[java] Processing error with ArrayIndexOutOfBoundsException + * [#4583](https://github.com/pmd/pmd/issues/4583): \[java] Support JDK 21 (LTS) + * [#4628](https://github.com/pmd/pmd/pull/4628): \[java] Support loading classes from java runtime images + * [#4753](https://github.com/pmd/pmd/issues/4753): \[java] PMD crashes while using generics and wildcards + * [#4757](https://github.com/pmd/pmd/issues/4757): \[java] Intermittent NPEs while analyzing Java code + * [#4794](https://github.com/pmd/pmd/issues/4794): \[java] Support JDK 22 +* java-bestpractices + * [#342](https://github.com/pmd/pmd/issues/342): \[java] AccessorMethodGeneration: Name clash with another public field not properly handled + * [#755](https://github.com/pmd/pmd/issues/755): \[java] AccessorClassGeneration false positive for private constructors + * [#770](https://github.com/pmd/pmd/issues/770): \[java] UnusedPrivateMethod yields false positive for counter-variant arguments + * [#807](https://github.com/pmd/pmd/issues/807): \[java] AccessorMethodGeneration false positive with overloads + * [#833](https://github.com/pmd/pmd/issues/833): \[java] ForLoopCanBeForeach should consider iterating on this + * [#1189](https://github.com/pmd/pmd/issues/1189): \[java] UnusedPrivateMethod false positive from inner class via external class + * [#1205](https://github.com/pmd/pmd/issues/1205): \[java] Improve ConstantsInInterface message to mention alternatives + * [#1212](https://github.com/pmd/pmd/issues/1212): \[java] Don't raise JUnitTestContainsTooManyAsserts on JUnit 5's assertAll + * [#1422](https://github.com/pmd/pmd/issues/1422): \[java] JUnitTestsShouldIncludeAssert false positive with inherited @Rule field + * [#1455](https://github.com/pmd/pmd/issues/1455): \[java] JUnitTestsShouldIncludeAssert: False positives for assert methods named "check" and "verify" + * [#1563](https://github.com/pmd/pmd/issues/1563): \[java] ForLoopCanBeForeach false positive with method call using index variable + * [#1565](https://github.com/pmd/pmd/issues/1565): \[java] JUnitAssertionsShouldIncludeMessage false positive with AssertJ + * [#1747](https://github.com/pmd/pmd/issues/1747): \[java] PreserveStackTrace false-positive + * [#1969](https://github.com/pmd/pmd/issues/1969): \[java] MissingOverride false-positive triggered by package-private method overwritten in another package by extending class + * [#1998](https://github.com/pmd/pmd/issues/1998): \[java] AccessorClassGeneration false-negative: subclass calls private constructor + * [#2130](https://github.com/pmd/pmd/issues/2130): \[java] UnusedLocalVariable: false-negative with array + * [#2147](https://github.com/pmd/pmd/issues/2147): \[java] JUnitTestsShouldIncludeAssert - false positives with lambdas and static methods + * [#2464](https://github.com/pmd/pmd/issues/2464): \[java] LooseCoupling must ignore class literals: ArrayList.class + * [#2542](https://github.com/pmd/pmd/issues/2542): \[java] UseCollectionIsEmpty can not detect the case `foo.bar().size()` + * [#2650](https://github.com/pmd/pmd/issues/2650): \[java] UseTryWithResources false positive when AutoCloseable helper used + * [#2796](https://github.com/pmd/pmd/issues/2796): \[java] UnusedAssignment false positive with call chains + * [#2797](https://github.com/pmd/pmd/issues/2797): \[java] MissingOverride long-standing issues + * [#2806](https://github.com/pmd/pmd/issues/2806): \[java] SwitchStmtsShouldHaveDefault false-positive with Java 14 switch non-fallthrough branches + * [#2822](https://github.com/pmd/pmd/issues/2822): \[java] LooseCoupling rule: Extend to cover user defined implementations and interfaces + * [#2843](https://github.com/pmd/pmd/pull/2843): \[java] Fix UnusedAssignment FP with field accesses + * [#2882](https://github.com/pmd/pmd/issues/2882): \[java] UseTryWithResources - false negative for explicit close + * [#2883](https://github.com/pmd/pmd/issues/2883): \[java] JUnitAssertionsShouldIncludeMessage false positive with method call + * [#2890](https://github.com/pmd/pmd/issues/2890): \[java] UnusedPrivateMethod false positive with generics + * [#2946](https://github.com/pmd/pmd/issues/2946): \[java] SwitchStmtsShouldHaveDefault false positive on enum inside enums + * [#3672](https://github.com/pmd/pmd/pull/3672): \[java] LooseCoupling - fix false positive with generics + * [#3675](https://github.com/pmd/pmd/pull/3675): \[java] MissingOverride - fix false positive with mixing type vars + * [#3858](https://github.com/pmd/pmd/issues/3858): \[java] UseCollectionIsEmpty should infer local variable type from method invocation + * [#4433](https://github.com/pmd/pmd/issues/4433): \[java] \[7.0-rc1] ReplaceHashtableWithMap on java.util.Properties + * [#4492](https://github.com/pmd/pmd/issues/4492): \[java] GuardLogStatement gives false positive when argument is a Java method reference + * [#4503](https://github.com/pmd/pmd/issues/4503): \[java] JUnitTestsShouldIncludeAssert: false negative with TestNG + * [#4516](https://github.com/pmd/pmd/issues/4516): \[java] UnusedLocalVariable: false-negative with try-with-resources + * [#4517](https://github.com/pmd/pmd/issues/4517): \[java] UnusedLocalVariable: false-negative with compound assignments + * [#4518](https://github.com/pmd/pmd/issues/4518): \[java] UnusedLocalVariable: false-positive with multiple for-loop indices + * [#4603](https://github.com/pmd/pmd/issues/4603): \[java] UnusedAssignment false positive in record compact constructor + * [#4625](https://github.com/pmd/pmd/issues/4625): \[java] UnusedPrivateMethod false positive: Autoboxing into Number + * [#4634](https://github.com/pmd/pmd/issues/4634): \[java] JUnit4TestShouldUseTestAnnotation false positive with TestNG + * [#4817](https://github.com/pmd/pmd/issues/4817): \[java] UnusedPrivateMethod false-positive used in lambda +* java-codestyle + * [#1208](https://github.com/pmd/pmd/issues/1208): \[java] PrematureDeclaration rule false-positive on variable declared to measure time + * [#1429](https://github.com/pmd/pmd/issues/1429): \[java] PrematureDeclaration as result of method call (false positive) + * [#1480](https://github.com/pmd/pmd/issues/1480): \[java] IdenticalCatchBranches false positive with return expressions + * [#1673](https://github.com/pmd/pmd/issues/1673): \[java] UselessParentheses false positive with conditional operator + * [#1790](https://github.com/pmd/pmd/issues/1790): \[java] UnnecessaryFullyQualifiedName false positive with enum constant + * [#1918](https://github.com/pmd/pmd/issues/1918): \[java] UselessParentheses false positive with boolean operators + * [#2134](https://github.com/pmd/pmd/issues/2134): \[java] PreserveStackTrace not handling `Throwable.addSuppressed(...)` + * [#2299](https://github.com/pmd/pmd/issues/2299): \[java] UnnecessaryFullyQualifiedName false positive with similar package name + * [#2391](https://github.com/pmd/pmd/issues/2391): \[java] UseDiamondOperator FP when expected type and constructed type have a different parameterization + * [#2528](https://github.com/pmd/pmd/issues/2528): \[java] MethodNamingConventions - JUnit 5 method naming not support ParameterizedTest + * [#2739](https://github.com/pmd/pmd/issues/2739): \[java] UselessParentheses false positive for string concatenation + * [#2748](https://github.com/pmd/pmd/issues/2748): \[java] UnnecessaryCast false positive with unchecked cast + * [#2847](https://github.com/pmd/pmd/issues/2847): \[java] New Rule: Use Explicit Types + * [#2973](https://github.com/pmd/pmd/issues/2973): \[java] New rule: UnnecessaryBoxing + * [#3195](https://github.com/pmd/pmd/pull/3195): \[java] Improve rule UnnecessaryReturn to detect more cases + * [#3218](https://github.com/pmd/pmd/pull/3218): \[java] Generalize UnnecessaryCast to flag all unnecessary casts + * [#3221](https://github.com/pmd/pmd/issues/3221): \[java] PrematureDeclaration false positive for unused variables + * [#3238](https://github.com/pmd/pmd/issues/3238): \[java] Improve ExprContext, fix FNs of UnnecessaryCast + * [#3500](https://github.com/pmd/pmd/pull/3500): \[java] UnnecessaryBoxing - check for Integer.valueOf(String) calls + * [#4239](https://github.com/pmd/pmd/issues/4239): \[java] UnnecessaryLocalBeforeReturn - false positive with catch clause + * [#4268](https://github.com/pmd/pmd/issues/4268): \[java] CommentDefaultAccessModifier: false positive with TestNG annotations + * [#4273](https://github.com/pmd/pmd/issues/4273): \[java] CommentDefaultAccessModifier ignoredAnnotations should include "org.junit.jupiter.api.extension.RegisterExtension" by default + * [#4357](https://github.com/pmd/pmd/pull/4357): \[java] Fix IllegalStateException in UseDiamondOperator rule + * [#4432](https://github.com/pmd/pmd/issues/4432): \[java] \[7.0-rc1] UnnecessaryImport - Unused static import is being used + * [#4455](https://github.com/pmd/pmd/issues/4455): \[java] FieldNamingConventions: false positive with lombok's @UtilityClass + * [#4487](https://github.com/pmd/pmd/issues/4487): \[java] UnnecessaryConstructor: false-positive with @Inject and @Autowired + * [#4511](https://github.com/pmd/pmd/issues/4511): \[java] LocalVariableCouldBeFinal shouldn't report unused variables + * [#4512](https://github.com/pmd/pmd/issues/4512): \[java] MethodArgumentCouldBeFinal shouldn't report unused parameters + * [#4557](https://github.com/pmd/pmd/issues/4557): \[java] UnnecessaryImport FP with static imports of overloaded methods + * [#4578](https://github.com/pmd/pmd/issues/4578): \[java] CommentDefaultAccessModifier comment needs to be before annotation if present + * [#4631](https://github.com/pmd/pmd/issues/4631): \[java] UnnecessaryFullyQualifiedName fails to recognize illegal self reference in enums + * [#4645](https://github.com/pmd/pmd/issues/4645): \[java] CommentDefaultAccessModifier - False Positive with JUnit5's ParameterizedTest + * [#4754](https://github.com/pmd/pmd/pull/4754): \[java] EmptyControlStatementRule: Add allowCommentedBlocks property + * [#4816](https://github.com/pmd/pmd/issues/4816): \[java] UnnecessaryImport false-positive on generic method call with on lambda +* java-design + * [#174](https://github.com/pmd/pmd/issues/174): \[java] SingularField false positive with switch in method that both assigns and reads field + * [#1014](https://github.com/pmd/pmd/issues/1014): \[java] LawOfDemeter: False positive with lambda expression + * [#1605](https://github.com/pmd/pmd/issues/1605): \[java] LawOfDemeter: False positive for standard UTF-8 charset name + * [#2160](https://github.com/pmd/pmd/issues/2160): \[java] Issues with Law of Demeter + * [#2175](https://github.com/pmd/pmd/issues/2175): \[java] LawOfDemeter: False positive for chained methods with generic method call + * [#2179](https://github.com/pmd/pmd/issues/2179): \[java] LawOfDemeter: False positive with static property access - should treat class-level property as global object, not dot-accessed property + * [#2180](https://github.com/pmd/pmd/issues/2180): \[java] LawOfDemeter: False positive with Thread and ThreadLocalRandom + * [#2182](https://github.com/pmd/pmd/issues/2182): \[java] LawOfDemeter: False positive with package-private access + * [#2188](https://github.com/pmd/pmd/issues/2188): \[java] LawOfDemeter: False positive with fields assigned to local vars + * [#2536](https://github.com/pmd/pmd/issues/2536): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal can't detect inner class + * [#3668](https://github.com/pmd/pmd/pull/3668): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal - fix FP with inner private classes + * [#3754](https://github.com/pmd/pmd/issues/3754): \[java] SingularField false positive with read in while condition + * [#3786](https://github.com/pmd/pmd/issues/3786): \[java] SimplifyBooleanReturns should consider operator precedence + * [#3840](https://github.com/pmd/pmd/issues/3840): \[java] LawOfDemeter disallows method call on locally created object + * [#4238](https://github.com/pmd/pmd/pull/4238): \[java] Make LawOfDemeter not use the rulechain + * [#4254](https://github.com/pmd/pmd/issues/4254): \[java] ImmutableField - false positive with Lombok @Setter + * [#4434](https://github.com/pmd/pmd/issues/4434): \[java] \[7.0-rc1] ExceptionAsFlowControl when simply propagating + * [#4456](https://github.com/pmd/pmd/issues/4456): \[java] FinalFieldCouldBeStatic: false positive with lombok's @UtilityClass + * [#4477](https://github.com/pmd/pmd/issues/4477): \[java] SignatureDeclareThrowsException: false-positive with TestNG annotations + * [#4490](https://github.com/pmd/pmd/issues/4490): \[java] ImmutableField - false negative with Lombok @Getter + * [#4549](https://github.com/pmd/pmd/pull/4549): \[java] Make LawOfDemeter results deterministic +* java-documentation + * [#4369](https://github.com/pmd/pmd/pull/4369): \[java] Improve CommentSize + * [#4416](https://github.com/pmd/pmd/pull/4416): \[java] Fix reported line number in CommentContentRule +* java-errorprone + * [#659](https://github.com/pmd/pmd/issues/659): \[java] MissingBreakInSwitch - last default case does not contain a break + * [#718](https://github.com/pmd/pmd/issues/718): \[java] BrokenNullCheck false positive with parameter/field confusion + * [#932](https://github.com/pmd/pmd/issues/932): \[java] SingletonClassReturningNewInstance false positive with double assignment + * [#1005](https://github.com/pmd/pmd/issues/1005): \[java] CloneMethodMustImplementCloneable triggers for interfaces + * [#1669](https://github.com/pmd/pmd/issues/1669): \[java] NullAssignment - FP with ternay and null as constructor argument + * [#1831](https://github.com/pmd/pmd/issues/1831): \[java] DetachedTestCase reports abstract methods + * [#1899](https://github.com/pmd/pmd/issues/1899): \[java] Recognize @SuppressWanings("fallthrough") for MissingBreakInSwitch + * [#2320](https://github.com/pmd/pmd/issues/2320): \[java] NullAssignment - FP with ternary and null as method argument + * [#2532](https://github.com/pmd/pmd/issues/2532): \[java] AvoidDecimalLiteralsInBigDecimalConstructor can not detect the case `new BigDecimal(Expression)` + * [#2579](https://github.com/pmd/pmd/issues/2579): \[java] MissingBreakInSwitch detects the lack of break in the last case + * [#2880](https://github.com/pmd/pmd/issues/2880): \[java] CompareObjectsWithEquals - false negative with type res + * [#2893](https://github.com/pmd/pmd/issues/2893): \[java] Remove special cases from rule EmptyCatchBlock + * [#2894](https://github.com/pmd/pmd/issues/2894): \[java] Improve MissingBreakInSwitch + * [#3071](https://github.com/pmd/pmd/issues/3071): \[java] BrokenNullCheck FP with PMD 6.30.0 + * [#3087](https://github.com/pmd/pmd/issues/3087): \[java] UnnecessaryBooleanAssertion overlaps with SimplifiableTestAssertion + * [#3100](https://github.com/pmd/pmd/issues/3100): \[java] UseCorrectExceptionLogging FP in 6.31.0 + * [#3173](https://github.com/pmd/pmd/issues/3173): \[java] UseProperClassLoader false positive + * [#3351](https://github.com/pmd/pmd/issues/3351): \[java] ConstructorCallsOverridableMethod ignores abstract methods + * [#3400](https://github.com/pmd/pmd/issues/3400): \[java] AvoidUsingOctalValues FN with underscores + * [#3843](https://github.com/pmd/pmd/issues/3843): \[java] UseEqualsToCompareStrings should consider return type + * [#4063](https://github.com/pmd/pmd/issues/4063): \[java] AvoidBranchingStatementAsLastInLoop: False-negative about try/finally block + * [#4356](https://github.com/pmd/pmd/pull/4356): \[java] Fix NPE in CloseResourceRule + * [#4449](https://github.com/pmd/pmd/issues/4449): \[java] AvoidAccessibilityAlteration: Possible false positive in AvoidAccessibilityAlteration rule when using Lambda expression + * [#4457](https://github.com/pmd/pmd/issues/4457): \[java] OverrideBothEqualsAndHashcode: false negative with anonymous classes + * [#4493](https://github.com/pmd/pmd/issues/4493): \[java] MissingStaticMethodInNonInstantiatableClass: false-positive about @Inject + * [#4505](https://github.com/pmd/pmd/issues/4505): \[java] ImplicitSwitchFallThrough NPE in PMD 7.0.0-rc1 + * [#4510](https://github.com/pmd/pmd/issues/4510): \[java] ConstructorCallsOverridableMethod: false positive with lombok's @Value + * [#4513](https://github.com/pmd/pmd/issues/4513): \[java] UselessOperationOnImmutable various false negatives with String + * [#4514](https://github.com/pmd/pmd/issues/4514): \[java] AvoidLiteralsInIfCondition false positive and negative for String literals when ignoreExpressions=true + * [#4546](https://github.com/pmd/pmd/issues/4546): \[java] OverrideBothEqualsAndHashCode ignores records + * [#4719](https://github.com/pmd/pmd/pull/4719): \[java] UnnecessaryCaseChange: example doc toUpperCase() should compare to a capitalized string +* java-multithreading + * [#2537](https://github.com/pmd/pmd/issues/2537): \[java] DontCallThreadRun can't detect the case that call run() in `this.run()` + * [#2538](https://github.com/pmd/pmd/issues/2538): \[java] DontCallThreadRun can't detect the case that call run() in `foo.bar.run()` + * [#2577](https://github.com/pmd/pmd/issues/2577): \[java] UseNotifyAllInsteadOfNotify falsely detect a special case with argument: `foo.notify(bar)` + * [#4483](https://github.com/pmd/pmd/issues/4483): \[java] NonThreadSafeSingleton false positive with double-checked locking +* java-performance + * [#1224](https://github.com/pmd/pmd/issues/1224): \[java] InefficientEmptyStringCheck false negative in anonymous class + * [#2587](https://github.com/pmd/pmd/issues/2587): \[java] AvoidArrayLoops could also check for list copy through iterated List.add() + * [#2712](https://github.com/pmd/pmd/issues/2712): \[java] SimplifyStartsWith false-positive with AssertJ + * [#3486](https://github.com/pmd/pmd/pull/3486): \[java] InsufficientStringBufferDeclaration: Fix NPE + * [#3848](https://github.com/pmd/pmd/issues/3848): \[java] StringInstantiation: false negative when using method result + * [#4070](https://github.com/pmd/pmd/issues/4070): \[java] A false positive about the rule RedundantFieldInitializer + * [#4458](https://github.com/pmd/pmd/issues/4458): \[java] RedundantFieldInitializer: false positive with lombok's @Value +* javascript + * [#4673](https://github.com/pmd/pmd/pull/4673): \[javascript] CPD: Added support for decorator notation +* kotlin + * [#419](https://github.com/pmd/pmd/issues/419): \[kotlin] Add support for Kotlin + * [#4389](https://github.com/pmd/pmd/pull/4389): \[kotlin] Update grammar to version 1.8 +* plsql + * [#4820](https://github.com/pmd/pmd/issues/4820): \[plsql] WITH clause is ignored for SELECT INTO statements +* swift + * [#1877](https://github.com/pmd/pmd/pull/1877): \[swift] Feature/swift rules + * [#1882](https://github.com/pmd/pmd/pull/1882): \[swift] UnavailableFunction Swift rule + * [#4697](https://github.com/pmd/pmd/issues/4697): \[swift] Support Swift 5.9 features (mainly macros expansion expressions) +* xml + * [#1800](https://github.com/pmd/pmd/pull/1800): \[xml] Unimplement org.w3c.dom.Node from the XmlNodeWrapper +* xml-bestpractices + * [#4592](https://github.com/pmd/pmd/pull/4592): \[xml] Add MissingEncoding rule + +## ✨ External Contributions + +* [#1658](https://github.com/pmd/pmd/pull/1658): \[core] Node support for Antlr-based languages - [Matías Fraga](https://github.com/matifraga) (@matifraga) +* [#1698](https://github.com/pmd/pmd/pull/1698): \[core] [swift] Antlr Base Parser adapter and Swift Implementation - [Lucas Soncini](https://github.com/lsoncini) (@lsoncini) +* [#1774](https://github.com/pmd/pmd/pull/1774): \[core] Antlr visitor rules - [Lucas Soncini](https://github.com/lsoncini) (@lsoncini) +* [#1877](https://github.com/pmd/pmd/pull/1877): \[swift] Feature/swift rules - [Matías Fraga](https://github.com/matifraga) (@matifraga) +* [#1881](https://github.com/pmd/pmd/pull/1881): \[doc] Add ANTLR documentation - [Matías Fraga](https://github.com/matifraga) (@matifraga) +* [#1882](https://github.com/pmd/pmd/pull/1882): \[swift] UnavailableFunction Swift rule - [Tomás de Lucca](https://github.com/tomidelucca) (@tomidelucca) +* [#2830](https://github.com/pmd/pmd/pull/2830): \[apex] Apexlink POC - [Kevin Jones](https://github.com/nawforce) (@nawforce) +* [#3866](https://github.com/pmd/pmd/pull/3866): \[core] Add CLI Progress Bar - [@JerritEic](https://github.com/JerritEic) (@JerritEic) +* [#4093](https://github.com/pmd/pmd/pull/4093): \[apex] Summit-AST Apex module - Part 1 - [Edward Klimoshenko](https://github.com/eklimo) (@eklimo) +* [#4151](https://github.com/pmd/pmd/pull/4151): \[apex] Summit-AST Apex module - Part 2 - expression nodes - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) +* [#4171](https://github.com/pmd/pmd/pull/4171): \[apex] Summit-AST Apex module - Part 3 - initializers - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) +* [#4206](https://github.com/pmd/pmd/pull/4206): \[apex] Summit-AST Apex module - Part 4 - statements - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) +* [#4219](https://github.com/pmd/pmd/pull/4219): \[apex] Summit-AST Apex module - Part 5 - annotations, triggers, misc. - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) +* [#4242](https://github.com/pmd/pmd/pull/4242): \[apex] Merge 6.52 into experimental-apex-parser - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) +* [#4251](https://github.com/pmd/pmd/pull/4251): \[apex] Summit-AST Apex module - Part 6 Passing testsuite - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) +* [#4402](https://github.com/pmd/pmd/pull/4402): \[javascript] CPD: add support for Typescript using antlr4 grammar - [Paul Guyot](https://github.com/pguyot) (@pguyot) +* [#4403](https://github.com/pmd/pmd/pull/4403): \[julia] CPD: Add support for Julia code duplication - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) +* [#4412](https://github.com/pmd/pmd/pull/4412): \[doc] Added new error msg to ConstantsInInterface - [David Ljunggren](https://github.com/dague1) (@dague1) +* [#4426](https://github.com/pmd/pmd/pull/4426): \[cpd] New XML to HTML XLST report format for PMD CPD - [mohan-chinnappan-n](https://github.com/mohan-chinnappan-n) (@mohan-chinnappan-n) +* [#4428](https://github.com/pmd/pmd/pull/4428): \[apex] ApexBadCrypto bug fix for #4427 - inline detection of hard coded values - [Steven Stearns](https://github.com/sfdcsteve) (@sfdcsteve) +* [#4431](https://github.com/pmd/pmd/pull/4431): \[coco] CPD: Coco support for code duplication detection - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) +* [#4444](https://github.com/pmd/pmd/pull/4444): \[java] CommentDefaultAccessModifier - ignore org.junit.jupiter.api.extension.RegisterExtension by default - [Nirvik Patel](https://github.com/nirvikpatel) (@nirvikpatel) +* [#4448](https://github.com/pmd/pmd/pull/4448): \[apex] Bump summit-ast to new release 2.1.0 (and remove workaround) - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) +* [#4450](https://github.com/pmd/pmd/pull/4450): \[java] Fix #4449 AvoidAccessibilityAlteration: Correctly handle Lambda expressions in PrivilegedAction scenarios - [Seren](https://github.com/mohui1999) (@mohui1999) +* [#4452](https://github.com/pmd/pmd/pull/4452): \[doc] Update PMD_APEX_ROOT_DIRECTORY documentation reference - [nwcm](https://github.com/nwcm) (@nwcm) +* [#4470](https://github.com/pmd/pmd/pull/4470): \[cpp] CPD: Added strings as literal and ignore identifiers in sequences - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) +* [#4474](https://github.com/pmd/pmd/pull/4474): \[java] ImmutableField: False positive with lombok (fixes #4254) - [Pim van der Loos](https://github.com/PimvanderLoos) (@PimvanderLoos) +* [#4479](https://github.com/pmd/pmd/pull/4479): \[apex] Merge main (7.x) branch into experimental-apex-parser and fix tests - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google) +* [#4488](https://github.com/pmd/pmd/pull/4488): \[java] Fix #4477: A false-positive about SignatureDeclareThrowsException - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4494](https://github.com/pmd/pmd/pull/4494): \[java] Fix #4487: A false-positive about UnnecessaryConstructor and @Inject and @Autowired - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4495](https://github.com/pmd/pmd/pull/4495): \[java] Fix #4493: false-positive about MissingStaticMethodInNonInstantiatableClass and @Inject - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4507](https://github.com/pmd/pmd/pull/4507): \[java] Fix #4503: A false negative about JUnitTestsShouldIncludeAssert and testng - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4520](https://github.com/pmd/pmd/pull/4520): \[doc] Fix typo: missing closing quotation mark after CPD-END - [João Dinis Ferreira](https://github.com/joaodinissf) (@joaodinissf) +* [#4528](https://github.com/pmd/pmd/pull/4528): \[apex] Update to apexlink - [Kevin Jones](https://github.com/nawforce) (@nawforce) +* [#4533](https://github.com/pmd/pmd/pull/4533): \[java] Fix #4063: False-negative about try/catch block in Loop - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4536](https://github.com/pmd/pmd/pull/4536): \[java] Fix #4268: CommentDefaultAccessModifier - false positive with TestNG's @Test annotation - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4537](https://github.com/pmd/pmd/pull/4537): \[java] Fix #4455: A false positive about FieldNamingConventions and UtilityClass - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4538](https://github.com/pmd/pmd/pull/4538): \[java] Fix #4456: A false positive about FinalFieldCouldBeStatic and UtilityClass - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4540](https://github.com/pmd/pmd/pull/4540): \[java] Fix #4457: false negative about OverrideBothEqualsAndHashcode - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4541](https://github.com/pmd/pmd/pull/4541): \[java] Fix #4458: A false positive about RedundantFieldInitializer and @Value - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4542](https://github.com/pmd/pmd/pull/4542): \[java] Fix #4510: A false positive about ConstructorCallsOverridableMethod and @Value - [AnnaDev](https://github.com/LynnBroe) (@LynnBroe) +* [#4553](https://github.com/pmd/pmd/pull/4553): \[java] Fix #4492: GuardLogStatement gives false positive when argument is a Java method reference - [Anastasiia Koba](https://github.com/anastasiia-koba) (@anastasiia-koba) +* [#4562](https://github.com/pmd/pmd/pull/4562): \[apex] Fixes #4556 - Update Apex bind regex match for all possible combinations - [nwcm](https://github.com/nwcm) (@nwcm) +* [#4637](https://github.com/pmd/pmd/pull/4637): \[java] fix #4634 - JUnit4TestShouldUseTestAnnotation false positive with TestNG - [Krystian Dabrowski](https://github.com/krdabrowski) (@krdabrowski) +* [#4640](https://github.com/pmd/pmd/pull/4640): \[cli] Launch script fails if run via "bash pmd" - [Shai Bennathan](https://github.com/shai-bennathan) (@shai-bennathan) +* [#4649](https://github.com/pmd/pmd/pull/4649): \[apex] Add SObjectType and SObjectField to list of injectable SOQL variable types - [Richard Corfield](https://github.com/rcorfieldffdc) (@rcorfieldffdc) +* [#4651](https://github.com/pmd/pmd/pull/4651): \[doc] Add "Tencent Cloud Code Analysis" in Tools / Integrations - [yale](https://github.com/cyw3) (@cyw3) +* [#4664](https://github.com/pmd/pmd/pull/4664): \[cli] CPD: Fix NPE when only `--file-list` is specified - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) +* [#4665](https://github.com/pmd/pmd/pull/4665): \[java] Doc: Fix references AutoClosable -> AutoCloseable - [Andrey Bozhko](https://github.com/AndreyBozhko) (@AndreyBozhko) +* [#4673](https://github.com/pmd/pmd/pull/4673): \[javascript] CPD: Added support for decorator notation - [Wener](https://github.com/wener-tiobe) (@wener-tiobe) +* [#4677](https://github.com/pmd/pmd/pull/4677): \[apex] Add new rule: OperationWithHighCostInLoop - [Thomas Prouvot](https://github.com/tprouvot) (@tprouvot) +* [#4698](https://github.com/pmd/pmd/pull/4698): \[swift] Add macro expansion support for swift 5.9 - [Richard B.](https://github.com/kenji21) (@kenji21) +* [#4706](https://github.com/pmd/pmd/pull/4706): \[java] DetachedTestCase should not report on abstract methods - [Debamoy Datta](https://github.com/Debamoy) (@Debamoy) +* [#4719](https://github.com/pmd/pmd/pull/4719): \[java] UnnecessaryCaseChange: example doc toUpperCase() should compare to a capitalized string - [ciufudean](https://github.com/ciufudean) (@ciufudean) +* [#4738](https://github.com/pmd/pmd/pull/4738): \[doc] Added reference to the PMD extension for bld - [Erik C. Thauvin](https://github.com/ethauvin) (@ethauvin) +* [#4749](https://github.com/pmd/pmd/pull/4749): Fixes NoSuchMethodError on processing errors in pmd-compat6 - [Andreas Bergander](https://github.com/bergander) (@bergander) +* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer - [219sansim](https://github.com/219sansim) (@219sansim) +* [#4752](https://github.com/pmd/pmd/pull/4752): \[core] Fix flaky LatticeRelationTest - [219sansim](https://github.com/219sansim) (@219sansim) +* [#4754](https://github.com/pmd/pmd/pull/4754): \[java] EmptyControlStatementRule: Add allowCommentedBlocks property - [Andreas Bergander](https://github.com/bergander) (@bergander) +* [#4759](https://github.com/pmd/pmd/pull/4759): \[java] fix: remove delimiter attribute from ruleset category/java/errorprone.xml - [Marcin Dąbrowski](https://github.com/marcindabrowski) (@marcindabrowski) +* [#4825](https://github.com/pmd/pmd/pull/4825): \[plsql] Fix ignored WITH clause for SELECT INTO statements - [Laurent Bovet](https://github.com/lbovet) (@lbovet) +* [#4857](https://github.com/pmd/pmd/pull/4857): \[javascript] Fix UnnecessaryBlock issues with empty statements - [Oleksandr Shvets](https://github.com/oleksandr-shvets) (@oleksandr-shvets) From 8a67424c8c11da41704e194c89f0ea44570af8aa Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 14:47:28 +0200 Subject: [PATCH 079/142] do-release.sh: Don't delete release_notes_pmd7.md --- do-release.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/do-release.sh b/do-release.sh index a9ea48d7e0..4107f3ff5b 100755 --- a/do-release.sh +++ b/do-release.sh @@ -245,9 +245,6 @@ ${NEW_RELEASE_NOTES} ${OLD_RELEASE_NOTES}" > docs/pages/release_notes_old.md -# update release_notes_pmd7 with prerendered version (jdoc tags are replaced with released version) -echo "$RELEASE_NOTES_PMD7" > docs/pages/release_notes_pmd7.md - # reset release notes template cat > docs/pages/release_notes.md < Date: Fri, 26 Apr 2024 14:48:39 +0200 Subject: [PATCH 080/142] do-release.sh: Clarify the wait --- do-release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/do-release.sh b/do-release.sh index 4107f3ff5b..10f113a271 100755 --- a/do-release.sh +++ b/do-release.sh @@ -204,6 +204,7 @@ echo echo "Tag has been pushed.... now check github actions: " echo echo "Now wait, until first stage of the release is finished successfully..." +echo "You don't need to wait until artefacts are in maven central, just the github action must be successful." echo echo "If it is failing, you can fix the code/scripts and force push the tag via" echo From d296dc5782c67cf37d6e003afa76f1a40320794c Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 14:56:36 +0200 Subject: [PATCH 081/142] do-release.sh: add matrix/pmd_pmd:gitter.im --- do-release.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/do-release.sh b/do-release.sh index 10f113a271..523f41b722 100755 --- a/do-release.sh +++ b/do-release.sh @@ -346,6 +346,8 @@ tweet="${tweet//$'\r'/}" tweet="${tweet//$'\n'/%0A}" echo "* Tweet about this release on https://twitter.com/pmd_analyzer:" echo " " +echo "* Post this also into :" +echo " PMD ${RELEASE_VERSION} released: https://github.com/pmd/pmd/releases/tag/pmd_releases/${RELEASE_VERSION} #PMD" echo echo echo "Now waiting for the release to be finished..." From b1834d6ead738f2347b99a3b5a8f5b17e47ccedd Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 15:17:12 +0200 Subject: [PATCH 082/142] [ci] Avoid caching missed dependencies When a dependency is not available, maven creates a file with extension .lastUpdated. When such a file is present maven usually doesn't check again for updates (unless -U is used). --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index acbecfa5cc..e37d01fa33 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,6 +48,8 @@ jobs: ~/.cache ~/work/pmd/target/repositories vendor/bundle + # avoid caching missed dependencies + !~/.m2/repository/**/*.lastUpdated key: v3-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} restore-keys: | v3-${{ runner.os }}- From 629e3f8b836ad6876aef0d83435dbf9ccec23cd0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 15:39:46 +0200 Subject: [PATCH 083/142] [doc] Update releasing documentation --- .../pmd/projectdocs/committers/releasing.md | 77 +++++++++---------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/docs/pages/pmd/projectdocs/committers/releasing.md b/docs/pages/pmd/projectdocs/committers/releasing.md index caa058dfec..ab36fbdea3 100644 --- a/docs/pages/pmd/projectdocs/committers/releasing.md +++ b/docs/pages/pmd/projectdocs/committers/releasing.md @@ -2,7 +2,7 @@ title: Release process permalink: pmd_projectdocs_committers_releasing.html author: Romain Pelisse , Andreas Dangel -last_updated: April 2021 +last_updated: April 2024 --- This page describes the current status of the release process. @@ -72,13 +72,13 @@ in order to release version "6.34.0", the configuration should look like this: ```yaml pmd: - version: 6.34.0 - previous_version: 6.33.0 - date: 24-April-2021 + version: 7.2.0 + previous_version: 7.1.0 + date: 31-May-2024 release_type: minor ``` -The release type could be one of "bugfix" (e.g. 6.34.x), "minor" (6.x.0), or "major" (x.0.0). +The release type could be one of "bugfix" (e.g. 7.1.x), "minor" (7.x.0), or "major" (x.0.0). The release notes usually mention any new rules that have been added since the last release. @@ -88,7 +88,7 @@ Add the new rules as comments to the quickstart rulesets: The designer lives at [pmd/pmd-designer](https://github.com/pmd/pmd-designer). Update property `pmd-designer.version` in **pom.xml** to reference the new version, that will be released -shortly. Note: This version does at the moment not exist. That means, that a full build of the sources +shortly. Note: This new version does at the moment not exist. That means, that a full build of the sources will currently fail. That's why the first phase of the release will build only pmd-core and languages but not pmd-cli and pmd-dist. @@ -97,13 +97,14 @@ Then we can skip the release of pmd-designer and immediately start the second ph Starting with PMD 6.23.0 we'll provide small statistics for every release. This needs to be added to the release notes as the last section. To count the closed issues and pull requests, the milestone -on GitHub with the title of the new release is searched. Make sure, there is a milestone -on . The following snippet will +on GitHub with the title of the new release is searched. It is important, that the due date of the milestone +is correctly set, as the returned milestones in the API call are sorted by due date. +Make sure, there is such a milestone on . The following snippet will create the numbers, that can be attached to the release notes as a last section: ```shell -LAST_VERSION=6.33.0 -NEW_VERSION=6.34.0 +LAST_VERSION=7.1.0 +NEW_VERSION=7.2.0 NEW_VERSION_COMMITISH=HEAD echo "### Stats" @@ -129,14 +130,14 @@ The new version needs to be entered into `_config.yml`, e.g.: ```yaml pmd: - latestVersion: 6.34.0 - latestVersionDate: 24-April-2021 + latestVersion: 7.2.0 + latestVersionDate: 31-May-2024 ``` Also move the previous version down into the "downloads" section. We usually keep only the last 3 versions in this list, so remove the oldest version. -Then create a new page for the new release, e.g. `_posts/2021-04-24-PMD-6.34.0.md` and copy +Then create a new page for the new release, e.g. `_posts/2024-05-31-PMD-7.2.0.md` and copy the release notes into this page. This will appear under the news section. Note: The release notes typically contain some Jekyll macros for linking to the rule pages. These macros won't @@ -164,7 +165,7 @@ Check in all (version, blog post) changes to branch master: The actual release is done by changing the versions, creating a tag and pushing this tag. Previously this was done by calling _maven-release-plugin_, but these steps are done without the plugin to have more control. And since we -might reference a not yet released pmd-designer version, the test-build will fail. +might reference a not yet released pmd-designer version, the test-build would fail. We first change the version of PMD and all modules by basically removing the "-SNAPSHOT" suffix, building the changed project locally with tests (and with skipping pmd-cli and pmd-dist) in order to be sure, everything is in working @@ -176,8 +177,8 @@ next snapshot version after the release. Skipping the builds of pmd-cli and pmd- the property `skip-cli-dist`. ```shell -RELEASE_VERSION=6.34.0 -DEVELOPMENT_VERSION=6.35.0-SNAPSHOT +RELEASE_VERSION=7.2.0 +DEVELOPMENT_VERSION=7.3.0-SNAPSHOT # Change version in the POMs to ${RELEASE_VERSION} and update build timestamp ./mvnw --quiet versions:set -DnewVersion="${RELEASE_VERSION}" -DgenerateBackupPoms=false -DupdateBuildOutputTimestampPolicy=always # Transform the SCM information in the POM @@ -218,18 +219,18 @@ Here is, what happens: * Render the documentation in `docs/` with `bundle exec jekyll build` and create a zip file from it. * Upload the doc zip file to the current (draft) GitHub Release under and to . -* Upload the documentation to , e.g. and +* Upload the documentation to , e.g. and create a symlink, so that points to the new version. -* Remove the old snapshot documentation, e.g. so that is gone. - Also create a symlink from pmd-doc-6.34.0-SNAPSHOT to pmd-doc-6.34.0, so that old references still work, e.g. - points to the released version. +* Remove the old snapshot documentation, e.g. so that is gone. + Also create a symlink from pmd-doc-7.2.0-SNAPSHOT to pmd-doc-7.2.0, so that old references still work, e.g. + points to the released version. * Deploy javadoc to "https://docs.pmd-code.org/apidocs/*/RELEASE_VERSION/", e.g. - . This is done for all modules. -* Remove old javadoc for the SNAPSHOT version, e.g. delete . + . This is done for all modules. +* Remove old javadoc for the SNAPSHOT version, e.g. delete . * Create a draft news post on for the new release. This contains the rendered release notes. * Copy the documentation to sourceforge's web space, so that it is available as - . All previously copied versions are listed + . All previously copied versions are listed under . The release on GitHub Actions currently takes about 30-45 minutes. Once this is done, you @@ -271,6 +272,7 @@ Tweet on , eg.: PMD 6.34.0 released: https://github.com/pmd/pmd/releases/tag/pmd_releases/6.34.0 #PMD +* Post the same twitter message into the gitter chat at ### Checklist @@ -289,6 +291,7 @@ Tweet on , eg.: | regression-tester | New release baseline is uploaded | | | | mailing list | announcement on mailing list is sent | | | | twitter | tweet about the new release | | | +| gitter | message about the new release | | | ## Prepare the next release @@ -302,9 +305,9 @@ There are a couple of manual steps needed to prepare the current main branch for ```yaml pmd: - version: 6.35.0-SNAPSHOT - previous_version: 6.34.0 - date: ??-??-2021 + version: 7.3.0-SNAPSHOT + previous_version: 7.2.0 + date: ??-??-2024 release_type: minor ``` @@ -329,13 +332,13 @@ This is a {{ site.pmd.release_type }} release. {% tocmaker %} -### New and noteworthy +### 🚀 New and noteworthy -### Fixed Issues +### 🐛 Fixed Issues -### API Changes +### 🚨 API Changes -### External Contributions +### ✨ External Contributions {% endtocmaker %} @@ -368,15 +371,11 @@ from there. Then merge into the `master` branch and release from there. This way automatically the latest release on and on sourceforge. -### (Optional) Create a new release branch +### (Optional) Create a new maintenance branch At some point, it might be time for a new maintenance branch. Such a branch is usually created from -the `master` branch. Here are the steps: +the tag. Here are the steps: -* Create a new branch: `git branch pmd/5.6.x master` -* Update the version in both the new branch and master, e.g. `mvn versions:set -DnewVersion=5.6.1-SNAPSHOT` - and `mvn versions:set -DnewVersion=5.7.0-SNAPSHOT`. -* Update the release notes on both the new branch and master - -The maintenance or bugfix branch could also be created later when needed from the actual tag. Then only the version on -the maintenance branch needs to be set. +* Create a new branch: `git branch pmd/7.1.x pmd_releases/7.1.0` +* Update the version in both the new branch, e.g. `mvn versions:set -DnewVersion=7.1.1-SNAPSHOT`. +* Update the release notes on both the new branch From c67998f64a10dc07cbc5714cf1e0c15943c4b94b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 15:43:24 +0200 Subject: [PATCH 084/142] [java] Update quickstart.xml --- pmd-java/src/main/resources/rulesets/java/quickstart.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pmd-java/src/main/resources/rulesets/java/quickstart.xml b/pmd-java/src/main/resources/rulesets/java/quickstart.xml index 5cb3a7f905..da02719225 100644 --- a/pmd-java/src/main/resources/rulesets/java/quickstart.xml +++ b/pmd-java/src/main/resources/rulesets/java/quickstart.xml @@ -45,6 +45,7 @@ + @@ -210,6 +211,7 @@ + From 11b8fa2f4548d28f342449f2bb20df0fe5b4570f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 26 Apr 2024 15:55:37 +0200 Subject: [PATCH 085/142] [ci] Improve Dangerfile - Fix FALSE -> false - Add ?pr=123 to the download link for the report --- Dangerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dangerfile b/Dangerfile index 0e35809f22..97e38cf3c3 100644 --- a/Dangerfile +++ b/Dangerfile @@ -44,7 +44,7 @@ def run_pmdtester @base_branch = 'master' @logger.info "\n\n--------------------------------------" @logger.info "Run against #{@base_branch}" - @summary = PmdTester::Runner.new(get_args(@base_branch, FALSE, 'target/diff1/patch_config.xml')).run + @summary = PmdTester::Runner.new(get_args(@base_branch, false, 'target/diff1/patch_config.xml')).run # move the generated report out of the way FileUtils.mv 'target/reports/diff', 'target/diff2' @@ -53,12 +53,12 @@ def run_pmdtester tar_report - message1 += "[Download full report as build artifact](#{ENV['PMD_CI_JOB_URL']})" + message1 += "[Download full report as build artifact](#{ENV['PMD_CI_JOB_URL']}?pr=#{ENV['PMD_CI_PULL_REQUEST_NUMBER']})" # set value of sticky to true and the message is kept after new commits are submitted to the PR message(message1, sticky: true) if message2 - message2 += "[Download full report as build artifact](#{ENV['PMD_CI_JOB_URL']})" + message2 += "[Download full report as build artifact](#{ENV['PMD_CI_JOB_URL']}?pr=#{ENV['PMD_CI_PULL_REQUEST_NUMBER']})" # set value of sticky to true and the message is kept after new commits are submitted to the PR message(message2, sticky: true) end From 905bb6518b9d5b457d4c71ed6ecae4440878752b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 26 Apr 2024 16:00:03 -0300 Subject: [PATCH 086/142] Add failing test for #4975 --- .../bestpractices/xml/UnusedPrivateMethod.xml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml index 3a91d558ef..cc6b1643cc 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml @@ -1901,6 +1901,40 @@ public class NotUsedPrivateMethodFalsePositive { return clientIdsToDps.getUnchecked(""); } } +]]>
+ + + + [java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test #4975 + 0 + strings) { + // insert code + } + + private static Stream getStrings() { + Stream tests = Stream.of( + Arguments.of(List.of("TEST", "TEST_1")), + Arguments.of(List.of("TEST_2", "TEST_3")) + ); + + return Stream.of(tests) + .reduce(Stream::concat) + .orElseGet(Stream::empty); + } + } +} ]]> From 8b3f54c91f2dfcfdf31d486d1df4354a0557c89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 26 Apr 2024 16:00:16 -0300 Subject: [PATCH 087/142] Fix for #4975 --- .../lang/java/rule/bestpractices/UnusedPrivateMethodRule.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateMethodRule.java index 53a8c42434..097190138d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateMethodRule.java @@ -54,6 +54,7 @@ public class UnusedPrivateMethodRule extends AbstractIgnoredAnnotationRule { // first set, ie, not every call in the file. Set methodsUsedByAnnotations = file.descendants(ASTMethodDeclaration.class) + .crossFindBoundaries() .children(ASTModifierList.class) .children(ASTAnnotation.class) .filter(t -> TypeTestUtil.isA("org.junit.jupiter.params.provider.MethodSource", t)) From fd1479679170b94c1f674f1495493c39b8f77100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 26 Apr 2024 16:01:12 -0300 Subject: [PATCH 088/142] Update changelog, refs #4975 --- docs/pages/release_notes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index e8d7cdbf90..2002c2736f 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,6 +16,9 @@ This is a {{ site.pmd.release_type }} release. ### 🐛 Fixed Issues +* java-bestpractices + * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test + ### 🚨 API Changes ### ✨ External Contributions From 2f88755b4827bdc39c64b5bf3a281f88ccce6e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 26 Apr 2024 16:24:27 -0300 Subject: [PATCH 089/142] Add failing test for #4278 --- .../bestpractices/xml/UnusedPrivateMethod.xml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml index cc6b1643cc..eb072c2dbc 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml @@ -1935,6 +1935,33 @@ class FooTest{ } } } +]]> + + + + [java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name #4278 + 0 + testGetUsername_noMethodSourceValue() { + return Stream.of( + Arguments.of("foo"), + Arguments.of("bar"), + Arguments.of("baz") + ); + } + + @MethodSource + @ParameterizedTest + void testGetUsername_noMethodSourceValue(String username) { + User sut = new User(username); + + Assertions.assertEquals(username, sut.getUsername()); + } +} ]]> From 002e8f12ff9767edf28e72b7743d9fcda60d202d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 26 Apr 2024 16:24:41 -0300 Subject: [PATCH 090/142] Fix #4278 --- .../java/rule/bestpractices/UnusedPrivateMethodRule.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateMethodRule.java index 097190138d..4d239378b9 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateMethodRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedPrivateMethodRule.java @@ -12,6 +12,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; import net.sourceforge.pmd.lang.ast.NodeStream; import net.sourceforge.pmd.lang.java.ast.ASTAnnotation; @@ -20,7 +21,6 @@ import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTMethodReference; import net.sourceforge.pmd.lang.java.ast.ASTModifierList; -import net.sourceforge.pmd.lang.java.ast.ASTStringLiteral; import net.sourceforge.pmd.lang.java.ast.JavaNode; import net.sourceforge.pmd.lang.java.ast.MethodUsage; import net.sourceforge.pmd.lang.java.ast.ModifierOwner.Visibility; @@ -58,9 +58,11 @@ public class UnusedPrivateMethodRule extends AbstractIgnoredAnnotationRule { .children(ASTModifierList.class) .children(ASTAnnotation.class) .filter(t -> TypeTestUtil.isA("org.junit.jupiter.params.provider.MethodSource", t)) - .descendants(ASTStringLiteral.class) .toStream() - .map(ASTStringLiteral::getConstValue) + // Get the referenced method names… if none, use the test method name instead + .flatMap(a -> a.getFlatValue("value").isEmpty() + ? Stream.of(a.ancestors(ASTMethodDeclaration.class).first().getName()) + : a.getFlatValue("value").toStream().map(mv -> (String) mv.getConstValue())) .collect(Collectors.toSet()); Map> consideredNames = From 1cfbaeb737a09f0fc03aa728821a4ec8a94d68ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 26 Apr 2024 16:25:21 -0300 Subject: [PATCH 091/142] Update changelog, refs #4278 --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2002c2736f..2a0c2c81f0 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -17,6 +17,7 @@ This is a {{ site.pmd.release_type }} release. ### 🐛 Fixed Issues * java-bestpractices + * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test ### 🚨 API Changes From e3a4be47fc300e362bd833620ac2d185b92b71b9 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 27 Apr 2024 20:12:30 +0200 Subject: [PATCH 092/142] Update do-release.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Juan Martín Sotuyo Dodero --- do-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/do-release.sh b/do-release.sh index 523f41b722..03807ce8b9 100755 --- a/do-release.sh +++ b/do-release.sh @@ -204,7 +204,7 @@ echo echo "Tag has been pushed.... now check github actions: " echo echo "Now wait, until first stage of the release is finished successfully..." -echo "You don't need to wait until artefacts are in maven central, just the github action must be successful." +echo "You don't need to wait until artifacts are in maven central, just the github action must be successful." echo echo "If it is failing, you can fix the code/scripts and force push the tag via" echo From eadf3d9293a5bf63ad2dc213b8e8e252045c874f Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 27 Apr 2024 20:52:20 +0200 Subject: [PATCH 093/142] Use saxon's NodeListIterator --- .../lang/rule/xpath/internal/BaseNodeInfo.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/BaseNodeInfo.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/BaseNodeInfo.java index aad0a8c8a1..2ad543c236 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/BaseNodeInfo.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/BaseNodeInfo.java @@ -5,6 +5,7 @@ package net.sourceforge.pmd.lang.rule.xpath.internal; +import java.util.Collections; import java.util.List; import java.util.ListIterator; @@ -16,6 +17,7 @@ import net.sf.saxon.pattern.NodeTest; import net.sf.saxon.str.StringView; import net.sf.saxon.str.UnicodeString; import net.sf.saxon.tree.iter.AxisIterator; +import net.sf.saxon.tree.iter.NodeListIterator; import net.sf.saxon.tree.util.Navigator.AxisFilter; import net.sf.saxon.tree.wrapper.AbstractNodeWrapper; import net.sf.saxon.tree.wrapper.SiblingCountingNode; @@ -105,23 +107,10 @@ abstract class BaseNodeInfo extends AbstractNodeWrapper implements SiblingCounti } static AxisIterator iterateList(List nodes, boolean forwards) { - return forwards ? new NodeListIterator<>(nodes) + return forwards ? new NodeListIterator(Collections.unmodifiableList(nodes)) : new RevListAxisIterator<>(nodes); } - private static class NodeListIterator implements AxisIterator { - private final ListIterator iter; - - NodeListIterator(List list) { - iter = list.listIterator(); - } - - @Override - public NodeInfo next() { - return this.iter.hasNext() ? this.iter.next() : null; - } - } - private static class RevListAxisIterator implements AxisIterator { private final ListIterator iter; From 289d5aed3bf298c28d09e8f5bd18d1dbbe723a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sat, 27 Apr 2024 19:40:28 -0300 Subject: [PATCH 094/142] Actually duplicate the whole current config for RuleSetLoader - Fixes #4978 --- .../java/net/sourceforge/pmd/lang/rule/RuleSetFactory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleSetFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleSetFactory.java index 16a3a49073..acfa28ad9d 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleSetFactory.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleSetFactory.java @@ -658,7 +658,9 @@ final class RuleSetFactory { return new RuleSetLoader().loadResourcesWith(resourceLoader) .filterAbovePriority(minimumPriority) .warnDeprecated(warnDeprecated) - .includeDeprecatedRuleReferences(includeDeprecatedRuleReferences); + .includeDeprecatedRuleReferences(includeDeprecatedRuleReferences) + .withReporter(reporter) + .withLanguages(languageRegistry); } private @NonNull XmlMessageHandler getXmlMessagePrinter() { From 882e9ccd2d535ed9eabd45b34ca00c35f6ffe500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sat, 27 Apr 2024 19:46:56 -0300 Subject: [PATCH 095/142] update changelog, refs #4978 --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2a0c2c81f0..9bbe4105cb 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,6 +16,8 @@ This is a {{ site.pmd.release_type }} release. ### 🐛 Fixed Issues +* core + * [#4978](https://github.com/pmd/pmd/issues/4978): \[core] Referenced Rulesets do not emit details on validation errors * java-bestpractices * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test From b510f77a7951550de434a26a2230badcd58efaa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sat, 27 Apr 2024 20:47:21 -0300 Subject: [PATCH 096/142] Add failing test for #4980 --- .../pmd/lang/java/types/TypeGenerationUtil.kt | 1 + .../internal/infer/PolyResolutionTest.kt | 28 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TypeGenerationUtil.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TypeGenerationUtil.kt index 69260414da..145be6f6b4 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TypeGenerationUtil.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TypeGenerationUtil.kt @@ -145,6 +145,7 @@ class RefTypeConstants(override val ts: TypeSystem) : TypeDslMixin { val `t_Enum{E}`: JClassType get() = java.lang.Enum::class.decl val t_Stream: JClassType get() = java.util.stream.Stream::class.raw + val `t_Stream{Number}`: JClassType get() = java.util.stream.Stream::class[t_Number] val t_Function: JClassType get() = java.util.function.Function::class.raw val t_Map: JClassType get() = java.util.Map::class.raw val t_MapEntry: JClassType get() = java.util.Map.Entry::class.raw diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt index 6405b99afb..99618ae017 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt @@ -5,10 +5,10 @@ package net.sourceforge.pmd.lang.java.types.internal.infer -import net.sourceforge.pmd.lang.test.ast.shouldBe -import net.sourceforge.pmd.lang.test.ast.shouldMatchN import net.sourceforge.pmd.lang.java.ast.* import net.sourceforge.pmd.lang.java.types.* +import net.sourceforge.pmd.lang.test.ast.shouldBe +import net.sourceforge.pmd.lang.test.ast.shouldMatchN import java.io.BufferedOutputStream import java.io.DataOutputStream import java.io.OutputStream @@ -21,7 +21,6 @@ import java.io.OutputStream */ class PolyResolutionTest : ProcessorTestSpec({ - parserTest("Test context passing overcomes null lower bound") { val (acu, spy) = parser.parseWithTypeInferenceSpy(""" @@ -373,4 +372,27 @@ class Scratch { lambda3 shouldHaveType Runnable::class.decl } } + + parserTest("Test inference with varargs - bug #4980") { + + val (acu, spy) = parser.parseWithTypeInferenceSpy(""" + import java.util.stream.Stream; + + class Foo { + public T foo() { + return null; + } + + public Stream bar() { + return Stream.of(foo()); + } + } + """) + + val call = acu.firstMethodCall() + + spy.shouldBeOk { + call shouldHaveType gen.`t_Stream{Number}` + } + } }) From 0a7a52f228a5c8ec95ac3fa4f394d1a518db8a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sat, 27 Apr 2024 20:50:13 -0300 Subject: [PATCH 097/142] Fix issue #4980 - When an applicability test fails (ie: during LUB) we don't want that to bubble up and fail the process, simply to discard the candidate and move forward. If no matching candidate is found, the inference will fail anyway. --- .../pmd/lang/java/types/internal/infer/Infer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java index 595bf77921..0330717e04 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java @@ -577,7 +577,12 @@ public final class Infer { // we only test it can reduce, we don't commit inferred types at this stage InferenceContext ctxCopy = infCtx.copy(); LOG.applicabilityTest(ctxCopy, m); - ctxCopy.solve(/*onlyBoundedVars:*/isPreJava8()); + try { + ctxCopy.solve(/*onlyBoundedVars:*/isPreJava8()); + } catch (ResolutionFailedException | IllegalArgumentException ignored) { + // applicability test failed for this candidate, but continue with others + return null; + } // if unchecked conversion was needed, update the site for invocation pass if (ctxCopy.needsUncheckedConversion()) { From 6ab54e1afb44436c7f21f4333544729f5bf9084a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sat, 27 Apr 2024 20:56:27 -0300 Subject: [PATCH 098/142] Make the code actually valid --- .../pmd/lang/java/types/internal/infer/PolyResolutionTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt index 99618ae017..17d131376a 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt @@ -48,7 +48,7 @@ class PolyResolutionTest : ProcessorTestSpec({ static T id(T t) { return t; } - { + void foo(int x) { id(x > 0 ? Double.POSITIVE_INFINITY : x < 0 ? Double.NEGATIVE_INFINITY : Double.NaN); From d2e0826ed81e4b9eb905d9055ad900564ffb92bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sat, 27 Apr 2024 21:19:57 -0300 Subject: [PATCH 099/142] Improve implementation - throw an apropriate ResolutionFailedException so we don't loose the message - handle any exception so we don't couple tightly into the LUB implementation --- .../pmd/lang/java/types/internal/infer/Infer.java | 4 ++-- .../internal/infer/ResolutionFailedException.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java index 0330717e04..763342539d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java @@ -579,9 +579,9 @@ public final class Infer { LOG.applicabilityTest(ctxCopy, m); try { ctxCopy.solve(/*onlyBoundedVars:*/isPreJava8()); - } catch (ResolutionFailedException | IllegalArgumentException ignored) { + } catch (Throwable e) { // applicability test failed for this candidate, but continue with others - return null; + throw ResolutionFailedException.fromThrowable(LOG, e); } // if unchecked conversion was needed, update the site for invocation pass diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java index b955129c56..0e98d18c74 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java @@ -55,6 +55,17 @@ final class ResolutionFailedException extends RuntimeException { // If the logger is noop we don't even create the failure. // These failures are extremely frequent (and normal), and type pretty-printing is expensive + static ResolutionFailedException fromThrowable(TypeInferenceLogger logger, Throwable t) { + if (t instanceof ResolutionFailedException) { + return (ResolutionFailedException) t; + } + + return getShared(logger.isNoop() ? UNKNOWN : new ResolutionFailure( + null, + t.getMessage() + )); + } + static ResolutionFailedException incompatibleBound(TypeInferenceLogger logger, InferenceVar ivar, BoundKind k1, JTypeMirror b1, BoundKind k2, JTypeMirror b2) { // in javac it's "no instance of type variables exist ..." return getShared(logger.isNoop() ? UNKNOWN : new ResolutionFailure( From a77519399e8286336da439c0bc5efe54e64a4085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sat, 27 Apr 2024 21:23:01 -0300 Subject: [PATCH 100/142] Update changelog, refs #4980 --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2a0c2c81f0..b6d3b0edc1 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,6 +16,8 @@ This is a {{ site.pmd.release_type }} release. ### 🐛 Fixed Issues +* java + * [#4980](https://github.com/pmd/pmd/issues/4980): \[java] Bad intersection, unrelated class types java.lang.Object\[] and java.lang.Number * java-bestpractices * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test From 42cf1b568d18789571e7c40f0f0fd2511d2bca03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 00:17:44 -0300 Subject: [PATCH 101/142] Don't use Throwable --- .../pmd/lang/java/types/internal/infer/Infer.java | 4 ++-- .../types/internal/infer/ResolutionFailedException.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java index 763342539d..6de215c6d2 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java @@ -579,9 +579,9 @@ public final class Infer { LOG.applicabilityTest(ctxCopy, m); try { ctxCopy.solve(/*onlyBoundedVars:*/isPreJava8()); - } catch (Throwable e) { + } catch (Exception e) { // applicability test failed for this candidate, but continue with others - throw ResolutionFailedException.fromThrowable(LOG, e); + throw ResolutionFailedException.fromException(LOG, e); } // if unchecked conversion was needed, update the site for invocation pass diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java index 0e98d18c74..4ea2c0aa97 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java @@ -55,14 +55,14 @@ final class ResolutionFailedException extends RuntimeException { // If the logger is noop we don't even create the failure. // These failures are extremely frequent (and normal), and type pretty-printing is expensive - static ResolutionFailedException fromThrowable(TypeInferenceLogger logger, Throwable t) { - if (t instanceof ResolutionFailedException) { - return (ResolutionFailedException) t; + static ResolutionFailedException fromException(TypeInferenceLogger logger, Exception e) { + if (e instanceof ResolutionFailedException) { + return (ResolutionFailedException) e; } return getShared(logger.isNoop() ? UNKNOWN : new ResolutionFailure( null, - t.getMessage() + e.getMessage() )); } From 7c3de05fd18d610321ef81ccc90476e5ce4e1d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 02:31:26 -0300 Subject: [PATCH 102/142] Add test case for #1548 --- .../xml/PrimitiveWrapperInstantiation.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/PrimitiveWrapperInstantiation.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/PrimitiveWrapperInstantiation.xml index cc56bcfbb2..29691b14b0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/PrimitiveWrapperInstantiation.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/PrimitiveWrapperInstantiation.xml @@ -414,6 +414,18 @@ public class SomeClass { this.bar = new Boolean("some arbitrary string is just false"); //violation this.bar = Boolean.valueOf(s); //use this instead of Boolean#new } +} + ]]> + + + + [java] Instantiation rules cannot tell apart java.lang primitive wrappers and shadowed classes #1548 + 0 + From 28c5cd71146e68518e9f48fb91462659d1b6ae7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 12:18:36 -0300 Subject: [PATCH 103/142] Remove `@Names` attribute from ASTReferenceExpression --- .../lang/apex/ast/ASTReferenceExpression.java | 3 +++ .../pmd/lang/apex/ast/InnerClassLocations.txt | 8 +++--- .../lang/apex/ast/SafeNavigationOperator.txt | 26 +++++++++---------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java index dbf9e887ec..22378be985 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTReferenceExpression.java @@ -7,6 +7,8 @@ package net.sourceforge.pmd.lang.apex.ast; import java.util.List; import java.util.stream.Collectors; +import net.sourceforge.pmd.lang.rule.xpath.NoAttribute; + import com.google.summit.ast.Identifier; public final class ASTReferenceExpression extends AbstractApexNode.Many { @@ -38,6 +40,7 @@ public final class ASTReferenceExpression extends AbstractApexNode.Many getNames() { return nodes.stream().map(Identifier::getString).collect(Collectors.toList()); } diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt index 095e8b8803..4f71b48450 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt @@ -8,11 +8,11 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @Names = ("System", "out"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @Names = ("System", "out"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] +- UserClass[@DefiningType = "InnerClassLocations.bar2", @Image = "bar2", @InterfaceNames = (), @RealLoc = true, @SimpleName = "bar2", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar2", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] @@ -21,9 +21,9 @@ +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar2", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar2", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @Names = ("System", "out"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar2", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @Names = ("System", "out"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt index 226b07f37a..d044128082 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt @@ -9,7 +9,7 @@ | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- FieldDeclaration[@DefiningType = "Foo", @Image = "x", @Name = "x", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "anIntegerField", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "anObject", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "x", @RealLoc = true] @@ -18,9 +18,9 @@ | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- FieldDeclaration[@DefiningType = "Foo", @Image = "profileUrl", @Name = "profileUrl", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "toExternalForm", @InputParametersSize = 0, @MethodName = "toExternalForm", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "user.getProfileUrl", @InputParametersSize = 0, @MethodName = "getProfileUrl", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "user", @Names = ("user"), @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "user", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "profileUrl", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- Method[@Arity = 1, @CanonicalName = "bar1", @Constructor = false, @DefiningType = "Foo", @Image = "bar1", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] @@ -30,15 +30,15 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "Foo", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "b", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "c1", @InputParametersSize = 0, @MethodName = "c1", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | +- CastExpression[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "b1", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "a1", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- Method[@Arity = 2, @CanonicalName = "bar2", @Constructor = false, @DefiningType = "Foo", @Image = "bar2", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] @@ -50,9 +50,9 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "Foo", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "aField", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] | | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = 0, @MethodName = "aMethod", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = true] | | +- ArrayLoadExpression[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] @@ -60,9 +60,9 @@ | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "aField", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = 0, @MethodName = "aMethod", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] + | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- ArrayLoadExpression[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] @@ -77,14 +77,14 @@ | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- VariableDeclaration[@DefiningType = "Foo", @Image = "s", @RealLoc = true, @Type = "String"] | +- VariableExpression[@DefiningType = "Foo", @Image = "BillingCity", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "Account", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "contact", @Names = ("contact"), @RealLoc = true, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] + | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "contact", @RealLoc = true, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] | +- VariableExpression[@DefiningType = "Foo", @Image = "s", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- ReturnStatement[@DefiningType = "Foo", @RealLoc = true] +- VariableExpression[@DefiningType = "Foo", @Image = "Name", @RealLoc = true] - +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @Names = (), @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] + +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] +- SoqlExpression[@CanonicalQuery = "SELECT Name FROM Account WHERE Id = :tmpVar1", @DefiningType = "Foo", @Query = "SELECT Name FROM Account WHERE Id = :accId", @RealLoc = true] +- BindExpressions[@DefiningType = "Foo", @RealLoc = true] +- VariableExpression[@DefiningType = "Foo", @Image = "accId", @RealLoc = true] From 56f12d41ea2fc86181fa031db7cc400d36efe3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 12:19:32 -0300 Subject: [PATCH 104/142] Update docs/pages/release_notes.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Fournier --- docs/pages/release_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index ab2d0ab991..3d9784465e 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -21,7 +21,7 @@ Up to now, all AST node getters would be exposed to XPath, as long as the return Since this release, PMD will also expose any getter returning a collection of any supported type as a sequence through an XPath attribute. They would require to use apropriate XQuery functions to manipulate the sequence. So for instance, to detect any given `ASTUserClass` that implements `Queueable`, it is now possible to write: ```xml -/UserClass[not(empty(index-of(@InterfaceNames, 'Queueable')))] +/UserClass[@InterfaceNames = 'Queueable'] ``` ### ✨ New rules From 11e6cc53c54867329d2a03db66201f14bdfe9984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 12:23:56 -0300 Subject: [PATCH 105/142] Update docs on writing xpath rules --- .../userdocs/extending/writing_xpath_rules.md | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/pages/pmd/userdocs/extending/writing_xpath_rules.md b/docs/pages/pmd/userdocs/extending/writing_xpath_rules.md index 6518dcdcbc..d2d0d1505b 100644 --- a/docs/pages/pmd/userdocs/extending/writing_xpath_rules.md +++ b/docs/pages/pmd/userdocs/extending/writing_xpath_rules.md @@ -49,23 +49,21 @@ To represent attributes, we must map Java values to [XPath Data Model (XDM)](htt values. In the following table we refer to the type conversion function as `conv`, a function from Java types to XDM types. -| Java type `T` | XSD type `conv(T)` | -|---------------|---------------------------------------| -| `int` | `xs:integer` | -| `long` | `xs:integer` | -| `double` | `xs:decimal` | -| `float` | `xs:decimal` | -| `boolean` | `xs:boolean` | -| `String` | `xs:string` | -| `Character` | `xs:string` | -| `Enum` | `xs:string` (uses `Object::toString`) | -| `List` | `conv(E)*` (a sequence type) | +| Java type `T` | XSD type `conv(T)` | +|-------------------|---------------------------------------| +| `int` | `xs:integer` | +| `long` | `xs:integer` | +| `double` | `xs:decimal` | +| `float` | `xs:decimal` | +| `boolean` | `xs:boolean` | +| `String` | `xs:string` | +| `Character` | `xs:string` | +| `Enum` | `xs:string` (uses `Object::toString`) | +| `Collection` | `conv(E)*` (a sequence type) | The same `conv` function is used to translate rule property values to XDM values. -{% include warning.html content="Lists are only supported for rule properties, not attributes." %} - - +Additionaly, PMD's own `net.sourceforge.pmd.lang.document.Chars` is also translated to a `xs:string` ## Rule properties From 124f908ca8dbfc5755943107fe6657a2d0aaed33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 12:36:57 -0300 Subject: [PATCH 106/142] Properly log when the impossible happens --- .../pmd/lang/rule/xpath/impl/AttributeAxisIterator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java index 4337f25a13..01c1642aa7 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java @@ -132,8 +132,8 @@ public class AttributeAxisIterator implements Iterator { try { Class elementKlass = Class.forName(((ParameterizedType) t).getActualTypeArguments()[0].getTypeName()); return CONSIDERED_RETURN_TYPES.contains(elementKlass) || elementKlass.isEnum(); - } catch (ClassNotFoundException ignored) { - // should never happen + } catch (ClassNotFoundException e) { + throw AssertionUtil.shouldNotReachHere("Method '" + method + "' should return a known type, but: " + e, e); } } } From fbb4648efc5340d22a2d080b13694b446ecb9942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 12:37:42 -0300 Subject: [PATCH 107/142] Update pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Fournier --- .../pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java index d854f4e9d6..083a2ec9d3 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java @@ -264,6 +264,7 @@ public class SaxonXPathRuleQuery { StaticContextWithProperties(Configuration config) { super(config); + // This statement is necessary for Saxon to support sequence-valued attributes getPackageData().setSchemaAware(true); } From 458405e02d575786cd66fa6c939158c37d48bb09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 12:43:30 -0300 Subject: [PATCH 108/142] Use spaces --- .../pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java index 083a2ec9d3..4ebf18c108 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQuery.java @@ -264,7 +264,7 @@ public class SaxonXPathRuleQuery { StaticContextWithProperties(Configuration config) { super(config); - // This statement is necessary for Saxon to support sequence-valued attributes + // This statement is necessary for Saxon to support sequence-valued attributes getPackageData().setSchemaAware(true); } From 4bb533b6254df09c640b8b66e8a34a4b1fbc4655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Sun, 28 Apr 2024 13:13:29 -0300 Subject: [PATCH 109/142] Ignore type variables --- .../pmd/lang/rule/xpath/impl/AttributeAxisIterator.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java index 01c1642aa7..001e32572c 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java @@ -15,6 +15,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; @@ -130,8 +131,12 @@ public class AttributeAxisIterator implements Iterator { Type t = method.getGenericReturnType(); if (t instanceof ParameterizedType) { try { - Class elementKlass = Class.forName(((ParameterizedType) t).getActualTypeArguments()[0].getTypeName()); - return CONSIDERED_RETURN_TYPES.contains(elementKlass) || elementKlass.isEnum(); + // ignore type variables, such as List… we could check all bounds, but probably it's overkill + Type actualTypeArgument = ((ParameterizedType) t).getActualTypeArguments()[0]; + if (!TypeVariable.class.isAssignableFrom(actualTypeArgument.getClass())) { + Class elementKlass = Class.forName(actualTypeArgument.getTypeName()); + return CONSIDERED_RETURN_TYPES.contains(elementKlass) || elementKlass.isEnum(); + } } catch (ClassNotFoundException e) { throw AssertionUtil.shouldNotReachHere("Method '" + method + "' should return a known type, but: " + e, e); } From 9a25d90c76ae64a0d4c6fd35ca4c90af37fed878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 28 Apr 2024 18:23:57 +0200 Subject: [PATCH 110/142] Put back old implementation in place --- .../ast/SyntacticJavaTokenizerFactory.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java index 17284185c3..5adc519b73 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java @@ -4,9 +4,16 @@ package net.sourceforge.pmd.lang.java.ast; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.sourceforge.pmd.lang.LanguageVersion; import net.sourceforge.pmd.lang.TokenManager; import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream; import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; +import net.sourceforge.pmd.lang.java.JavaLanguageModule; +import net.sourceforge.pmd.lang.java.internal.JavaLanguageProperties; /** * Creates a tokenizer, that uses the syntactic grammar to provide context @@ -22,6 +29,32 @@ public final class SyntacticJavaTokenizerFactory { @Deprecated public static TokenManager createTokenizer(CharStream cs) { - return JavaTokenKinds.newTokenManager(cs); + final List tokenList = new ArrayList<>(); + JavaParserImplTokenManager tokenManager = new JavaParserImplTokenManager(null, cs) { + @Override + public JavaccToken getNextToken() { + JavaccToken token = super.getNextToken(); + tokenList.add(token); + return token; + } + }; + + LanguageVersion latestVersion = JavaLanguageModule.getInstance().getLatestVersion(); + JavaParserImpl parser = new JavaParserImpl(tokenManager); + tokenManager.parser = parser; + parser.setJdkVersion(JavaLanguageProperties.getInternalJdkVersion(latestVersion)); + parser.setPreview(JavaLanguageProperties.isPreviewEnabled(latestVersion)); + + ASTCompilationUnit compilationUnit = parser.CompilationUnit(); + assert compilationUnit != null; + + return new TokenManager() { + Iterator iterator = tokenList.iterator(); + + @Override + public JavaccToken getNextToken() { + return iterator.next(); + } + }; } } From b70521874a0e8003989b5c449505fd8d617155c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 28 Apr 2024 20:10:22 +0200 Subject: [PATCH 111/142] Fix failing tests --- javacc-wrapper.xml | 4 +++- pmd-java/etc/grammar/Java.jjt | 1 - .../pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/javacc-wrapper.xml b/javacc-wrapper.xml index 86419ab750..2c43e086d8 100644 --- a/javacc-wrapper.xml +++ b/javacc-wrapper.xml @@ -113,7 +113,7 @@ - + @@ -471,8 +471,10 @@ public final class ${token-constants-name} \{${line.separator} Option TOKEN_MANAGER_USES_PARSER is enabled + + diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index d7f641bffd..ee7145ed4c 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -300,7 +300,6 @@ options { MULTI = true; VISITOR = true; NODE_PACKAGE="net.sourceforge.pmd.lang.java.ast"; - TOKEN_MANAGER_USES_PARSER = true; // disable the calculation of expected tokens when a parse error occurs // depending on the possible allowed next tokens, this diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java index 5adc519b73..25997a128c 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SyntacticJavaTokenizerFactory.java @@ -30,7 +30,7 @@ public final class SyntacticJavaTokenizerFactory { @Deprecated public static TokenManager createTokenizer(CharStream cs) { final List tokenList = new ArrayList<>(); - JavaParserImplTokenManager tokenManager = new JavaParserImplTokenManager(null, cs) { + JavaParserImplTokenManager tokenManager = new JavaParserImplTokenManager(cs) { @Override public JavaccToken getNextToken() { JavaccToken token = super.getNextToken(); @@ -41,7 +41,6 @@ public final class SyntacticJavaTokenizerFactory { LanguageVersion latestVersion = JavaLanguageModule.getInstance().getLatestVersion(); JavaParserImpl parser = new JavaParserImpl(tokenManager); - tokenManager.parser = parser; parser.setJdkVersion(JavaLanguageProperties.getInternalJdkVersion(latestVersion)); parser.setPreview(JavaLanguageProperties.isPreviewEnabled(latestVersion)); From e81449db4a5a8710036fb73d4bfc350a4a988baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 26 Apr 2024 13:28:01 +0200 Subject: [PATCH 112/142] fixes --- .../src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java | 3 ++- .../net/sourceforge/pmd/lang/document/BaseMappedDocument.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java index d9b8f452b3..34497c47f4 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java @@ -24,6 +24,7 @@ import net.sourceforge.pmd.lang.Language; import net.sourceforge.pmd.lang.LanguagePropertyBundle; import net.sourceforge.pmd.lang.ast.FileAnalysisException; import net.sourceforge.pmd.lang.ast.LexException; +import net.sourceforge.pmd.lang.ast.impl.javacc.MalformedSourceException; import net.sourceforge.pmd.lang.document.FileCollector; import net.sourceforge.pmd.lang.document.FileId; import net.sourceforge.pmd.lang.document.InternalApiBridge; @@ -171,7 +172,7 @@ public final class CpdAnalysis implements AutoCloseable { int newTokens = doTokenize(textDocument, tokenizers.get(textFile.getLanguageVersion().getLanguage()), tokens); numberOfTokensPerFile.put(textDocument.getFileId(), newTokens); listener.addedFile(1); - } catch (LexException | IOException e) { + } catch (LexException | IOException | MalformedSourceException e) { if (e instanceof FileAnalysisException) { // NOPMD ((FileAnalysisException) e).setFileId(textFile.getFileId()); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/BaseMappedDocument.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/BaseMappedDocument.java index 55daae33ce..be92385faa 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/BaseMappedDocument.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/BaseMappedDocument.java @@ -68,6 +68,9 @@ abstract class BaseMappedDocument implements TextDocument { * @return Input region */ protected @NonNull TextRegion inputRegion(TextRegion outputRegion) { + if (outputRegion.isEmpty()) { + return TextRegion.caretAt(inputOffset(outputRegion.getStartOffset(), false)); + } return TextRegion.fromBothOffsets(inputOffset(outputRegion.getStartOffset(), true), inputOffset(outputRegion.getEndOffset(), false)); } From fb17f7ff9aaf9aee3a1b7620e9dfe0ee02a126f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 28 Apr 2024 20:49:33 +0200 Subject: [PATCH 113/142] Add test --- .../net/sourceforge/pmd/cpd/CpdAnalysis.java | 3 +- .../pmd/lang/ast/FileAnalysisException.java | 2 + .../sourceforge/pmd/cpd/CpdAnalysisTest.java | 39 +++++++++++++++++++ .../pmd/lang/DummyLanguageModule.java | 32 +++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java index 34497c47f4..ccc2b6c686 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CpdAnalysis.java @@ -24,7 +24,6 @@ import net.sourceforge.pmd.lang.Language; import net.sourceforge.pmd.lang.LanguagePropertyBundle; import net.sourceforge.pmd.lang.ast.FileAnalysisException; import net.sourceforge.pmd.lang.ast.LexException; -import net.sourceforge.pmd.lang.ast.impl.javacc.MalformedSourceException; import net.sourceforge.pmd.lang.document.FileCollector; import net.sourceforge.pmd.lang.document.FileId; import net.sourceforge.pmd.lang.document.InternalApiBridge; @@ -172,7 +171,7 @@ public final class CpdAnalysis implements AutoCloseable { int newTokens = doTokenize(textDocument, tokenizers.get(textFile.getLanguageVersion().getLanguage()), tokens); numberOfTokensPerFile.put(textDocument.getFileId(), newTokens); listener.addedFile(1); - } catch (LexException | IOException | MalformedSourceException e) { + } catch (IOException | FileAnalysisException e) { if (e instanceof FileAnalysisException) { // NOPMD ((FileAnalysisException) e).setFileId(textFile.getFileId()); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/FileAnalysisException.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/FileAnalysisException.java index d843d80f68..1dacfd1fdf 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/FileAnalysisException.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/FileAnalysisException.java @@ -10,12 +10,14 @@ import org.apache.commons.lang3.StringUtils; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import net.sourceforge.pmd.lang.ast.impl.javacc.MalformedSourceException; import net.sourceforge.pmd.lang.document.FileId; import net.sourceforge.pmd.lang.document.FileLocation; /** * An exception that occurs while processing a file. Subtypes include *
    + *
  • {@link MalformedSourceException}: error in source format, eg invalid character escapes (in case that happens before lexing) *
  • {@link LexException}: lexical syntax errors *
  • {@link ParseException}: syntax errors *
  • {@link SemanticException}: exceptions occurring after the parsing diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/cpd/CpdAnalysisTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/cpd/CpdAnalysisTest.java index a60a74cfd2..ac67330094 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/cpd/CpdAnalysisTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/cpd/CpdAnalysisTest.java @@ -8,6 +8,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; import java.io.File; import java.io.IOException; @@ -23,10 +28,14 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.io.TempDir; +import org.mockito.Mockito; import net.sourceforge.pmd.lang.DummyLanguageModule; +import net.sourceforge.pmd.lang.ast.LexException; +import net.sourceforge.pmd.lang.ast.impl.javacc.MalformedSourceException; import net.sourceforge.pmd.lang.document.FileId; import net.sourceforge.pmd.lang.document.TextFile; +import net.sourceforge.pmd.util.log.PmdReporter; /** * Unit test for {@link CpdAnalysis} @@ -187,6 +196,36 @@ class CpdAnalysisTest { } } + @Test + void testSkipLexicalErrors() throws IOException { + + + PmdReporter reporter = mock(PmdReporter.class); + config.setReporter(reporter); + + config.setSkipLexicalErrors(false); + try (CpdAnalysis cpd = CpdAnalysis.create(config)) { + assertTrue(cpd.files().addSourceFile(FileId.fromPathLikeString("foo.dummy"), DummyLanguageModule.CPD_THROW_LEX_EXCEPTION)); + assertTrue(cpd.files().addSourceFile(FileId.fromPathLikeString("foo2.dummy"), DummyLanguageModule.CPD_THROW_MALFORMED_SOURCE_EXCEPTION)); + cpd.performAnalysis(); + } + verify(reporter).errorEx(eq("Error while tokenizing"), any(LexException.class)); + verify(reporter).errorEx(eq("Error while tokenizing"), any(MalformedSourceException.class)); + verify(reporter).errorEx(eq("Exception while running CPD"), any(IllegalStateException.class)); + verifyNoMoreInteractions(reporter); + + Mockito.reset(reporter); + config.setSkipLexicalErrors(true); + try (CpdAnalysis cpd = CpdAnalysis.create(config)) { + assertTrue(cpd.files().addSourceFile(FileId.fromPathLikeString("foo.dummy"), DummyLanguageModule.CPD_THROW_LEX_EXCEPTION)); + assertTrue(cpd.files().addSourceFile(FileId.fromPathLikeString("foo2.dummy"), DummyLanguageModule.CPD_THROW_MALFORMED_SOURCE_EXCEPTION)); + cpd.performAnalysis(); + } + verify(reporter).errorEx(eq("Skipping file"), any(LexException.class)); + verify(reporter).errorEx(eq("Skipping file"), any(MalformedSourceException.class)); + verifyNoMoreInteractions(reporter); + } + @Test void duplicatedFilesShouldBeSkipped() throws IOException { String filename = "file1.dummy"; diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/DummyLanguageModule.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/DummyLanguageModule.java index b252aaa145..84a5570ac8 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/DummyLanguageModule.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/DummyLanguageModule.java @@ -6,15 +6,20 @@ package net.sourceforge.pmd.lang; import java.util.Objects; +import net.sourceforge.pmd.cpd.AnyCpdLexer; import net.sourceforge.pmd.cpd.CpdCapableLanguage; import net.sourceforge.pmd.cpd.CpdLanguageProperties; +import net.sourceforge.pmd.cpd.CpdLexer; import net.sourceforge.pmd.lang.ast.DummyNode; import net.sourceforge.pmd.lang.ast.DummyNode.DummyRootNode; import net.sourceforge.pmd.lang.ast.ParseException; import net.sourceforge.pmd.lang.ast.Parser; import net.sourceforge.pmd.lang.ast.Parser.ParserTask; +import net.sourceforge.pmd.lang.ast.impl.javacc.MalformedSourceException; import net.sourceforge.pmd.lang.document.Chars; +import net.sourceforge.pmd.lang.document.FileLocation; import net.sourceforge.pmd.lang.document.TextDocument; +import net.sourceforge.pmd.lang.document.TextPos2d; import net.sourceforge.pmd.lang.document.TextRegion; import net.sourceforge.pmd.lang.impl.SimpleLanguageModuleBase; import net.sourceforge.pmd.reporting.RuleViolation; @@ -29,6 +34,10 @@ public class DummyLanguageModule extends SimpleLanguageModuleBase implements Cpd public static final String TERSE_NAME = "dummy"; private static final String PARSER_THROWS = "parserThrows"; + public static final String CPD_THROW_MALFORMED_SOURCE_EXCEPTION = ":throw_malformed_source_exception:"; + public static final String CPD_THROW_LEX_EXCEPTION = ":throw_lex_source_exception:"; + public static final String CPD_THROW_OTHER_EXCEPTION = ":throw_other_exception:"; + public DummyLanguageModule() { super(LanguageMetadata.withId(TERSE_NAME).name(NAME).extensions("dummy", "txt") .addVersion("1.0") @@ -55,6 +64,29 @@ public class DummyLanguageModule extends SimpleLanguageModuleBase implements Cpd return bundle; } + @Override + public CpdLexer createCpdLexer(LanguagePropertyBundle bundle) { + CpdLexer base = new AnyCpdLexer(); + return (doc, tokens) -> { + Chars text = doc.getText(); + int offset = text.indexOf(CPD_THROW_LEX_EXCEPTION, 0); + if (offset != -1) { + TextPos2d lc = doc.lineColumnAtOffset(offset); + throw tokens.makeLexException(lc.getLine(), lc.getColumn(), "test exception", null); + } + offset = text.indexOf(CPD_THROW_MALFORMED_SOURCE_EXCEPTION, 0); + if (offset != -1) { + FileLocation lc = doc.toLocation(TextRegion.caretAt(offset)); + throw new MalformedSourceException("test exception", null, lc); + } + offset = text.indexOf(CPD_THROW_OTHER_EXCEPTION, 0); + if (offset != -1) { + throw new IllegalArgumentException("test exception"); + } + base.tokenize(doc, tokens); + }; + } + public LanguageVersion getVersionWhereParserThrows() { return getVersion(PARSER_THROWS); } From 4c96e678af746fe7fa9eafcf53c4ce52e17816e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 29 Apr 2024 12:05:57 +0200 Subject: [PATCH 114/142] Add test for document fix --- .../pmd/lang/document/BaseMappedDocument.java | 2 +- .../document/FragmentedTextDocumentTest.java | 77 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 pmd-core/src/test/java/net/sourceforge/pmd/lang/document/FragmentedTextDocumentTest.java diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/BaseMappedDocument.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/BaseMappedDocument.java index be92385faa..bf61448b91 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/BaseMappedDocument.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/document/BaseMappedDocument.java @@ -69,7 +69,7 @@ abstract class BaseMappedDocument implements TextDocument { */ protected @NonNull TextRegion inputRegion(TextRegion outputRegion) { if (outputRegion.isEmpty()) { - return TextRegion.caretAt(inputOffset(outputRegion.getStartOffset(), false)); + return TextRegion.caretAt(inputOffset(outputRegion.getStartOffset(), true)); } return TextRegion.fromBothOffsets(inputOffset(outputRegion.getStartOffset(), true), inputOffset(outputRegion.getEndOffset(), false)); diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/document/FragmentedTextDocumentTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/document/FragmentedTextDocumentTest.java new file mode 100644 index 0000000000..8e97eaa647 --- /dev/null +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/document/FragmentedTextDocumentTest.java @@ -0,0 +1,77 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.document; + +import static net.sourceforge.pmd.lang.document.TextPos2d.pos2d; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.IOException; + +import org.junit.jupiter.api.Test; + +import net.sourceforge.pmd.lang.DummyLanguageModule; +import net.sourceforge.pmd.lang.LanguageVersion; + +class FragmentedTextDocumentTest { + + LanguageVersion dummyVersion = DummyLanguageModule.getInstance().getDefaultVersion(); + + @Test + void testSimple() throws IOException { + + try (TextDocument base = TextDocument.readOnlyString("abc", dummyVersion)) { + FragmentedDocBuilder builder = new FragmentedDocBuilder(base); + builder.recordDelta(1, 2, Chars.wrap("abx")); + try (TextDocument doc = builder.build()) { + assertEquals("aabxc", doc.getText().toString()); + + assertEquals(pos2d(1, 1), doc.lineColumnAtOffset(0)); + assertEquals(pos2d(1, 2), doc.lineColumnAtOffset(1, true)); + assertEquals(pos2d(1, 3), doc.lineColumnAtOffset(2, true)); + assertEquals(pos2d(1, 3), doc.lineColumnAtOffset(2, false)); + assertEquals(pos2d(1, 4), doc.lineColumnAtOffset(3, true)); + assertEquals(pos2d(1, 4), doc.lineColumnAtOffset(3, false)); + assertEquals(pos2d(1, 4), doc.lineColumnAtOffset(5)); + } + + } + + + } + + @Test + void testToLocationWithCaret() throws IOException { + + try (TextDocument base = TextDocument.readOnlyString("abc", dummyVersion)) { + FragmentedDocBuilder builder = new FragmentedDocBuilder(base); + builder.recordDelta(1, 2, Chars.wrap("abx")); + try (TextDocument doc = builder.build()) { + assertEquals("aabxc", doc.getText().toString()); + + TextRegion region = TextRegion.caretAt(4); + assertEquals(pos2d(1, 3), doc.toLocation(region).getStartPos()); + } + + } + } + + @Test + void testToLocationWithCaretBetweenEscapes() throws IOException { + + try (TextDocument base = TextDocument.readOnlyString("aBBCCd", dummyVersion)) { + FragmentedDocBuilder builder = new FragmentedDocBuilder(base); + builder.recordDelta(1, 3, Chars.wrap("X")); + builder.recordDelta(3, 5, Chars.wrap("Y")); + try (TextDocument doc = builder.build()) { + assertEquals("aXYd", doc.getText().toString()); + + TextRegion region = TextRegion.caretAt(2); + assertEquals(pos2d(1, 4), doc.toLocation(region).getStartPos()); + } + + } + } + +} From e2b666210b0120342699613f3ce7c196d698d83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 29 Apr 2024 14:40:44 +0200 Subject: [PATCH 115/142] [java] Fix #4852 - TypeTestUtil.isA considers intersection type subtype of everything --- .../pmd/lang/java/types/TypeTestUtil.java | 9 ++++++++- .../pmd/lang/java/types/TypeTestUtilTest.java | 18 ++++++++++++++++++ .../xml/ReplaceVectorWithList.xml | 19 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeTestUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeTestUtil.java index f9c5df63eb..d2dc5500e5 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeTestUtil.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeTestUtil.java @@ -139,7 +139,7 @@ public final class TypeTestUtil { * @param t1 A supertype * @param t2 A type * - * @return Whether t1 is a subtype of t2 + * @return Whether t2 is a subtype of t1 */ public static boolean isA(@Nullable JTypeMirror t1, @NonNull JTypeMirror t2) { if (t1 == null) { @@ -153,6 +153,13 @@ public final class TypeTestUtil { return false; // conventionally } else if (t2 instanceof JTypeVar) { return t1.isTop() || isA(t1, ((JTypeVar) t2).getUpperBound()); + } else if (t2 instanceof JIntersectionType) { + for (JTypeMirror subt : ((JIntersectionType) t2).getComponents()) { + if (isA(t1, subt)) { + return true; + } + } + return false; } return t2.isSubtypeOf(t1); diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/types/TypeTestUtilTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/types/TypeTestUtilTest.java index 520962b291..c9ef03c5e6 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/types/TypeTestUtilTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/types/TypeTestUtilTest.java @@ -173,6 +173,24 @@ class TypeTestUtilTest extends BaseParserTest { assertIsNot(field, String.class); } + @Test + void testIsATypeVarWithUnresolvedIntersectionBound() { + // a type var with an unresolved bound should not be considered + // a subtype of everything + // #4852 + + ASTType field = + java.parse("class Foo {\n" + + "\tT field;\n" + + "}") + .descendants(ASTFieldDeclaration.class) + .firstOrThrow().getTypeNode(); + + assertIsA(field, Object.class); + assertIsA(field, Number.class); + assertIsNot(field, String.class); + } + @Test void testIsAStringWithTypeArguments() { diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/ReplaceVectorWithList.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/ReplaceVectorWithList.xml index e8f6476c87..d1b3906aab 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/ReplaceVectorWithList.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/ReplaceVectorWithList.xml @@ -42,4 +42,23 @@ public class Foo { } ]]> + + Not about vector + 0 + { + + public static & IAntiFraudCriterion> AAntiFraudPolicy of(Class enumClass, + Map> criterionChecks) { + return new AAntiFraudPolicy(); + } + + } + ]]> + From 676767c34a10f20a3fabab15cd0fa059c448ce5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 29 Apr 2024 14:45:08 +0200 Subject: [PATCH 116/142] Use typeIsExactly for ReplaceVectorWithList --- .../main/resources/category/java/bestpractices.xml | 3 ++- .../bestpractices/xml/ReplaceVectorWithList.xml | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 881f6b4995..8db08d0343 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -1312,12 +1312,13 @@ Consider replacing Vector usages with the newer java.util.ArrayList if expensive + + + Generic vector + 1 + v) { + } +} + ]]> + + ok, not java.util.Vector 0 From fa176cf31693f53ef4a4ef79e3f90267e274bf31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 29 Apr 2024 13:34:06 -0300 Subject: [PATCH 117/142] Update changelog, refs 4852 --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2a0c2c81f0..85fe4d5f8d 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -18,6 +18,7 @@ This is a {{ site.pmd.release_type }} release. * java-bestpractices * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name + * [#4852](https://github.com/pmd/pmd/issues/4852): \[java] ReplaceVectorWithList false-positive (neither Vector nor List usage) * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test ### 🚨 API Changes From d773088661e4340be9b19dc1d74c52e32458a0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 29 Apr 2024 19:00:46 +0200 Subject: [PATCH 118/142] Split unit test --- .../net/sourceforge/pmd/cpd/CpdAnalysisTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/cpd/CpdAnalysisTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/cpd/CpdAnalysisTest.java index ac67330094..84c22ffc6c 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/cpd/CpdAnalysisTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/cpd/CpdAnalysisTest.java @@ -28,7 +28,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.io.TempDir; -import org.mockito.Mockito; import net.sourceforge.pmd.lang.DummyLanguageModule; import net.sourceforge.pmd.lang.ast.LexException; @@ -197,9 +196,7 @@ class CpdAnalysisTest { } @Test - void testSkipLexicalErrors() throws IOException { - - + void testNoSkipLexicalErrors() throws IOException { PmdReporter reporter = mock(PmdReporter.class); config.setReporter(reporter); @@ -213,8 +210,13 @@ class CpdAnalysisTest { verify(reporter).errorEx(eq("Error while tokenizing"), any(MalformedSourceException.class)); verify(reporter).errorEx(eq("Exception while running CPD"), any(IllegalStateException.class)); verifyNoMoreInteractions(reporter); + } + + @Test + void testSkipLexicalErrors() throws IOException { + PmdReporter reporter = mock(PmdReporter.class); + config.setReporter(reporter); - Mockito.reset(reporter); config.setSkipLexicalErrors(true); try (CpdAnalysis cpd = CpdAnalysis.create(config)) { assertTrue(cpd.files().addSourceFile(FileId.fromPathLikeString("foo.dummy"), DummyLanguageModule.CPD_THROW_LEX_EXCEPTION)); From 8c708b2193b8d34ae09e1d1ddb401d7f7275c2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 29 Apr 2024 20:35:48 +0200 Subject: [PATCH 119/142] Check upper bound compatibility during incorporation --- .../internal/infer/IncorporationAction.java | 66 ++++++++++++++++++- .../lang/java/types/internal/infer/Infer.java | 7 +- .../internal/infer/InferenceContext.java | 4 ++ .../types/internal/infer/InferenceVar.java | 2 +- .../internal/infer/PolyResolutionTest.kt | 3 - 5 files changed, 70 insertions(+), 12 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java index 1224569c13..ab467fcce5 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java @@ -9,6 +9,8 @@ import static net.sourceforge.pmd.lang.java.types.TypeOps.isConvertible; import java.util.ArrayList; import java.util.Set; +import net.sourceforge.pmd.lang.java.symbols.JClassSymbol; +import net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol; import net.sourceforge.pmd.lang.java.types.InternalApiBridge; import net.sourceforge.pmd.lang.java.types.JTypeMirror; import net.sourceforge.pmd.lang.java.types.TypeOps.Convertibility; @@ -36,6 +38,66 @@ abstract class IncorporationAction { abstract void apply(InferenceContext ctx); + /** + * Check that an upper bound with a class (not interface) or array + * is compatible with other upper bounds of class or array type. + * This is necessary to guarantee the existence of a glb for these, + * for {@link ReductionStep#UPPER}. + * + *

    If the bound is {@code alpha <: T}, then we must check + * that {@code S <: T} or {@code T <: S} holds for all bounds + * {@code alpha <: S}, where S is a class or array type. Otherwise, + * the GLB does not exist. + */ + static class CheckClassUpperBound extends IncorporationAction { + + private final JTypeMirror myBound; + + CheckClassUpperBound(InferenceVar ivar, JTypeMirror bound) { + super(ivar); + this.myBound = bound; + } + + public static boolean needsCheck(BoundKind kind, JTypeMirror bound) { + if (kind == BoundKind.UPPER) { + JTypeDeclSymbol symbol = bound.getSymbol(); + return symbol instanceof JClassSymbol && !symbol.isInterface(); + } + return false; + } + + + @Override + public void apply(InferenceContext ctx) { + for (BoundKind k : BoundKind.EQ_UPPER) { + for (JTypeMirror b : ivar.getBounds(k)) { + if (!checkBound(b, ctx)) { + throw ResolutionFailedException.incompatibleBound(ctx.logger, ivar, BoundKind.UPPER, myBound, k, b); + } + } + } + } + + private boolean checkBound(JTypeMirror otherBound, InferenceContext ctx) { + + JTypeDeclSymbol sym = otherBound.getSymbol(); + // either the bound is not a concrete class or array type + return !(sym instanceof JClassSymbol) || sym.isInterface() + // or both bounds are related in some way + || CheckBound.checkBound(false, otherBound, myBound, ctx) + || CheckBound.checkBound(false, myBound, otherBound, ctx); + + } + + + @Override + public String toString() { + return "Check class bound " + BoundKind.UPPER.format(ivar, myBound); + } + + + } + /** * Check that a bound is compatible with the other current bounds * of an ivar. @@ -97,13 +159,13 @@ abstract class IncorporationAction { /** * If 'eq', checks that {@code T = S}, else checks that {@code T <: S}. */ - boolean checkBound(boolean eq, JTypeMirror t, JTypeMirror s, InferenceContext ctx) { + static boolean checkBound(boolean eq, JTypeMirror t, JTypeMirror s, InferenceContext ctx) { // eq bounds are so rare we shouldn't care if they're cached return eq ? InternalApiBridge.isSameTypeInInference(t, s) : checkSubtype(t, s, ctx); } - private boolean checkSubtype(JTypeMirror t, JTypeMirror s, InferenceContext ctx) { + private static boolean checkSubtype(JTypeMirror t, JTypeMirror s, InferenceContext ctx) { if (ctx.getSupertypeCheckCache().isCertainlyASubtype(t, s)) { return true; // supertype was already cached } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java index 6de215c6d2..595bf77921 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/Infer.java @@ -577,12 +577,7 @@ public final class Infer { // we only test it can reduce, we don't commit inferred types at this stage InferenceContext ctxCopy = infCtx.copy(); LOG.applicabilityTest(ctxCopy, m); - try { - ctxCopy.solve(/*onlyBoundedVars:*/isPreJava8()); - } catch (Exception e) { - // applicability test failed for this candidate, but continue with others - throw ResolutionFailedException.fromException(LOG, e); - } + ctxCopy.solve(/*onlyBoundedVars:*/isPreJava8()); // if unchecked conversion was needed, update the site for invocation pass if (ctxCopy.needsUncheckedConversion()) { diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceContext.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceContext.java index 4a979dec0e..12698d1d5c 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceContext.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceContext.java @@ -33,6 +33,7 @@ import net.sourceforge.pmd.lang.java.types.TypeOps; import net.sourceforge.pmd.lang.java.types.TypeSystem; import net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror.InvocationMirror.MethodCtDecl; import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.CheckBound; +import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.CheckClassUpperBound; import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.PropagateAllBounds; import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.PropagateBounds; import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.SubstituteInst; @@ -388,6 +389,9 @@ final class InferenceContext { incorporationActions.add(new CheckBound(ivar, kind, bound)); incorporationActions.add(new PropagateBounds(ivar, kind, bound)); + if (CheckClassUpperBound.needsCheck(kind, bound)) { + incorporationActions.add(new CheckClassUpperBound(ivar, bound)); + } } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceVar.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceVar.java index dafbd5f4b1..c36c10a74e 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceVar.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceVar.java @@ -304,7 +304,7 @@ public final class InferenceVar implements JTypeMirror, SubstVar { // These sets are shared because otherwise *literal millions* of enumsets are created, with the same constants static final Set ALL = EnumSet.allOf(BoundKind.class); static final Set EQ_LOWER = EnumSet.of(EQ, LOWER); - private static final Set EQ_UPPER = EnumSet.of(EQ, UPPER); + static final Set EQ_UPPER = EnumSet.of(EQ, UPPER); private static final Set JUST_EQ = Collections.singleton(EQ); private final String sym; diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt index 17d131376a..c8cd940c47 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt @@ -15,9 +15,6 @@ import java.io.OutputStream /** * Expensive test cases for the overload resolution phase. - * - * Edit: So those used to be very expensive (think minutes of execution), - * but optimisations made them very fast. */ class PolyResolutionTest : ProcessorTestSpec({ From 6700b47b12e5e8196f675cd777e17c6cc01a8b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 29 Apr 2024 16:03:14 -0300 Subject: [PATCH 120/142] Remove unused code --- .../internal/infer/ResolutionFailedException.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java index 4ea2c0aa97..b955129c56 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ResolutionFailedException.java @@ -55,17 +55,6 @@ final class ResolutionFailedException extends RuntimeException { // If the logger is noop we don't even create the failure. // These failures are extremely frequent (and normal), and type pretty-printing is expensive - static ResolutionFailedException fromException(TypeInferenceLogger logger, Exception e) { - if (e instanceof ResolutionFailedException) { - return (ResolutionFailedException) e; - } - - return getShared(logger.isNoop() ? UNKNOWN : new ResolutionFailure( - null, - e.getMessage() - )); - } - static ResolutionFailedException incompatibleBound(TypeInferenceLogger logger, InferenceVar ivar, BoundKind k1, JTypeMirror b1, BoundKind k2, JTypeMirror b2) { // in javac it's "no instance of type variables exist ..." return getShared(logger.isNoop() ? UNKNOWN : new ResolutionFailure( From 6c0e73600174eec8cb16e08082c219ae60bab0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 30 Apr 2024 14:45:11 +0200 Subject: [PATCH 121/142] Update reference files --- .../sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt | 6 +++--- .../java21p/Jep443_UnnamedPatternsAndVariables.txt | 2 +- .../java22/Jep456_UnnamedPatternsAndVariables.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt index da23efe42b..1d588cc7f3 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt @@ -403,7 +403,7 @@ | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "/foo", @Empty = false, @Image = "\"/foo\"", @Length = 4, @LiteralText = "\"/foo\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- TryStatement[@TryWithResources = true] | | +- ResourceList[@Empty = false, @Size = 1, @TrailingSemiColon = false] - | | | +- Resource[@ConciseResource = false, @StableName = "br"] + | | | +- Resource[@ConciseResource = false] | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "BufferedReader"] @@ -459,7 +459,7 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "outputFileName", @Name = "outputFileName", @ParenthesisDepth = 0, @Parenthesized = false] | +- TryStatement[@TryWithResources = true] | +- ResourceList[@Empty = false, @Size = 2, @TrailingSemiColon = false] - | | +- Resource[@ConciseResource = false, @StableName = "zf"] + | | +- Resource[@ConciseResource = false] | | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | | +- ClassType[@FullyQualified = true, @SimpleName = "ZipFile"] @@ -469,7 +469,7 @@ | | | +- ClassType[@FullyQualified = true, @SimpleName = "ZipFile"] | | | +- ArgumentList[@Empty = false, @Size = 1] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "zipFileName", @Name = "zipFileName", @ParenthesisDepth = 0, @Parenthesized = false] - | | +- Resource[@ConciseResource = false, @StableName = "writer"] + | | +- Resource[@ConciseResource = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | +- ClassType[@FullyQualified = true, @SimpleName = "BufferedWriter"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt index 6429a5a730..93734fdee0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt @@ -519,7 +519,7 @@ +- Block[@Empty = false, @Size = 4, @containsComment = false] +- TryStatement[@TryWithResources = true] | +- ResourceList[@Empty = false, @Size = 1, @TrailingSemiColon = false] - | | +- Resource[@ConciseResource = false, @StableName = "_"] + | | +- Resource[@ConciseResource = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt index 3de46269b6..c9f4bbc107 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt @@ -519,7 +519,7 @@ +- Block[@Empty = false, @Size = 4, @containsComment = false] +- TryStatement[@TryWithResources = true] | +- ResourceList[@Empty = false, @Size = 1, @TrailingSemiColon = false] - | | +- Resource[@ConciseResource = false, @StableName = "_"] + | | +- Resource[@ConciseResource = false] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] From bca5c0ec09b78579f380fbfb9944d419310c2823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 30 Apr 2024 15:26:10 +0200 Subject: [PATCH 122/142] Remove usages of getStableName Fix #4930 Fix bug with symbol table in concise resources --- docs/pages/release_notes.md | 4 ++ .../java/ast/internal/PrettyPrintingUtil.java | 8 +++- .../codestyle/EmptyControlStatementRule.java | 47 ++++++++++++++++--- .../table/internal/SymbolTableResolver.java | 26 ++++++---- .../pmd/lang/java/ast/ASTTryStatementTest.kt | 7 +-- .../symbols/table/internal/VarScopingTest.kt | 12 ++++- .../codestyle/xml/EmptyControlStatement.xml | 20 +++++++- 7 files changed, 97 insertions(+), 27 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index cc881c5ef5..bd67ed6cf0 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -25,6 +25,10 @@ This is a {{ site.pmd.release_type }} release. ### 🚨 API Changes +#### Deprecated API + +* {% jdoc java::lang.java.ast.ASTResource#getStableName() %} and the corresponding attribute `@StableName` + ### ✨ External Contributions {% endtocmaker %} diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java index 8b2ffb60f9..d78b500215 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/internal/PrettyPrintingUtil.java @@ -37,6 +37,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTLambdaExpression; import net.sourceforge.pmd.lang.java.ast.ASTLambdaParameterList; import net.sourceforge.pmd.lang.java.ast.ASTList; import net.sourceforge.pmd.lang.java.ast.ASTLiteral; +import net.sourceforge.pmd.lang.java.ast.ASTLocalVariableDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTMethodReference; @@ -186,7 +187,12 @@ public final class PrettyPrintingUtil { } else if (node instanceof ASTFieldDeclaration) { return ((ASTFieldDeclaration) node).getVarIds().firstOrThrow().getName(); } else if (node instanceof ASTResource) { - return ((ASTResource) node).getStableName(); + ASTLocalVariableDeclaration var = ((ASTResource) node).asLocalVariableDeclaration(); + if (var != null) { + return var.getVarIds().firstOrThrow().getName(); + } else { + return PrettyPrintingUtil.prettyPrint(((ASTResource) node).getInitializer()).toString(); + } } else if (node instanceof ASTTypeDeclaration) { return ((ASTTypeDeclaration) node).getSimpleName(); } else if (node instanceof ASTVariableId) { diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/EmptyControlStatementRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/EmptyControlStatementRule.java index 00b626373b..6c10f58259 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/EmptyControlStatementRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/EmptyControlStatementRule.java @@ -7,18 +7,26 @@ package net.sourceforge.pmd.lang.java.rule.codestyle; import net.sourceforge.pmd.lang.java.ast.ASTBlock; import net.sourceforge.pmd.lang.java.ast.ASTDoStatement; import net.sourceforge.pmd.lang.java.ast.ASTEmptyStatement; +import net.sourceforge.pmd.lang.java.ast.ASTExpression; +import net.sourceforge.pmd.lang.java.ast.ASTFieldAccess; import net.sourceforge.pmd.lang.java.ast.ASTFinallyClause; import net.sourceforge.pmd.lang.java.ast.ASTForStatement; import net.sourceforge.pmd.lang.java.ast.ASTForeachStatement; import net.sourceforge.pmd.lang.java.ast.ASTIfStatement; import net.sourceforge.pmd.lang.java.ast.ASTInitializer; +import net.sourceforge.pmd.lang.java.ast.ASTLocalVariableDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTResource; import net.sourceforge.pmd.lang.java.ast.ASTResourceList; +import net.sourceforge.pmd.lang.java.ast.ASTSuperExpression; import net.sourceforge.pmd.lang.java.ast.ASTSwitchStatement; import net.sourceforge.pmd.lang.java.ast.ASTSynchronizedStatement; +import net.sourceforge.pmd.lang.java.ast.ASTThisExpression; import net.sourceforge.pmd.lang.java.ast.ASTTryStatement; +import net.sourceforge.pmd.lang.java.ast.ASTVariableAccess; +import net.sourceforge.pmd.lang.java.ast.ASTVariableId; import net.sourceforge.pmd.lang.java.ast.ASTWhileStatement; import net.sourceforge.pmd.lang.java.ast.JavaNode; +import net.sourceforge.pmd.lang.java.ast.internal.PrettyPrintingUtil; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; import net.sourceforge.pmd.lang.java.rule.internal.JavaRuleUtil; import net.sourceforge.pmd.properties.PropertyDescriptor; @@ -133,29 +141,54 @@ public class EmptyControlStatementRule extends AbstractJavaRulechainRule { public Object visit(ASTTryStatement node, Object data) { if (isEmpty(node.getBody())) { // all resources must be explicitly ignored - boolean allResourcesIgnored = true; boolean hasResource = false; ASTResourceList resources = node.getResources(); if (resources != null) { for (ASTResource resource : resources) { hasResource = true; - String name = resource.getStableName(); + ASTLocalVariableDeclaration localVarDecl = resource.asLocalVariableDeclaration(); + if (localVarDecl == null) { + // not a concise resource. + ASTExpression init = resource.getInitializer(); + if (isSimpleExpression(init)) { + // The expression is simple enough, it should be just written this.close() or var.close(), + // so we report this case + asCtx(data).addViolationWithMessage(node, "Empty try-with-resources statement. Should be written {0}.close()", PrettyPrintingUtil.prettyPrint(init)); + return null; + } + // Otherwise the expression is more complex and this is allowed, in order + // to avoid bringing a variable into the enclosing scope + continue; + } + + // A named resource. Named should be ignored. + ASTVariableId varId = localVarDecl.getVarIds().firstOrThrow(); + if (!varId.getLocalUsages().isEmpty()) { + // this resource is used in other resource declarations or in a finally block + return null; + } + String name = varId.getName(); if (!JavaRuleUtil.isExplicitUnusedVarName(name)) { - allResourcesIgnored = false; - break; + asCtx(data).addViolationWithMessage(node, "Empty try-with-resources statement. Rename the resource to `ignored`, `unused` or `_` (Java 22+)."); + return null; } } } - if (hasResource && !allResourcesIgnored) { - asCtx(data).addViolationWithMessage(node, "Empty try body - you could rename the resource to ''ignored''"); - } else if (!hasResource) { + if (!hasResource) { asCtx(data).addViolationWithMessage(node, "Empty try body"); } } return null; } + private static boolean isSimpleExpression(ASTExpression init) { + return init instanceof ASTThisExpression + || init instanceof ASTSuperExpression + || init instanceof ASTVariableAccess + || init instanceof ASTFieldAccess && isSimpleExpression(((ASTFieldAccess) init).getQualifier()); + } + private boolean isEmpty(JavaNode node) { boolean allowCommentedBlocks = getProperty(ALLOW_COMMENTED_BLOCKS); diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/table/internal/SymbolTableResolver.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/table/internal/SymbolTableResolver.java index 94e2568ff4..f7679a49e3 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/table/internal/SymbolTableResolver.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/table/internal/SymbolTableResolver.java @@ -23,6 +23,7 @@ import org.pcollections.PSet; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.NodeStream; +import net.sourceforge.pmd.lang.ast.impl.GenericNode; import net.sourceforge.pmd.lang.java.ast.ASTAmbiguousName; import net.sourceforge.pmd.lang.java.ast.ASTAnonymousClassDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTBlock; @@ -386,14 +387,14 @@ public final class SymbolTableResolver { /** * Note: caller is responsible for popping. */ - private int visitBlockLike(Iterable node, @NonNull ReferenceCtx ctx) { + private int visitBlockLike(Iterable node, @NonNull ReferenceCtx ctx) { /* * Process the statements of a block in a sequence. Each local * var/class declaration is only in scope for the following * statements (and its own initializer). */ int pushed = 0; - for (ASTStatement st : node) { + for (JavaNode st : node) { if (st instanceof ASTLocalVariableDeclaration) { pushed += processLocalVarDecl((ASTLocalVariableDeclaration) st, ctx); // note we don't pop here, all those variables will be popped at the end of the block @@ -403,10 +404,17 @@ public final class SymbolTableResolver { processTypeHeader(local, ctx); } - setTopSymbolTable(st); - // those vars are the one produced by pattern bindings/ local var decls - PSet newVars = st.acceptVisitor(this.stmtVisitor, ctx); - pushed += pushOnStack(f.localVarSymTable(top(), enclosing(), newVars)); + if (st instanceof ASTStatement) { + setTopSymbolTable(st); + // those vars are the one produced by pattern bindings/ local var decls + PSet newVars = st.acceptVisitor(this.stmtVisitor, ctx); + pushed += pushOnStack(f.localVarSymTable(top(), enclosing(), newVars)); + } else { + // concise resource initializer + assert st instanceof ASTExpression && st.getParent() instanceof ASTResource : st; + setTopSymbolTable(st.getParent()); + st.acceptVisitor(this, ctx); + } } return pushed; @@ -450,7 +458,7 @@ public final class SymbolTableResolver { ASTResourceList resources = node.getResources(); if (resources != null) { - NodeStream union = + NodeStream union = NodeStream.union( stmtsOfResources(resources), // use the body instead of unwrapping it so @@ -750,8 +758,8 @@ public final class SymbolTableResolver { // - static NodeStream stmtsOfResources(ASTResourceList node) { - return node.toStream().map(ASTResource::asLocalVariableDeclaration); + static NodeStream stmtsOfResources(ASTResourceList node) { + return node.toStream().map(GenericNode::getFirstChild); } diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt index 89b98ce250..cd2a361d2c 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt @@ -4,10 +4,10 @@ package net.sourceforge.pmd.lang.java.ast -import net.sourceforge.pmd.lang.test.ast.shouldBe import net.sourceforge.pmd.lang.java.ast.JavaVersion.Companion.Latest import net.sourceforge.pmd.lang.java.ast.JavaVersion.J1_7 import net.sourceforge.pmd.lang.java.ast.JavaVersion.J9 +import net.sourceforge.pmd.lang.test.ast.shouldBe /** * @author Clément Fournier @@ -23,7 +23,6 @@ class ASTTryStatementTest : ParserTestSpec({ child { child { it::isConciseResource shouldBe false - it::getStableName shouldBe "a" it::getInitializer shouldBe fromChild { it::getModifiers shouldBe localVarModifiers { @@ -50,7 +49,6 @@ class ASTTryStatementTest : ParserTestSpec({ child { child { it::isConciseResource shouldBe false - it::getStableName shouldBe "a" it::getInitializer shouldBe fromChild { it::getModifiers shouldBe localVarModifiers { @@ -83,7 +81,6 @@ class ASTTryStatementTest : ParserTestSpec({ child { child { it::isConciseResource shouldBe true - it::getStableName shouldBe "a" it::getInitializer shouldBe variableAccess("a") } @@ -101,7 +98,6 @@ class ASTTryStatementTest : ParserTestSpec({ child { child { it::isConciseResource shouldBe true - it::getStableName shouldBe "a" it::getInitializer shouldBe variableAccess("a") } @@ -119,7 +115,6 @@ class ASTTryStatementTest : ParserTestSpec({ child { child { it::isConciseResource shouldBe true - it::getStableName shouldBe "a.b" it::getInitializer shouldBe fieldAccess("b") { ambiguousName("a") diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/symbols/table/internal/VarScopingTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/symbols/table/internal/VarScopingTest.kt index 33869571c3..6f4eef0e86 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/symbols/table/internal/VarScopingTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/symbols/table/internal/VarScopingTest.kt @@ -132,14 +132,18 @@ class VarScopingTest : ProcessorTestSpec({ try (Reader f = r; // reader3 BufferedReader r = f.buffered()) { // br2 } + + try (Reader f4 = r; // reader4 + f4.buffered().field) { // inConciseResource + } } } """.trimIndent()) - val (outerField, exception1, reader1, exception2, reader2, bufferedReader, reader3, br2) = + val (outerField, exception1, reader1, exception2, reader2, bufferedReader, reader3, br2, reader4) = acu.descendants(ASTVariableId::class.java).toList() - val (inCatch1, inTry, inCatch2, inFinally, inResource) = + val (inCatch1, inTry, inCatch2, inFinally, inResource, _, inConciseResource) = acu.descendants(ASTMethodCall::class.java).toList() doTest("Inside catch clause: catch param is in scope") { @@ -170,6 +174,10 @@ class VarScopingTest : ProcessorTestSpec({ br2.initializer!! shouldResolveToLocal reader3 } + doTest("Inside concise resource declaration") { + inConciseResource.qualifier!! shouldResolveToLocal reader4 + } + doTest("Resources are in scope, even if the try body is empty") { val emptyBlock = br2.ancestors(ASTTryStatement::class.java).firstOrThrow().body emptyBlock.toList() should beEmpty() diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/EmptyControlStatement.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/EmptyControlStatement.xml index 8d5dcdce10..42fc1039a5 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/EmptyControlStatement.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/EmptyControlStatement.xml @@ -96,7 +96,7 @@ #432 empty try-with-resource - not ok 1 - Empty try body - you could rename the resource to 'ignored' + Empty try-with-resources statement. Rename the resource to `ignored`, `unused` or `_` (Java 22+). 1 4 - Empty try body - you could rename the resource to 'ignored' + Empty try-with-resources statement. Should be written in.close() + + Try with resources with several vars, ok + 0 + + pos, empty synchronized stmt From e327a548a4f4f30be8f8aa7ad3ce1a95b04e0cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 30 Apr 2024 16:25:01 +0200 Subject: [PATCH 123/142] Fix impl of ASTVariableId::isResourceDeclaration --- .../net/sourceforge/pmd/lang/java/ast/ASTVariableId.java | 3 ++- .../sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt | 8 ++++++-- .../sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt | 6 +++--- .../java21p/Jep443_UnnamedPatternsAndVariables.txt | 2 +- .../java22/Jep456_UnnamedPatternsAndVariables.txt | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableId.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableId.java index e21de7a2b5..88f97fecfe 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableId.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableId.java @@ -232,7 +232,8 @@ public final class ASTVariableId extends AbstractTypedSymbolDeclarator { - variableId("a") + variableId("a") { + it::isResourceDeclaration shouldBe true + } int(2) } } @@ -59,7 +61,9 @@ class ASTTryStatementTest : ParserTestSpec({ } classType("Foo") fromChild { - variableId("a") + variableId("a") { + it::isResourceDeclaration shouldBe true + } int(2) } } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt index da23efe42b..8861efb44c 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt @@ -408,7 +408,7 @@ | | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | | +- ClassType[@FullyQualified = false, @SimpleName = "BufferedReader"] | | | +- VariableDeclarator[@Initializer = true, @Name = "br"] - | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "br", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] + | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "br", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = true, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | | | +- ClassType[@FullyQualified = false, @SimpleName = "BufferedReader"] | | | +- ArgumentList[@Empty = false, @Size = 1] @@ -464,7 +464,7 @@ | | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | | +- ClassType[@FullyQualified = true, @SimpleName = "ZipFile"] | | | +- VariableDeclarator[@Initializer = true, @Name = "zf"] - | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "zf", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] + | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "zf", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = true, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | | | +- ClassType[@FullyQualified = true, @SimpleName = "ZipFile"] | | | +- ArgumentList[@Empty = false, @Size = 1] @@ -474,7 +474,7 @@ | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | +- ClassType[@FullyQualified = true, @SimpleName = "BufferedWriter"] | | +- VariableDeclarator[@Initializer = true, @Name = "writer"] - | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "writer", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] + | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "writer", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = true, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "newBufferedWriter", @MethodName = "newBufferedWriter", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = true, @SimpleName = "Files"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt index 6429a5a730..72b946dc0d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21p/Jep443_UnnamedPatternsAndVariables.txt @@ -523,7 +523,7 @@ | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] - | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] + | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = true, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "acquire", @MethodName = "acquire", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @SimpleName = "ScopedContext"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt index 3de46269b6..2b3b592369 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt @@ -523,7 +523,7 @@ | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = true, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = "{final}", @ExplicitModifiers = "{}"] | | +- VariableDeclarator[@Initializer = true, @Name = "_"] - | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] + | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = true, @Static = false, @TypeInferred = true, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "acquire", @MethodName = "acquire", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @SimpleName = "ScopedContext"] From 3c39aed55e30832d67ce9356daeefa686918b448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 30 Apr 2024 17:53:03 +0200 Subject: [PATCH 124/142] Fix #4985 UnusedPrivateMethod fp --- .../pmd/lang/java/types/TypeOps.java | 7 ++- .../infer/UnresolvedTypesRecoveryTest.kt | 47 ++++++++++++++++++- .../bestpractices/xml/UnusedPrivateMethod.xml | 38 +++++++++++++++ 3 files changed, 89 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java index 56c563ddf0..b44393b1c8 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java @@ -440,7 +440,12 @@ public final class TypeOps { } // otherwise fallthrough } else if (isSpecialUnresolved(t)) { - // error type or unresolved type + // error type or unresolved type is subtype of everything + if (s instanceof JArrayType) { + // In case the array has an ivar 'a as element type, a bound will be added 'a >: (*unknown*) + // This helps inference recover in call chains and propagate the (*unknown*) types gracefully. + return isConvertible(t, ((JArrayType) s).getElementType()); + } return Convertibility.SUBTYPING; } else if (hasUnresolvedSymbol(t) && t instanceof JClassType) { // This also considers types with an unresolved symbol diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/UnresolvedTypesRecoveryTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/UnresolvedTypesRecoveryTest.kt index 5c4bb7f798..c240164f9f 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/UnresolvedTypesRecoveryTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/UnresolvedTypesRecoveryTest.kt @@ -7,11 +7,11 @@ package net.sourceforge.pmd.lang.java.types.internal.infer import io.kotest.matchers.shouldBe -import net.sourceforge.pmd.lang.test.ast.shouldBeA -import net.sourceforge.pmd.lang.test.ast.shouldMatchN import net.sourceforge.pmd.lang.java.ast.* import net.sourceforge.pmd.lang.java.symbols.JClassSymbol import net.sourceforge.pmd.lang.java.types.* +import net.sourceforge.pmd.lang.test.ast.shouldBeA +import net.sourceforge.pmd.lang.test.ast.shouldMatchN /** */ @@ -651,4 +651,47 @@ class C { } } + parserTest("Method ref in unresolved call chain") { + /* + In this test we have Stream.of(/*some expr with unresolved type*/) + + The difficult thing is that Stream.of has two overloads: of(U) and of(U...), + and the argument is unknown. This makes both methods match. Whichever method is matched, + we want the U to be inferred to (*unknown*) and not Object. + */ + + val (acu, _) = parser.parseWithTypeInferenceSpy(""" + interface Function { + R call(T parm); + } + interface Stream { + Stream map(Function fun); + + // the point of this test is there is an ambiguity between both of these overloads + static Stream of(U u) {} + static Stream of(U... u) {} + } + class Foo { + { + // var i = Stream.of("").map(Foo::toInt); + var x = Stream.of(new Unresolved().getString()) + .map(Foo::toInt); + } + private static Integer toInt(String s) {} + } + """) + + val (fooToInt) = acu.descendants(ASTMethodReference::class.java).toList() + val (map, streamOf, getString) = acu.methodCalls().toList() + val (t_Function, t_Stream, t_Foo) = acu.declaredTypeSignatures() + val (_, _, _, _, toIntFun) = acu.methodDeclarations().toList { it.symbol } + + acu.withTypeDsl { + streamOf shouldHaveType t_Stream[ts.UNKNOWN] + map shouldHaveType t_Stream[ts.INT.box()] + fooToInt shouldHaveType t_Function[ts.UNKNOWN, ts.INT.box()] + fooToInt.referencedMethod.symbol shouldBe toIntFun + } + } + }) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml index eb072c2dbc..41367ff29f 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml @@ -1964,4 +1964,42 @@ class FooTest{ } ]]> + + [java] UnusedPrivateMethod false-positive / method reference in combination with custom object #4985 + 0 + + From 4993c629ec8e05ef5bfd98c7083c5b0a5e6e6a40 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 1 May 2024 20:10:36 +0200 Subject: [PATCH 125/142] [doc] Update release notes (#4985) --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 85fe4d5f8d..2110067484 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -20,6 +20,7 @@ This is a {{ site.pmd.release_type }} release. * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4852](https://github.com/pmd/pmd/issues/4852): \[java] ReplaceVectorWithList false-positive (neither Vector nor List usage) * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test + * [#4985](https://github.com/pmd/pmd/issues/4985): \[java] UnusedPrivateMethod false-positive / method reference in combination with custom object ### 🚨 API Changes From 2d11ed8e93d9028b77a0ecadc61148b5bf27fe88 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Wed, 1 May 2024 20:31:52 +0200 Subject: [PATCH 126/142] [core] Add a unit test for ruleset validation messages Refs #4981 Refs #4978 --- .../lang/rule/RuleSetFactoryMessagesTest.java | 36 +++++++++++++++++++ .../pmd/lang/rule/RulesetFactoryTestBase.java | 4 +-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RuleSetFactoryMessagesTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RuleSetFactoryMessagesTest.java index 5a47249906..b876dbcb54 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RuleSetFactoryMessagesTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RuleSetFactoryMessagesTest.java @@ -9,7 +9,12 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.junit.jupiter.api.Assertions.assertEquals; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import net.sourceforge.pmd.util.internal.xml.SchemaConstants; import net.sourceforge.pmd.util.internal.xml.XmlErrorMessages; @@ -106,4 +111,35 @@ class RuleSetFactoryMessagesTest extends RulesetFactoryTestBase { + " ^^^^^^^^^ Delimiter attribute is not supported anymore, values are always comma-separated.\n" )); } + + /** + * @see [core] Referenced Rulesets do not emit details on validation errors #4978 + */ + @Test + void validationMessagesFromReferencedRulesets(@TempDir Path tempDir) throws Exception { + Path childRuleset = tempDir.resolve("invalid-ruleset.xml").toAbsolutePath(); + Files.write(childRuleset, + rulesetXml( + dummyRule( + priority("not a priority") + ) + ).getBytes(StandardCharsets.UTF_8)); + + String log = SystemLambda.tapSystemErr(() -> { + RuleSetLoadException exception = assertCannotParse( + rulesetXml( + ruleRef(childRuleset.toString()) + ) + ); + assertThat(exception.getMessage(), containsString("Cannot load ruleset " + childRuleset + ": An XML validation error occurred")); + }); + + assertThat(log, containsString( + "Error at " + childRuleset + ":9:1\n" + + " 7| \n" + + " 8| \n" + + " 9| not a priority\n" + + " ^^^^^^^^^ Not a valid priority: 'not a priority', expected a number in [1,5]" + )); + } } diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RulesetFactoryTestBase.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RulesetFactoryTestBase.java index 477991688b..732f4095a6 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RulesetFactoryTestBase.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/RulesetFactoryTestBase.java @@ -115,8 +115,8 @@ public class RulesetFactoryTestBase { } } - protected void assertCannotParse(String xmlContent) { - assertThrows(RuleSetLoadException.class, () -> loadFirstRule(xmlContent)); + protected RuleSetLoadException assertCannotParse(String xmlContent) { + return assertThrows(RuleSetLoadException.class, () -> loadFirstRule(xmlContent)); } /* DSL to build a ruleset XML file with method calls. From f64fa3ed074a84df3f5b0f2d7b6eb33c4f4e0029 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 2 May 2024 10:21:09 +0200 Subject: [PATCH 127/142] [doc] Update release notes (#4973) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index f83ab6b3ca..1949d243ea 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -18,6 +18,8 @@ This is a {{ site.pmd.release_type }} release. * core * [#4978](https://github.com/pmd/pmd/issues/4978): \[core] Referenced Rulesets do not emit details on validation errors +* java + * [#4973](https://github.com/pmd/pmd/pull/4973): \[java] Stop parsing Java for CPD * java-bestpractices * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4852](https://github.com/pmd/pmd/issues/4852): \[java] ReplaceVectorWithList false-positive (neither Vector nor List usage) From 5bb6ece01ab1f67c8ed2832774782f6363edacf1 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 2 May 2024 11:12:37 +0200 Subject: [PATCH 128/142] [doc] Update release notes (#4983) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 2a0c2c81f0..f835fc901c 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,6 +16,8 @@ This is a {{ site.pmd.release_type }} release. ### 🐛 Fixed Issues +* core + * [#4983](https://github.com/pmd/pmd/pull/4983): \[cpd] Fix CPD crashes about unicode escapes * java-bestpractices * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test From b7a39e39e987f312cfe401d839ff5a83f4b4a5ba Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 2 May 2024 11:34:43 +0200 Subject: [PATCH 129/142] Apply suggestions from code review --- docs/pages/release_notes.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index bd67ed6cf0..c6c73219d7 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -22,12 +22,15 @@ This is a {{ site.pmd.release_type }} release. * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4852](https://github.com/pmd/pmd/issues/4852): \[java] ReplaceVectorWithList false-positive (neither Vector nor List usage) * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test +* java-codestyle + * [#4930](https://github.com/pmd/pmd/issues/4930): \[java] EmptyControlStatement should not allow empty try with concise resources ### 🚨 API Changes #### Deprecated API -* {% jdoc java::lang.java.ast.ASTResource#getStableName() %} and the corresponding attribute `@StableName` +* pmd-java + * {% jdoc !!java::lang.java.ast.ASTResource#getStableName() %} and the corresponding attribute `@StableName` ### ✨ External Contributions From b6a933b4fcd64a44dbee7f7a9acefdd8f1c80948 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 2 May 2024 12:43:53 +0200 Subject: [PATCH 130/142] [doc] Update release notes (#4988) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 85fe4d5f8d..aa3dc77f68 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,6 +16,8 @@ This is a {{ site.pmd.release_type }} release. ### 🐛 Fixed Issues +* java + * [#4988](https://github.com/pmd/pmd/pull/4988): \[java] Fix impl of ASTVariableId::isResourceDeclaration / VariableId/@ResourceDeclaration * java-bestpractices * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4852](https://github.com/pmd/pmd/issues/4852): \[java] ReplaceVectorWithList false-positive (neither Vector nor List usage) From b1aaf5d69bbfe2ee7309f676d2309a6883fda6c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 30 Apr 2024 11:21:15 +0200 Subject: [PATCH 131/142] Fix conc mod exceptions during incorporation --- .../pmd/lang/java/types/TypeOps.java | 84 ++++++++++--------- .../internal/infer/IncorporationAction.java | 84 ++++++------------- .../internal/infer/InferenceContext.java | 4 - .../lang/java/types/TestUtilitiesForTypes.kt | 2 +- .../internal/infer/PolyResolutionTest.kt | 21 +++++ 5 files changed, 91 insertions(+), 104 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java index 56c563ddf0..c0c84e0ca0 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java @@ -398,11 +398,17 @@ public final class TypeOps { public static Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s) { - return isConvertible(t, s, true); + return isConvertible(t, s, true, false); } + @Deprecated // unused public static Convertibility isConvertibleNoCapture(@NonNull JTypeMirror t, @NonNull JTypeMirror s) { - return isConvertible(t, s, false); + return isConvertible(t, s, false, false); + } + + // does not perform side effects on inference vars + public static Convertibility isConvertiblePure(JTypeMirror t, JTypeMirror s) { + return isConvertible(t, s, true, true); } /** @@ -414,7 +420,7 @@ public final class TypeOps { * @param t A type T * @param s A type S */ - public static Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s, boolean capture) { + public static Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s, boolean capture, boolean pure) { // This is commented out as it makes JTypeMirror#isSubtypeOf partial, // which is not nice for the API... But this assert caught a bug and // should probably be enabled. @@ -428,15 +434,17 @@ public final class TypeOps { } else if (s.isVoid() || t.isVoid()) { // t != s return Convertibility.NEVER; } else if (s instanceof InferenceVar) { - // it's possible to add a bound to UNKNOWN or ERROR - ((InferenceVar) s).addBound(BoundKind.LOWER, t); + if (!pure) { + // it's possible to add a bound to UNKNOWN or ERROR + ((InferenceVar) s).addBound(BoundKind.LOWER, t); + } return Convertibility.SUBTYPING; } else if (isTypeRange(s)) { // If s is a type range L..U, // then showing t <: s is the same thing as t <: L JTypeMirror lower = lowerBoundRec(s); if (!lower.isBottom()) { - return isConvertible(t, lower, capture); + return isConvertible(t, lower, capture, pure); } // otherwise fallthrough } else if (isSpecialUnresolved(t)) { @@ -447,7 +455,7 @@ public final class TypeOps { // subtypes of (nearly) anything. This allows them to // pass bound checks on type variables. if (Objects.equals(t.getSymbol(), s.getSymbol())) { - return typeArgsAreContained((JClassType) t, (JClassType) s); + return typeArgsAreContained((JClassType) t, (JClassType) s, pure); } else { return Convertibility.subtypeIf(s instanceof JClassType); // excludes array or so } @@ -455,24 +463,14 @@ public final class TypeOps { // If S is an intersection, then T must conform to *all* bounds of S // Symmetrically, if T is an intersection, T <: S requires only that // at least one bound of T is a subtype of S. - return Convertibility.subtypesAll(t, asList(s)); + return Convertibility.subtypesAll(t, asList(s), pure); } if (capture) { t = capture(t); } - return t.acceptVisitor(SubtypeVisitor.INSTANCE, s); - } - - // does not perform side effects on inference vars - private static Convertibility isSubtypePure(JTypeMirror t, JTypeMirror s) { - if (t instanceof InferenceVar) { - return Convertibility.subtypeIf(((InferenceVar) t).isSubtypeNoSideEffect(s)); - } else if (s instanceof InferenceVar) { - return Convertibility.subtypeIf(((InferenceVar) s).isSupertypeNoSideEffect(t)); - } - - return isConvertible(t, s); + SubtypeVisitor visitor = pure ? SubtypeVisitor.PURE : SubtypeVisitor.INSTANCE; + return t.acceptVisitor(visitor, s); } public static boolean allArgsAreUnboundedWildcards(List sargs) { @@ -601,10 +599,10 @@ public final class TypeOps { return b ? SUBTYPING : NEVER; } - static Convertibility subtypesAll(JTypeMirror t, Iterable supers) { + static Convertibility subtypesAll(JTypeMirror t, Iterable supers, boolean pure) { Convertibility result = SUBTYPING; for (JTypeMirror ui : supers) { - Convertibility sub = isConvertible(t, ui); + Convertibility sub = isConvertible(t, ui, true, pure); if (sub == NEVER) { return NEVER; } @@ -613,10 +611,10 @@ public final class TypeOps { return result; } - static Convertibility anySubTypesAny(Iterable us, Iterable vs) { + static Convertibility anySubTypesAny(Iterable us, Iterable vs, boolean pure) { for (JTypeMirror ui : us) { for (JTypeMirror vi : vs) { - Convertibility sub = isConvertible(ui, vi); + Convertibility sub = isConvertible(ui, vi, true, pure); if (sub != NEVER) { return sub.and(SUBTYPING); // never return identity here } @@ -680,7 +678,7 @@ public final class TypeOps { * *

    Defined in JLS§4.5.1 (Type Arguments of Parameterized Types) */ - static Convertibility typeArgContains(JTypeMirror s, JTypeMirror t) { + static Convertibility typeArgContains(JTypeMirror s, JTypeMirror t, boolean pure) { // the contains relation can be understood intuitively if we // represent types as ranges on a line: @@ -698,7 +696,7 @@ public final class TypeOps { // ⊥ -------U(T)-----U(S)------> Object (L(T) = L(S) = ⊥) // ⊥ -------L(S)-----L(T)------> Object (U(T) = U(S) = Object) - if (isSameTypeInInference(s, t)) { + if (isSameType(s, t, !pure, false)) { // S <= S return Convertibility.SUBTYPING; } @@ -714,10 +712,10 @@ public final class TypeOps { if (sw.isUpperBound()) { // Test U(T) <: U(S), we already know L(S) <: L(T), because L(S) is bottom - return isConvertible(wildUpperBound(t), sw.asUpperBound()); + return isConvertible(wildUpperBound(t), sw.asUpperBound(), pure, false); } else { // Test L(S) <: L(T), we already know U(T) <: U(S), because U(S) is top - return isConvertible(sw.asLowerBound(), wildLowerBound(t)); + return isConvertible(sw.asLowerBound(), wildLowerBound(t), pure, false); } } @@ -728,7 +726,7 @@ public final class TypeOps { /** * Generalises containment to check if for each i, {@code Ti <= Si}. */ - static Convertibility typeArgsAreContained(JClassType t, JClassType s) { + static Convertibility typeArgsAreContained(JClassType t, JClassType s, boolean pure) { List targs = t.getTypeArgs(); List sargs = s.getTypeArgs(); @@ -763,7 +761,7 @@ public final class TypeOps { Convertibility result = Convertibility.SUBTYPING; for (int i = 0; i < targs.size(); i++) { - Convertibility sub = typeArgContains(sargs.get(i), targs.get(i)); + Convertibility sub = typeArgContains(sargs.get(i), targs.get(i), pure); if (sub == Convertibility.NEVER) { return Convertibility.NEVER; } @@ -775,7 +773,13 @@ public final class TypeOps { private static final class SubtypeVisitor implements JTypeVisitor { - static final SubtypeVisitor INSTANCE = new SubtypeVisitor(); + static final SubtypeVisitor INSTANCE = new SubtypeVisitor(false); + static final SubtypeVisitor PURE = new SubtypeVisitor(true); + private final boolean pure; + + private SubtypeVisitor(boolean pure) { + this.pure = pure; + } @Override public Convertibility visit(JTypeMirror t, JTypeMirror s) { @@ -788,9 +792,9 @@ public final class TypeOps { return Convertibility.SUBTYPING; } if (isTypeRange(s)) { - return isConvertible(t, lowerBoundRec(s)); + return isConvertible(t, lowerBoundRec(s), true, pure); } - return isConvertible(t.getUpperBound(), s); + return isConvertible(t.getUpperBound(), s, true, pure); } @Override @@ -810,8 +814,10 @@ public final class TypeOps { if (s == t.getTypeSystem().NULL_TYPE || s instanceof JPrimitiveType) { return Convertibility.NEVER; } - // here we add a constraint on the variable - t.addBound(BoundKind.UPPER, s); + if (!pure) { + // here we add a constraint on the variable + t.addBound(BoundKind.UPPER, s); + } return Convertibility.SUBTYPING; } @@ -840,7 +846,7 @@ public final class TypeOps { // a raw type C is a supertype for all the family of parameterized type generated by C return Convertibility.SUBTYPING; } else { - return typeArgsAreContained(superDecl, cs); + return typeArgsAreContained(superDecl, cs, pure); } } @@ -864,7 +870,7 @@ public final class TypeOps { // what we mean is, if S is an intersection, then // "any component of T subtypes any component of S" - return Convertibility.anySubTypesAny(t.getComponents(), asList(s)); + return Convertibility.anySubTypesAny(t.getComponents(), asList(s), pure); } @Override @@ -885,7 +891,7 @@ public final class TypeOps { // arrays of primitive types have no sub-/ supertype return Convertibility.subtypeIf(cs.getComponentType() == t.getComponentType()); } else { - return isConvertible(t.getComponentType(), cs.getComponentType()); + return isConvertible(t.getComponentType(), cs.getComponentType(), true, pure); } } @@ -1739,7 +1745,7 @@ public final class TypeOps { for (JTypeMirror v : set) { for (JTypeMirror w : set) { if (!w.equals(v) && !hasUnresolvedSymbol(w)) { - Convertibility isConvertible = isSubtypePure(w, v); + Convertibility isConvertible = isConvertiblePure(w, v); if (isConvertible.bySubtyping() // This last case covers unchecked conversion. It is made antisymmetric by the // test for a symbol. eg |G| <~> G so it would fail. diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java index ab467fcce5..dfda211282 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java @@ -13,6 +13,7 @@ import net.sourceforge.pmd.lang.java.symbols.JClassSymbol; import net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol; import net.sourceforge.pmd.lang.java.types.InternalApiBridge; import net.sourceforge.pmd.lang.java.types.JTypeMirror; +import net.sourceforge.pmd.lang.java.types.TypeOps; import net.sourceforge.pmd.lang.java.types.TypeOps.Convertibility; import net.sourceforge.pmd.lang.java.types.internal.infer.InferenceVar.BoundKind; @@ -38,66 +39,6 @@ abstract class IncorporationAction { abstract void apply(InferenceContext ctx); - /** - * Check that an upper bound with a class (not interface) or array - * is compatible with other upper bounds of class or array type. - * This is necessary to guarantee the existence of a glb for these, - * for {@link ReductionStep#UPPER}. - * - *

    If the bound is {@code alpha <: T}, then we must check - * that {@code S <: T} or {@code T <: S} holds for all bounds - * {@code alpha <: S}, where S is a class or array type. Otherwise, - * the GLB does not exist. - */ - static class CheckClassUpperBound extends IncorporationAction { - - private final JTypeMirror myBound; - - CheckClassUpperBound(InferenceVar ivar, JTypeMirror bound) { - super(ivar); - this.myBound = bound; - } - - public static boolean needsCheck(BoundKind kind, JTypeMirror bound) { - if (kind == BoundKind.UPPER) { - JTypeDeclSymbol symbol = bound.getSymbol(); - return symbol instanceof JClassSymbol && !symbol.isInterface(); - } - return false; - } - - - @Override - public void apply(InferenceContext ctx) { - for (BoundKind k : BoundKind.EQ_UPPER) { - for (JTypeMirror b : ivar.getBounds(k)) { - if (!checkBound(b, ctx)) { - throw ResolutionFailedException.incompatibleBound(ctx.logger, ivar, BoundKind.UPPER, myBound, k, b); - } - } - } - } - - private boolean checkBound(JTypeMirror otherBound, InferenceContext ctx) { - - JTypeDeclSymbol sym = otherBound.getSymbol(); - // either the bound is not a concrete class or array type - return !(sym instanceof JClassSymbol) || sym.isInterface() - // or both bounds are related in some way - || CheckBound.checkBound(false, otherBound, myBound, ctx) - || CheckBound.checkBound(false, myBound, otherBound, ctx); - - } - - - @Override - public String toString() { - return "Check class bound " + BoundKind.UPPER.format(ivar, myBound); - } - - - } - /** * Check that a bound is compatible with the other current bounds * of an ivar. @@ -113,6 +54,11 @@ abstract class IncorporationAction { this.myBound = bound; } + public static boolean isClassType(JTypeMirror bound) { + JTypeDeclSymbol symbol = bound.getSymbol(); + return symbol instanceof JClassSymbol && !symbol.isInterface(); + } + /** * The list of bound kinds to be checked. If the new bound is * equality, then all other bounds need to be checked. Otherwise, @@ -132,8 +78,26 @@ abstract class IncorporationAction { } } } + + if (myKind == BoundKind.UPPER && isClassType(myBound)) { + // Check that other upper bounds that are class types are related to this bound. + // Otherwise, GLB does not exist and its construction would fail during ReductionStep#UPPER. + for (JTypeMirror otherBound : ivar.getBounds(BoundKind.UPPER)) { + if (otherBound != myBound && isClassType(otherBound)) { + // Since we are testing both directions we cannot let those tests add bounds on the ivars, + // because they could be contradictory. + boolean areRelated = TypeOps.isConvertiblePure(myBound, otherBound).somehow() + || TypeOps.isConvertiblePure(otherBound, myBound).somehow(); + + if (!areRelated) { + throw ResolutionFailedException.incompatibleBound(ctx.logger, ivar, myKind, myBound, BoundKind.UPPER, otherBound); + } + } + } + } } + /** * Check compatibility between this bound and another. */ diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceContext.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceContext.java index 12698d1d5c..4a979dec0e 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceContext.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/InferenceContext.java @@ -33,7 +33,6 @@ import net.sourceforge.pmd.lang.java.types.TypeOps; import net.sourceforge.pmd.lang.java.types.TypeSystem; import net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror.InvocationMirror.MethodCtDecl; import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.CheckBound; -import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.CheckClassUpperBound; import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.PropagateAllBounds; import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.PropagateBounds; import net.sourceforge.pmd.lang.java.types.internal.infer.IncorporationAction.SubstituteInst; @@ -389,9 +388,6 @@ final class InferenceContext { incorporationActions.add(new CheckBound(ivar, kind, bound)); incorporationActions.add(new PropagateBounds(ivar, kind, bound)); - if (CheckClassUpperBound.needsCheck(kind, bound)) { - incorporationActions.add(new CheckClassUpperBound(ivar, bound)); - } } } diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TestUtilitiesForTypes.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TestUtilitiesForTypes.kt index af662f19e1..2cd3888ae8 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TestUtilitiesForTypes.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TestUtilitiesForTypes.kt @@ -168,7 +168,7 @@ fun assertSubtypeOrdering(vararg ts: JTypeMirror) { fun JClassType.parameterize(m1: JTypeMirror, vararg mirror: JTypeMirror): JClassType = withTypeArguments(listOf(m1, *mirror)) fun assertSubtype(t: JTypeMirror, s: JTypeMirror, capture: Boolean = true, passes: Convertibility.() -> Boolean) { - val res = isConvertible(t, s, capture) + val res = isConvertible(t, s, capture, true) assertTrue("$t \n\t\t<: $s") { res.passes() } diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt index c8cd940c47..cfdc9d9f1d 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/PolyResolutionTest.kt @@ -392,4 +392,25 @@ class Scratch { call shouldHaveType gen.`t_Stream{Number}` } } + + parserTest("Test bound checks does not throw concurrent mod exception") { + + val (acu, spy) = parser.parseWithTypeInferenceSpy(""" + import java.util.stream.Stream; + class Enum> {} + class EnumSet> { + public static > EnumSet noneOf(Class elementType) { + Enum[] universe = getUniverse(elementType); + } + private static > U[] getUniverse(Class elementType) {} + } + """) + + val call = acu.firstMethodCall() + val xVar = acu.typeVar("X") + + spy.shouldBeOk { + call shouldHaveType xVar.toArray() + } + } }) From 895cfbf266e11e37d4832f6d80a4f97730f88547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 2 May 2024 13:05:04 -0300 Subject: [PATCH 132/142] Update docs/pages/release_notes.md Co-authored-by: Andreas Dangel --- docs/pages/release_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 31376368ca..48fcdb3745 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -18,7 +18,7 @@ This is a {{ site.pmd.release_type }} release. Up to now, all AST node getters would be exposed to XPath, as long as the return type was a primitive (boxed or unboxed), String or Enum. That meant that collections, even of these basic types, were not exposed, so for instance accessing Apex's `ASTUserClass.getInterfaceNames()` to list the interfaces implemented by a class was impossible from XPath, and would require writing a Java rule to check it. -Since this release, PMD will also expose any getter returning a collection of any supported type as a sequence through an XPath attribute. They would require to use apropriate XQuery functions to manipulate the sequence. So for instance, to detect any given `ASTUserClass` that implements `Queueable`, it is now possible to write: +Since this release, PMD will also expose any getter returning a collection of any supported type as a sequence through an XPath attribute. They would require to use apropriate XQuery functions to manipulate the sequence. So for instance, to detect any given `ASTUserClass` in Apex that implements `Queueable`, it is now possible to write: ```xml /UserClass[@InterfaceNames = 'Queueable'] From 6fd230e7aa69378f7a784d788c0529c683b3c292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 2 May 2024 13:05:17 -0300 Subject: [PATCH 133/142] Update docs/pages/release_notes.md Co-authored-by: Andreas Dangel --- docs/pages/release_notes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 48fcdb3745..e3a92cbf6b 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -25,7 +25,8 @@ Since this release, PMD will also expose any getter returning a collection of an ``` ### 🐛 Fixed Issues - +* core + * [#4467](https://github.com/pmd/pmd/issues/4467): \[core] Expose collections from getters as XPath sequence attributes * java-bestpractices * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4975](https://github.com/pmd/pmd/issues/4975): \[java] UnusedPrivateMethod false positive when using @MethodSource on a @Nested test From 199591bbd81056d440ade3f5bbbf2e6c8476d4ed Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 3 May 2024 19:47:22 +0200 Subject: [PATCH 134/142] [doc] Update about PMD sections Refs #4842 --- README.md | 22 ++++++++++------------ docs/index.md | 20 +++++++++++++++----- pom.xml | 18 ++++++++++-------- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 43c3df58a1..f0749994fa 100644 --- a/README.md +++ b/README.md @@ -11,22 +11,20 @@ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md) [![Documentation (latest)](https://img.shields.io/badge/docs-latest-green)](https://docs.pmd-code.org/latest/) -**PMD** is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, -unnecessary object creation, and so forth. It supports many languages. It can be extended with custom rules. -It uses JavaCC and Antlr to parse source files into abstract syntax trees (AST) and runs rules against them to find violations. -Rules can be written in Java or using a XPath query. +**PMD** is an extensible multilanguage static code analyzer. It finds common programming flaws like unused variables, +empty catch blocks, unnecessary object creation, and so forth. It's mainly concerned with **Java and +Apex**, but **supports 16 other languages**. It comes with **400+ built-in rules**. It can be +extended with custom rules. It uses JavaCC and Antlr to parse source files into abstract syntax trees +(AST) and runs rules against them to find violations. Rules can be written in Java or using a XPath query. -It supports Java, JavaScript, Salesforce.com Apex and Visualforce, -Modelica, PLSQL, Apache Velocity, HTML, XML and XSL. +Currently, PMD supports Java, JavaScript, Salesforce.com Apex and Visualforce, +Kotlin, Swift, Modelica, PLSQL, Apache Velocity, JSP, WSDL, Maven POM, HTML, XML and XSL. Scala is supported, but there are currently no Scala rules available. Additionally, it includes **CPD**, the copy-paste-detector. CPD finds duplicated code in -C/C++, C#, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Kotlin, Lua, Matlab, Modelica, -Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex and Visualforce, Scala, Swift, T-SQL, -Apache Velocity, and XML. - -In the future we hope to add support for data/control flow analysis and automatic (quick) fixes where -it makes sense. +Coco, C/C++, C#, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Julia, Kotlin, +Lua, Matlab, Modelica, Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex and +Visualforce, Scala, Swift, T-SQL, Typescript, Apache Velocity, WSDL, XML and XSL. ## 🚀 Installation and Usage diff --git a/docs/index.md b/docs/index.md index 2a9eb9fed0..3bafc43f4d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -24,10 +24,20 @@ additional_js: -**PMD** is a static source code analyzer. It finds common programming flaws like -unused variables, empty catch blocks, unnecessary object creation, and -so forth. It's mainly concerned with **Java and Apex**, but **supports 16 other -languages**. +**PMD** is an extensible multilanguage static code analyzer. It finds common programming flaws like unused variables, +empty catch blocks, unnecessary object creation, and so forth. It's mainly concerned with **Java and +Apex**, but **supports 16 other languages**. It comes with **400+ built-in rules**. It can be +extended with custom rules. It uses JavaCC and Antlr to parse source files into abstract syntax trees +(AST) and runs rules against them to find violations. Rules can be written in Java or using a XPath query. + +Currently, PMD supports Java, JavaScript, Salesforce.com Apex and Visualforce, +Kotlin, Swift, Modelica, PLSQL, Apache Velocity, JSP, WSDL, Maven POM, HTML, XML and XSL. +Scala is supported, but there are currently no Scala rules available. + +Additionally, it includes **CPD**, the copy-paste-detector. CPD finds duplicated code in +Coco, C/C++, C#, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Julia, Kotlin, +Lua, Matlab, Modelica, Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex and +Visualforce, Scala, Swift, T-SQL, Typescript, Apache Velocity, WSDL, XML and XSL. PMD features many **built-in checks** (in PMD lingo, *rules*), which are documented for each language in our [Rule references](#shuffle-panel-rule-references). We @@ -43,7 +53,7 @@ things, PMD can be run: * As a [bld operation](pmd_userdocs_tools_bld.html) * From [command-line](pmd_userdocs_installation.html#running-pmd-via-command-line) -**CPD**, the **copy-paste detector**, is also distributed with PMD. You can also use it +**CPD**, the **copy-paste detector**, is also distributed with PMD. You can use it in a variety of ways, which are [documented here](pmd_userdocs_cpd.html). ## 💾 Download diff --git a/pom.xml b/pom.xml index 11d7bef738..f3bab7a3e4 100644 --- a/pom.xml +++ b/pom.xml @@ -8,18 +8,20 @@ PMD - PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, - unnecessary object creation, and so forth. It supports many languages. It can be extended with custom rules. - It uses JavaCC and Antlr to parse source files into abstract syntax trees (AST) and runs rules against them to find violations. - Rules can be written in Java or using a XPath query. + PMD is an extensible multilanguage static code analyzer. It finds common programming flaws like unused variables, + empty catch blocks, unnecessary object creation, and so forth. It's mainly concerned with Java and + Apex, but supports 16 other languages. It comes with 400+ built-in rules. It can be + extended with custom rules. It uses JavaCC and Antlr to parse source files into abstract syntax trees + (AST) and runs rules against them to find violations. Rules can be written in Java or using a XPath query. - It supports Java, JavaScript, Salesforce.com Apex and Visualforce, - Kotlin, Swift, Modelica, PLSQL, Apache Velocity, JSP, WSDL, HTML, XML and XSL. + Currently, PMD supports Java, JavaScript, Salesforce.com Apex and Visualforce, + Kotlin, Swift, Modelica, PLSQL, Apache Velocity, JSP, WSDL, Maven POM, HTML, XML and XSL. Scala is supported, but there are currently no Scala rules available. Additionally, it includes CPD, the copy-paste-detector. CPD finds duplicated code in - Coco, C/C++, C#, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Julia, Kotlin, Lua, Matlab, Modelica, - Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex and Visualforce, Scala, Swift, T-SQL, Typescript and XML. + Coco, C/C++, C#, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Julia, Kotlin, + Lua, Matlab, Modelica, Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex and + Visualforce, Scala, Swift, T-SQL, Typescript, Apache Velocity, WSDL, XML and XSL. https://pmd.github.io/ From 516b305e502d075ce3c3f4d5a12977606934ed0a Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 3 May 2024 19:57:57 +0200 Subject: [PATCH 135/142] [doc] Fix links in README.md [skip ci] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f0749994fa..a08c66d76c 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ [![Join the chat](https://img.shields.io/gitter/room/pmd/pmd)](https://app.gitter.im/#/room/#pmd_pmd:gitter.im?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://github.com/pmd/pmd/workflows/build/badge.svg?branch=master)](https://github.com/pmd/pmd/actions) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd) -[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central#net.sourceforge.pmd:pmd) +[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central/tree/master/content/net/sourceforge/pmd#readme) [![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd) -[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea550046a02344ec850553476c4aa2ca)](https://www.codacy.com/gh/pmd/pmd/dashboard?utm_source=github.com&utm_medium=referral&utm_content=pmd/pmd&utm_campaign=Badge_Grade) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea550046a02344ec850553476c4aa2ca)](https://app.codacy.com/organizations/gh/pmd/dashboard) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md) [![Documentation (latest)](https://img.shields.io/badge/docs-latest-green)](https://docs.pmd-code.org/latest/) From ef19659cb67ed087878c1d860df7b009c82855d5 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 3 May 2024 20:26:05 +0200 Subject: [PATCH 136/142] [ci] Only run PMD twice instead of three times during build pmd:check executes implicitly pmd:pmd, but with the default configuration. For execution "pmd-test" this means, we called pmd:pmd twice: Once within "pmd-test" to check test code and once more via pmd:check, but against the main code. Skipping now the default configuration always and explicitly call pmd:pmd in the two executions. Thanks @uhafner for the idea. --- pom.xml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index f3bab7a3e4..e5b7e66827 100644 --- a/pom.xml +++ b/pom.xml @@ -506,9 +506,22 @@ pmd-main verify + pmd check + cpd cpd-check + + ${pmd.skip} + 100 + + /net/sourceforge/pmd/pmd-dogfood-config.xml + + + target/generated-sources/javacc + target/generated-sources/antlr4 + + pmd-test @@ -518,6 +531,7 @@ check + ${pmd.skip} ${project.build.directory}/pmdTest/ true @@ -528,19 +542,15 @@ false - 100 1.${java.version} - - /net/sourceforge/pmd/pmd-dogfood-config.xml - - - target/generated-sources/javacc - target/generated-sources/antlr4 - false 2 true true + + true From b2a1ef714fc8d8a36afef88c94a99e83a7dbe8bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 6 May 2024 12:03:38 +0200 Subject: [PATCH 137/142] Fix PMD warning --- .../pmd/lang/java/types/internal/infer/IncorporationAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java index dfda211282..cc9bc4f9ec 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java @@ -83,7 +83,7 @@ abstract class IncorporationAction { // Check that other upper bounds that are class types are related to this bound. // Otherwise, GLB does not exist and its construction would fail during ReductionStep#UPPER. for (JTypeMirror otherBound : ivar.getBounds(BoundKind.UPPER)) { - if (otherBound != myBound && isClassType(otherBound)) { + if (otherBound != myBound && isClassType(otherBound)) { // NOPMD CompareObjectsWithEquals // Since we are testing both directions we cannot let those tests add bounds on the ivars, // because they could be contradictory. boolean areRelated = TypeOps.isConvertiblePure(myBound, otherBound).somehow() From 788b07ba14cd14204e936381e3b5286674eb5c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 6 May 2024 12:23:08 +0200 Subject: [PATCH 138/142] Move methods in order to avoid carrying around the pure parameter which is error-prone --- .../pmd/lang/java/types/TypeOps.java | 439 +++++++++--------- .../lang/java/types/TestUtilitiesForTypes.kt | 9 +- 2 files changed, 226 insertions(+), 222 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java index 0f8a12f38f..593ce994c9 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java @@ -79,7 +79,7 @@ public final class TypeOps { * of {@link JTypeMirror}. */ public static boolean isSameType(JTypeMirror t, JTypeMirror s) { - return isSameType(t, s, false, false); + return isSameType(t, s, true, false); } /** @@ -87,7 +87,7 @@ public final class TypeOps { * appearing within them. */ public static boolean isSameTypeWithSameAnnotations(JTypeMirror t, JTypeMirror s) { - return isSameType(t, s, false, true); + return isSameType(t, s, true, true); } /** @@ -97,7 +97,7 @@ public final class TypeOps { * @apiNote Internal API */ static boolean isSameTypeInInference(JTypeMirror t, JTypeMirror s) { - return isSameType(t, s, true, false); + return isSameType(t, s, false, false); } /** @@ -105,7 +105,7 @@ public final class TypeOps { * true, then encountering inference variables produces side effects * on them, adding bounds. */ - private static boolean isSameType(JTypeMirror t, JTypeMirror s, boolean inInference, boolean considerAnnotations) { + private static boolean isSameType(JTypeMirror t, JTypeMirror s, boolean pure, boolean considerAnnotations) { if (t == s) { // also returns true if both t and s are null return true; @@ -115,7 +115,7 @@ public final class TypeOps { return false; } - if (!inInference) { + if (pure) { if (considerAnnotations) { if (t instanceof CaptureMatcher || s instanceof CaptureMatcher) { return t.equals(s); // skip check for type annotations @@ -156,7 +156,7 @@ public final class TypeOps { return false; } for (int i = 0; i < ts.size(); i++) { - if (!isSameType(ts.get(i), ss.get(i).subst(subst), inInference, considerAnnotations)) { + if (!isSameType(ts.get(i), ss.get(i).subst(subst), !inInference, considerAnnotations)) { return false; } } @@ -195,7 +195,7 @@ public final class TypeOps { JClassType s2 = (JClassType) s; return t.getSymbol().equals(s2.getSymbol()) // maybe compare the type system as well. && t.hasErasedSuperTypes() == s2.hasErasedSuperTypes() - && isSameType(t.getEnclosingType(), s2.getEnclosingType(), inInference, considerAnnotations) + && isSameType(t.getEnclosingType(), s2.getEnclosingType(), !inInference, considerAnnotations) && areSameTypes(t.getTypeArgs(), s2.getTypeArgs(), inInference, considerAnnotations); } return false; @@ -212,7 +212,7 @@ public final class TypeOps { return false; } JWildcardType s2 = (JWildcardType) s; - return s2.isUpperBound() == t.isUpperBound() && isSameType(t.getBound(), s2.getBound(), inInference, considerAnnotations); + return s2.isUpperBound() == t.isUpperBound() && isSameType(t.getBound(), s2.getBound(), !inInference, considerAnnotations); } @Override @@ -254,7 +254,7 @@ public final class TypeOps { return false; } - if (!isSameType(t.getPrimaryBound(), s2.getPrimaryBound(), inInference, considerAnnotations)) { + if (!isSameType(t.getPrimaryBound(), s2.getPrimaryBound(), !inInference, considerAnnotations)) { return false; } @@ -263,7 +263,7 @@ public final class TypeOps { boolean found = false; for (JTypeMirror si : sComps) { // todo won't this behaves weirdly during inference? test it - if (isSameType(ti, si, inInference, considerAnnotations)) { + if (isSameType(ti, si, !inInference, considerAnnotations)) { found = true; break; } @@ -278,7 +278,7 @@ public final class TypeOps { @Override public Boolean visitArray(JArrayType t, JTypeMirror s) { return s instanceof JArrayType - && isSameType(t.getComponentType(), ((JArrayType) s).getComponentType(), inInference, considerAnnotations); + && isSameType(t.getComponentType(), ((JArrayType) s).getComponentType(), !inInference, considerAnnotations); } } @@ -398,84 +398,16 @@ public final class TypeOps { public static Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s) { - return isConvertible(t, s, true, false); + return SubtypeVisitor.INFERENCE.isConvertible(t, s); } - @Deprecated // unused public static Convertibility isConvertibleNoCapture(@NonNull JTypeMirror t, @NonNull JTypeMirror s) { - return isConvertible(t, s, false, false); + return SubtypeVisitor.PURE.isConvertible(t, s, false); } // does not perform side effects on inference vars public static Convertibility isConvertiblePure(JTypeMirror t, JTypeMirror s) { - return isConvertible(t, s, true, true); - } - - /** - * Returns whether if {@code T <: S}, ie T is a subtype of S. - * - *

    Note that {@link TypeSystem#ERROR} and {@link TypeSystem#UNKNOWN} - * are considered subtypes of anything. - * - * @param t A type T - * @param s A type S - */ - public static Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s, boolean capture, boolean pure) { - // This is commented out as it makes JTypeMirror#isSubtypeOf partial, - // which is not nice for the API... But this assert caught a bug and - // should probably be enabled. - // assert !(t instanceof JWildcardType || s instanceof JWildcardType) : "Wildcards do not support subtyping"; - - if (t == s) { - Objects.requireNonNull(t); - return Convertibility.SUBTYPING; - } else if (s.isTop()) { - return Convertibility.subtypeIf(!t.isPrimitive()); - } else if (s.isVoid() || t.isVoid()) { // t != s - return Convertibility.NEVER; - } else if (s instanceof InferenceVar) { - if (!pure) { - // it's possible to add a bound to UNKNOWN or ERROR - ((InferenceVar) s).addBound(BoundKind.LOWER, t); - } - return Convertibility.SUBTYPING; - } else if (isTypeRange(s)) { - // If s is a type range L..U, - // then showing t <: s is the same thing as t <: L - JTypeMirror lower = lowerBoundRec(s); - if (!lower.isBottom()) { - return isConvertible(t, lower, capture, pure); - } - // otherwise fallthrough - } else if (isSpecialUnresolved(t)) { - // error type or unresolved type is subtype of everything - if (s instanceof JArrayType) { - // In case the array has an ivar 'a as element type, a bound will be added 'a >: (*unknown*) - // This helps inference recover in call chains and propagate the (*unknown*) types gracefully. - return isConvertible(t, ((JArrayType) s).getElementType()); - } - return Convertibility.SUBTYPING; - } else if (hasUnresolvedSymbol(t) && t instanceof JClassType) { - // This also considers types with an unresolved symbol - // subtypes of (nearly) anything. This allows them to - // pass bound checks on type variables. - if (Objects.equals(t.getSymbol(), s.getSymbol())) { - return typeArgsAreContained((JClassType) t, (JClassType) s, pure); - } else { - return Convertibility.subtypeIf(s instanceof JClassType); // excludes array or so - } - } else if (s instanceof JIntersectionType) { // TODO test intersection with tvars & arrays - // If S is an intersection, then T must conform to *all* bounds of S - // Symmetrically, if T is an intersection, T <: S requires only that - // at least one bound of T is a subtype of S. - return Convertibility.subtypesAll(t, asList(s), pure); - } - - if (capture) { - t = capture(t); - } - SubtypeVisitor visitor = pure ? SubtypeVisitor.PURE : SubtypeVisitor.INSTANCE; - return t.acceptVisitor(visitor, s); + return SubtypeVisitor.PURE.isConvertible(t, s); } public static boolean allArgsAreUnboundedWildcards(List sargs) { @@ -604,29 +536,6 @@ public final class TypeOps { return b ? SUBTYPING : NEVER; } - static Convertibility subtypesAll(JTypeMirror t, Iterable supers, boolean pure) { - Convertibility result = SUBTYPING; - for (JTypeMirror ui : supers) { - Convertibility sub = isConvertible(t, ui, true, pure); - if (sub == NEVER) { - return NEVER; - } - result = result.and(sub); - } - return result; - } - - static Convertibility anySubTypesAny(Iterable us, Iterable vs, boolean pure) { - for (JTypeMirror ui : us) { - for (JTypeMirror vi : vs) { - Convertibility sub = isConvertible(ui, vi, true, pure); - if (sub != NEVER) { - return sub.and(SUBTYPING); // never return identity here - } - } - } - return NEVER; - } } private static JTypeMirror wildUpperBound(JTypeMirror type) { @@ -669,116 +578,9 @@ public final class TypeOps { } - /** - * Returns true if {@code T <= S}, ie "S contains T". - * - *

    S contains T if: - * - *

    {@code L(S) <: L(T) && U(T) <: U(S)} - * - *

    This only makes sense for type arguments, it's a component of - * subtype checks for parameterized types: - * - *

    {@code C <: C if S <= T} - * - *

    Defined in JLS§4.5.1 (Type Arguments of Parameterized Types) - */ - static Convertibility typeArgContains(JTypeMirror s, JTypeMirror t, boolean pure) { - // the contains relation can be understood intuitively if we - // represent types as ranges on a line: - - // ⊥ ---------L(S)---L(T)------U(T)-----U(S)---> Object - // range of S [-------------------------] - // range of T [---------] - - // here S contains T because its range is greater - - // since a wildcard is either "super" or "extends", in reality - // either L(S) = ⊥, or U(S) = Object. - - // meaning when S != T, we only have two scenarios where T <= S: - - // ⊥ -------U(T)-----U(S)------> Object (L(T) = L(S) = ⊥) - // ⊥ -------L(S)-----L(T)------> Object (U(T) = U(S) = Object) - - if (isSameType(s, t, !pure, false)) { - // S <= S - return Convertibility.SUBTYPING; - } - - if (s instanceof JWildcardType) { - JWildcardType sw = (JWildcardType) s; - - // capt(? extends T) <= ? extends T - // capt(? super T) <= ? super T - if (t instanceof JTypeVar && ((JTypeVar) t).isCaptureOf(sw)) { - return Convertibility.SUBTYPING; - } - - if (sw.isUpperBound()) { - // Test U(T) <: U(S), we already know L(S) <: L(T), because L(S) is bottom - return isConvertible(wildUpperBound(t), sw.asUpperBound(), pure, false); - } else { - // Test L(S) <: L(T), we already know U(T) <: U(S), because U(S) is top - return isConvertible(sw.asLowerBound(), wildLowerBound(t), pure, false); - } - } - - return Convertibility.NEVER; - } - - - /** - * Generalises containment to check if for each i, {@code Ti <= Si}. - */ - static Convertibility typeArgsAreContained(JClassType t, JClassType s, boolean pure) { - List targs = t.getTypeArgs(); - List sargs = s.getTypeArgs(); - - if (targs.isEmpty()) { - if (sargs.isEmpty()) { - // Some "erased" non-generic types may appear as the supertypes - // of raw types, and they're different from the regular flavor - // as their own supertypes are erased, yet they're not considered - // raw. To fix the subtyping relation, we say that `C <: (erased) C` - // but `(erased) C` converts to `C` by unchecked conversion, without - // warning. - boolean tRaw = t.hasErasedSuperTypes(); - boolean sRaw = s.hasErasedSuperTypes(); - if (tRaw && !sRaw) { - return Convertibility.UNCHECKED_NO_WARNING; - } else { - return Convertibility.SUBTYPING; - } - } - // for some C, S = C<...> and T = C, ie T is raw - // T is convertible to S, by unchecked conversion. - // If S = D, then the conversion produces - // no unchecked warning. - return allArgsAreUnboundedWildcards(sargs) ? Convertibility.UNCHECKED_NO_WARNING - : Convertibility.UNCHECKED_WARNING; - } - - if (targs.size() != sargs.size()) { - // types are not well-formed - return Convertibility.NEVER; - } - - Convertibility result = Convertibility.SUBTYPING; - for (int i = 0; i < targs.size(); i++) { - Convertibility sub = typeArgContains(sargs.get(i), targs.get(i), pure); - if (sub == Convertibility.NEVER) { - return Convertibility.NEVER; - } - result = result.and(sub); - } - - return result; - } - private static final class SubtypeVisitor implements JTypeVisitor { - static final SubtypeVisitor INSTANCE = new SubtypeVisitor(false); + static final SubtypeVisitor INFERENCE = new SubtypeVisitor(false); static final SubtypeVisitor PURE = new SubtypeVisitor(true); private final boolean pure; @@ -786,6 +588,207 @@ public final class TypeOps { this.pure = pure; } + + Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s) { + return isConvertible(t, s, true); + } + + /** + * Returns whether if {@code T <: S}, ie T is a subtype of S. + * + *

    Note that {@link TypeSystem#ERROR} and {@link TypeSystem#UNKNOWN} + * are considered subtypes of anything. + * + * @param t A type T + * @param s A type S + */ + Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s, boolean capture) { + // This is commented out as it makes JTypeMirror#isSubtypeOf partial, + // which is not nice for the API... But this assert caught a bug and + // should probably be enabled. + // assert !(t instanceof JWildcardType || s instanceof JWildcardType) : "Wildcards do not support subtyping"; + + if (t == s) { + Objects.requireNonNull(t); + return Convertibility.SUBTYPING; + } else if (s.isTop()) { + return Convertibility.subtypeIf(!t.isPrimitive()); + } else if (s.isVoid() || t.isVoid()) { // t != s + return Convertibility.NEVER; + } else if (s instanceof InferenceVar) { + if (!pure) { + // it's possible to add a bound to UNKNOWN or ERROR + ((InferenceVar) s).addBound(BoundKind.LOWER, t); + } + return Convertibility.SUBTYPING; + } else if (isTypeRange(s)) { + // If s is a type range L..U, + // then showing t <: s is the same thing as t <: L + JTypeMirror lower = lowerBoundRec(s); + if (!lower.isBottom()) { + return isConvertible(t, lower); + } + // otherwise fallthrough + } else if (isSpecialUnresolved(t)) { + // error type or unresolved type is subtype of everything + if (s instanceof JArrayType) { + // In case the array has an ivar 'a as element type, a bound will be added 'a >: (*unknown*) + // This helps inference recover in call chains and propagate the (*unknown*) types gracefully. + return TypeOps.isConvertible(t, ((JArrayType) s).getElementType()); + } + return Convertibility.SUBTYPING; + } else if (hasUnresolvedSymbol(t) && t instanceof JClassType) { + // This also considers types with an unresolved symbol + // subtypes of (nearly) anything. This allows them to + // pass bound checks on type variables. + if (Objects.equals(t.getSymbol(), s.getSymbol())) { + return typeArgsAreContained((JClassType) t, (JClassType) s); + } else { + return Convertibility.subtypeIf(s instanceof JClassType); // excludes array or so + } + } else if (s instanceof JIntersectionType) { // TODO test intersection with tvars & arrays + // If S is an intersection, then T must conform to *all* bounds of S + // Symmetrically, if T is an intersection, T <: S requires only that + // at least one bound of T is a subtype of S. + return subtypesAll(t, asList(s)); + } + + if (capture) { + t = capture(t); + } + return t.acceptVisitor(this, s); + } + + Convertibility subtypesAll(JTypeMirror t, Iterable supers) { + Convertibility result = Convertibility.SUBTYPING; + for (JTypeMirror ui : supers) { + Convertibility sub = isConvertible(t, ui); + if (sub == Convertibility.NEVER) { + return Convertibility.NEVER; + } + result = result.and(sub); + } + return result; + } + + Convertibility anySubTypesAny(Iterable us, Iterable vs) { + for (JTypeMirror ui : us) { + for (JTypeMirror vi : vs) { + Convertibility sub = isConvertible(ui, vi); + if (sub != Convertibility.NEVER) { + return sub.and(Convertibility.SUBTYPING); // never return identity here + } + } + } + return Convertibility.NEVER; + } + + /** + * Generalises containment to check if for each i, {@code Ti <= Si}. + */ + Convertibility typeArgsAreContained(JClassType t, JClassType s) { + List targs = t.getTypeArgs(); + List sargs = s.getTypeArgs(); + + if (targs.isEmpty()) { + if (sargs.isEmpty()) { + // Some "erased" non-generic types may appear as the supertypes + // of raw types, and they're different from the regular flavor + // as their own supertypes are erased, yet they're not considered + // raw. To fix the subtyping relation, we say that `C <: (erased) C` + // but `(erased) C` converts to `C` by unchecked conversion, without + // warning. + boolean tRaw = t.hasErasedSuperTypes(); + boolean sRaw = s.hasErasedSuperTypes(); + if (tRaw && !sRaw) { + return Convertibility.UNCHECKED_NO_WARNING; + } else { + return Convertibility.SUBTYPING; + } + } + // for some C, S = C<...> and T = C, ie T is raw + // T is convertible to S, by unchecked conversion. + // If S = D, then the conversion produces + // no unchecked warning. + return allArgsAreUnboundedWildcards(sargs) ? Convertibility.UNCHECKED_NO_WARNING + : Convertibility.UNCHECKED_WARNING; + } + + if (targs.size() != sargs.size()) { + // types are not well-formed + return Convertibility.NEVER; + } + + Convertibility result = Convertibility.SUBTYPING; + for (int i = 0; i < targs.size(); i++) { + Convertibility sub = typeArgContains(sargs.get(i), targs.get(i)); + if (sub == Convertibility.NEVER) { + return Convertibility.NEVER; + } + result = result.and(sub); + } + + return result; + } + + /** + * Returns true if {@code T <= S}, ie "S contains T". + * + *

    S contains T if: + * + *

    {@code L(S) <: L(T) && U(T) <: U(S)} + * + *

    This only makes sense for type arguments, it's a component of + * subtype checks for parameterized types: + * + *

    {@code C <: C if S <= T} + * + *

    Defined in JLS§4.5.1 (Type Arguments of Parameterized Types) + */ + Convertibility typeArgContains(JTypeMirror s, JTypeMirror t) { + // the contains relation can be understood intuitively if we + // represent types as ranges on a line: + + // ⊥ ---------L(S)---L(T)------U(T)-----U(S)---> Object + // range of S [-------------------------] + // range of T [---------] + + // here S contains T because its range is greater + + // since a wildcard is either "super" or "extends", in reality + // either L(S) = ⊥, or U(S) = Object. + + // meaning when S != T, we only have two scenarios where T <= S: + + // ⊥ -------U(T)-----U(S)------> Object (L(T) = L(S) = ⊥) + // ⊥ -------L(S)-----L(T)------> Object (U(T) = U(S) = Object) + + if (isSameType(s, t, pure, false)) { + // S <= S + return Convertibility.SUBTYPING; + } + + if (s instanceof JWildcardType) { + JWildcardType sw = (JWildcardType) s; + + // capt(? extends T) <= ? extends T + // capt(? super T) <= ? super T + if (t instanceof JTypeVar && ((JTypeVar) t).isCaptureOf(sw)) { + return Convertibility.SUBTYPING; + } + + if (sw.isUpperBound()) { + // Test U(T) <: U(S), we already know L(S) <: L(T), because L(S) is bottom + return this.isConvertible(wildUpperBound(t), sw.asUpperBound()); + } else { + // Test L(S) <: L(T), we already know U(T) <: U(S), because U(S) is top + return this.isConvertible(sw.asLowerBound(), wildLowerBound(t)); + } + } + + return Convertibility.NEVER; + } + @Override public Convertibility visit(JTypeMirror t, JTypeMirror s) { throw new IllegalStateException("Should not be called"); @@ -797,9 +800,9 @@ public final class TypeOps { return Convertibility.SUBTYPING; } if (isTypeRange(s)) { - return isConvertible(t, lowerBoundRec(s), true, pure); + return isConvertible(t, lowerBoundRec(s)); } - return isConvertible(t.getUpperBound(), s, true, pure); + return isConvertible(t.getUpperBound(), s); } @Override @@ -851,7 +854,7 @@ public final class TypeOps { // a raw type C is a supertype for all the family of parameterized type generated by C return Convertibility.SUBTYPING; } else { - return typeArgsAreContained(superDecl, cs, pure); + return typeArgsAreContained(superDecl, cs); } } @@ -875,7 +878,7 @@ public final class TypeOps { // what we mean is, if S is an intersection, then // "any component of T subtypes any component of S" - return Convertibility.anySubTypesAny(t.getComponents(), asList(s), pure); + return anySubTypesAny(t.getComponents(), asList(s)); } @Override @@ -896,7 +899,7 @@ public final class TypeOps { // arrays of primitive types have no sub-/ supertype return Convertibility.subtypeIf(cs.getComponentType() == t.getComponentType()); } else { - return isConvertible(t.getComponentType(), cs.getComponentType(), true, pure); + return isConvertible(t.getComponentType(), cs.getComponentType()); } } diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TestUtilitiesForTypes.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TestUtilitiesForTypes.kt index 2cd3888ae8..9899f11226 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TestUtilitiesForTypes.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/TestUtilitiesForTypes.kt @@ -14,7 +14,8 @@ import net.sourceforge.pmd.lang.java.JavaParsingHelper import net.sourceforge.pmd.lang.java.ast.InvocationNode import net.sourceforge.pmd.lang.java.ast.TypeNode import net.sourceforge.pmd.lang.java.symbols.internal.asm.AsmSymbolResolver -import net.sourceforge.pmd.lang.java.types.TypeOps.* +import net.sourceforge.pmd.lang.java.types.TypeOps.Convertibility +import net.sourceforge.pmd.lang.java.types.TypeOps.isSameTypeWithSameAnnotations import net.sourceforge.pmd.lang.test.ast.shouldBe import net.sourceforge.pmd.lang.test.ast.shouldBeA import org.hamcrest.Description @@ -168,18 +169,18 @@ fun assertSubtypeOrdering(vararg ts: JTypeMirror) { fun JClassType.parameterize(m1: JTypeMirror, vararg mirror: JTypeMirror): JClassType = withTypeArguments(listOf(m1, *mirror)) fun assertSubtype(t: JTypeMirror, s: JTypeMirror, capture: Boolean = true, passes: Convertibility.() -> Boolean) { - val res = isConvertible(t, s, capture, true) + val res = if (capture) TypeOps.isConvertiblePure(t, s) else TypeOps.isConvertibleNoCapture(t, s) assertTrue("$t \n\t\t<: $s") { res.passes() } } infix fun JTypeMirror.shouldSubtypeNoCapture(s: JTypeMirror) { - assertSubtype(this, s, false) { bySubtyping() } + assertSubtype(this, s, capture = false) { bySubtyping() } } infix fun JTypeMirror.shouldNotSubtypeNoCapture(s: JTypeMirror) { - assertSubtype(this, s, false) { never() } + assertSubtype(this, s, capture = false) { never() } } infix fun JTypeMirror.shouldBeSubtypeOf(other: JTypeMirror) { From 62cc3b134918e526f1e1d802058d31a1533ab878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 6 May 2024 12:30:58 +0200 Subject: [PATCH 139/142] fix release notes --- docs/pages/release_notes.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 1a4e0417e7..c540dcfade 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,8 +16,14 @@ This is a {{ site.pmd.release_type }} release. ### 🐛 Fixed Issues +* core + * [#4978](https://github.com/pmd/pmd/issues/4978): \[core] Referenced Rulesets do not emit details on validation errors + * [#4983](https://github.com/pmd/pmd/pull/4983): \[cpd] Fix CPD crashes about unicode escapes * java + * [#4912](https://github.com/pmd/pmd/issues/4912): \[java] Unable to parse some Java9+ resource references + * [#4973](https://github.com/pmd/pmd/pull/4973): \[java] Stop parsing Java for CPD * [#4980](https://github.com/pmd/pmd/issues/4980): \[java] Bad intersection, unrelated class types java.lang.Object\[] and java.lang.Number + * [#4988](https://github.com/pmd/pmd/pull/4988): \[java] Fix impl of ASTVariableId::isResourceDeclaration / VariableId/@ResourceDeclaration * java-bestpractices * [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name * [#4852](https://github.com/pmd/pmd/issues/4852): \[java] ReplaceVectorWithList false-positive (neither Vector nor List usage) From a72f851514ffcfdd0e4d325815fbaf3d4987d52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 6 May 2024 12:33:40 +0200 Subject: [PATCH 140/142] Invert booleans --- .../pmd/lang/java/types/TypeOps.java | 44 +++++++++---------- .../internal/infer/IncorporationAction.java | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java index 593ce994c9..d494244994 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java @@ -136,27 +136,27 @@ public final class TypeOps { } public static boolean areSameTypes(List ts, List ss) { - return areSameTypes(ts, ss, EMPTY, false, false); - } - - public static boolean areSameTypesInInference(List ts, List ss) { return areSameTypes(ts, ss, EMPTY, true, false); } - private static boolean areSameTypes(List ts, List ss, boolean inInference, boolean considerAnnotations) { - return areSameTypes(ts, ss, EMPTY, inInference, considerAnnotations); + public static boolean areSameTypesInInference(List ts, List ss) { + return areSameTypes(ts, ss, EMPTY, false, false); + } + + private static boolean areSameTypes(List ts, List ss, boolean pure, boolean considerAnnotations) { + return areSameTypes(ts, ss, EMPTY, pure, considerAnnotations); } private static boolean areSameTypes(List ts, List ss, Substitution subst) { - return areSameTypes(ts, ss, subst, false, false); + return areSameTypes(ts, ss, subst, true, false); } - private static boolean areSameTypes(List ts, List ss, Substitution subst, boolean inInference, boolean considerAnnotations) { + private static boolean areSameTypes(List ts, List ss, Substitution subst, boolean pure, boolean considerAnnotations) { if (ts.size() != ss.size()) { return false; } for (int i = 0; i < ts.size(); i++) { - if (!isSameType(ts.get(i), ss.get(i).subst(subst), !inInference, considerAnnotations)) { + if (!isSameType(ts.get(i), ss.get(i).subst(subst), pure, considerAnnotations)) { return false; } } @@ -166,15 +166,15 @@ public final class TypeOps { // note that this does not take type annotations into account private static final class SameTypeVisitor implements JTypeVisitor { - static final SameTypeVisitor INFERENCE = new SameTypeVisitor(true, false); - static final SameTypeVisitor PURE = new SameTypeVisitor(false, false); - static final SameTypeVisitor PURE_WITH_ANNOTATIONS = new SameTypeVisitor(false, true); + static final SameTypeVisitor INFERENCE = new SameTypeVisitor(false, false); + static final SameTypeVisitor PURE = new SameTypeVisitor(true, false); + static final SameTypeVisitor PURE_WITH_ANNOTATIONS = new SameTypeVisitor(true, true); - private final boolean inInference; + private final boolean pure; private final boolean considerAnnotations; - private SameTypeVisitor(boolean inInference, boolean considerAnnotations) { - this.inInference = inInference; + private SameTypeVisitor(boolean pure, boolean considerAnnotations) { + this.pure = pure; this.considerAnnotations = considerAnnotations; } @@ -195,8 +195,8 @@ public final class TypeOps { JClassType s2 = (JClassType) s; return t.getSymbol().equals(s2.getSymbol()) // maybe compare the type system as well. && t.hasErasedSuperTypes() == s2.hasErasedSuperTypes() - && isSameType(t.getEnclosingType(), s2.getEnclosingType(), !inInference, considerAnnotations) - && areSameTypes(t.getTypeArgs(), s2.getTypeArgs(), inInference, considerAnnotations); + && isSameType(t.getEnclosingType(), s2.getEnclosingType(), pure, considerAnnotations) + && areSameTypes(t.getTypeArgs(), s2.getTypeArgs(), pure, considerAnnotations); } return false; } @@ -212,12 +212,12 @@ public final class TypeOps { return false; } JWildcardType s2 = (JWildcardType) s; - return s2.isUpperBound() == t.isUpperBound() && isSameType(t.getBound(), s2.getBound(), !inInference, considerAnnotations); + return s2.isUpperBound() == t.isUpperBound() && isSameType(t.getBound(), s2.getBound(), pure, considerAnnotations); } @Override public Boolean visitInferenceVar(InferenceVar t, JTypeMirror s) { - if (!inInference) { + if (pure) { return t == s; } @@ -254,7 +254,7 @@ public final class TypeOps { return false; } - if (!isSameType(t.getPrimaryBound(), s2.getPrimaryBound(), !inInference, considerAnnotations)) { + if (!isSameType(t.getPrimaryBound(), s2.getPrimaryBound(), pure, considerAnnotations)) { return false; } @@ -263,7 +263,7 @@ public final class TypeOps { boolean found = false; for (JTypeMirror si : sComps) { // todo won't this behaves weirdly during inference? test it - if (isSameType(ti, si, !inInference, considerAnnotations)) { + if (isSameType(ti, si, pure, considerAnnotations)) { found = true; break; } @@ -278,7 +278,7 @@ public final class TypeOps { @Override public Boolean visitArray(JArrayType t, JTypeMirror s) { return s instanceof JArrayType - && isSameType(t.getComponentType(), ((JArrayType) s).getComponentType(), !inInference, considerAnnotations); + && isSameType(t.getComponentType(), ((JArrayType) s).getComponentType(), pure, considerAnnotations); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java index cc9bc4f9ec..74e89636f1 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/IncorporationAction.java @@ -54,7 +54,7 @@ abstract class IncorporationAction { this.myBound = bound; } - public static boolean isClassType(JTypeMirror bound) { + private static boolean isClassType(JTypeMirror bound) { JTypeDeclSymbol symbol = bound.getSymbol(); return symbol instanceof JClassSymbol && !symbol.isInterface(); } From 3d4f165bbdd49f6b4048d387352abbfbb8736a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 6 May 2024 12:41:08 +0200 Subject: [PATCH 141/142] Add back removed method for compatibility --- .../java/net/sourceforge/pmd/lang/java/types/TypeOps.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java index d494244994..0398a5c2d8 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/TypeOps.java @@ -401,6 +401,11 @@ public final class TypeOps { return SubtypeVisitor.INFERENCE.isConvertible(t, s); } + @Deprecated // unused + public static Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s, boolean capture) { + return SubtypeVisitor.PURE.isConvertible(t, s, capture); + } + public static Convertibility isConvertibleNoCapture(@NonNull JTypeMirror t, @NonNull JTypeMirror s) { return SubtypeVisitor.PURE.isConvertible(t, s, false); } From e5f55c08a5b2fb31820bca04fb23416cdd884611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 10 May 2024 20:30:59 +0200 Subject: [PATCH 142/142] Add test case for #1160 --- .../xml/ConsecutiveAppendsShouldReuse.xml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/ConsecutiveAppendsShouldReuse.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/ConsecutiveAppendsShouldReuse.xml index 6f04e64778..863971af4b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/ConsecutiveAppendsShouldReuse.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/ConsecutiveAppendsShouldReuse.xml @@ -274,4 +274,29 @@ public class Foo { } ]]> + + FN within lambda #1160 + 1 + stream) { + return stream.reduce(new StringBuilder(1_000), (builder, string) -> { + switch (string) { + case "asd": + builder.append("asd"); + builder.append("qwe"); + break; + } + return builder; + }, (t, s) -> { + t.append(s); + return t; + }).toString(); + } + } + ]]> +