[java] Fix grammar and tests for Java 19

This commit is contained in:
Andreas Dangel
2022-07-10 17:12:30 +02:00
parent 70a5291cda
commit 6c1bd0e82b
10 changed files with 1501 additions and 2289 deletions

View File

@ -1721,7 +1721,7 @@ void Pattern() #void:
{
LOOKAHEAD(ReferenceType() "(") RecordPattern()
| LOOKAHEAD("(") ParenthesizedPattern()
| TypePattern() [ GuardedPatternCondition() #GuardedPattern(2) ]
| TypePattern() [ LOOKAHEAD({getToken(1).kind == SC_AND && jdkVersion < 19}) GuardedPatternCondition() #GuardedPattern(2) ]
}
void GuardedPatternCondition() #void:
@ -1739,7 +1739,7 @@ void ParenthesizedPattern() #void:
void TypePattern():
{}
{
LocalVarModifierList() ReferenceType() VariableDeclaratorId()
LocalVarModifierList() FormalParamType() VariableDeclaratorId()
}
void RecordPattern():
@ -1767,10 +1767,9 @@ void InstanceOfExpression() #void:
LOOKAHEAD(1)
("instanceof"
(
AnnotatedRefType() [ VariableDeclaratorId() #TypePattern(2) ]
LOOKAHEAD(ReferenceType() "(") RecordPattern()
| AnnotatedRefType() [ VariableDeclaratorId() #TypePattern(2) ]
| Pattern()
| LOOKAHEAD(ReferenceType() "(") RecordPattern()
)
{
jjtThis.setOp(BinaryOp.INSTANCEOF);
@ -2464,11 +2463,11 @@ void CaseLabelElement(ASTSwitchLabel label) #void:
{
"default" {label.setDefault();}
|
LOOKAHEAD(Pattern()) Pattern() ( LOOKAHEAD({isKeyword("when")}) Guard() )* {
LOOKAHEAD(Pattern()) Pattern() {
AbstractJavaNode top = jjtree.popNode();
top = new ASTPatternExpression((ASTPattern) top);
jjtree.pushNode(top);
}
} ( LOOKAHEAD({isKeyword("when")}) Guard() )*
|
ConditionalExpression()
}

View File

@ -13,6 +13,7 @@ import net.sourceforge.pmd.lang.java.ast.ASTGuardedPattern;
import net.sourceforge.pmd.lang.java.ast.ASTInfixExpression;
import net.sourceforge.pmd.lang.java.ast.ASTPattern;
import net.sourceforge.pmd.lang.java.ast.ASTPatternExpression;
import net.sourceforge.pmd.lang.java.ast.ASTRecordPattern;
import net.sourceforge.pmd.lang.java.ast.ASTTypePattern;
import net.sourceforge.pmd.lang.java.ast.ASTUnaryExpression;
import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId;
@ -90,6 +91,13 @@ final class PatternBindingsUtil {
static BindSet bindersOfPattern(ASTPattern pattern) {
if (pattern instanceof ASTTypePattern) {
return BindSet.whenTrue(HashTreePSet.singleton(((ASTTypePattern) pattern).getVarId()));
} else if (pattern instanceof ASTRecordPattern) {
// record pattern might not bind a variable for the whole record...
ASTVariableDeclaratorId varId = ((ASTRecordPattern) pattern).getVarId();
if (varId == null) {
return BindSet.whenTrue(BindSet.noBindings());
}
return BindSet.whenTrue(HashTreePSet.singleton(varId));
} else if (pattern instanceof ASTGuardedPattern) {
BindSet patternBindings = bindersOfPattern(((ASTGuardedPattern) pattern).getPattern());
BindSet guardBindings = bindersOfExpr(((ASTGuardedPattern) pattern).getGuard());

View File

@ -41,7 +41,7 @@ public class Java18PreviewTreeDumpTest extends BaseTreeDumpTest {
}
});
Assert.assertTrue("Unexpected message: " + thrown.getMessage(),
thrown.getMessage().contains("Null case labels is a preview feature of JDK 18 or JDK 19, you should select your language version accordingly"));
thrown.getMessage().contains("Null case labels is a preview feature of JDK 18, you should select your language version accordingly"));
}
@Test
@ -67,7 +67,7 @@ public class Java18PreviewTreeDumpTest extends BaseTreeDumpTest {
java18.parseResource("GuardedAndParenthesizedPatterns.java");
}
});
assertThat(thrown.getMessage(), containsString("Guarded patterns is a preview feature of JDK 18, you should select your language version accordingly"));
assertThat(thrown.getMessage(), containsString("Pattern matching for switch is a preview feature of JDK 18, you should select your language version accordingly"));
}
@Test
@ -84,7 +84,7 @@ public class Java18PreviewTreeDumpTest extends BaseTreeDumpTest {
}
});
Assert.assertTrue("Unexpected message: " + thrown.getMessage(),
thrown.getMessage().contains("Pattern matching for switch is a preview feature of JDK 18 and JDK 19, you should select your language version accordingly"));
thrown.getMessage().contains("Pattern matching for switch is a preview feature of JDK 18, you should select your language version accordingly"));
}
@Test

View File

@ -40,7 +40,7 @@ public class Java19PreviewTreeDumpTest extends BaseTreeDumpTest {
}
});
assertTrue("Unexpected message: " + thrown.getMessage(),
thrown.getMessage().contains("Null case labels in switch are only supported with JDK 18 Preview or JDK 19 Preview."));
thrown.getMessage().contains("Null case labels is a preview feature of JDK 19, you should select your language version accordingly"));
}
@Test
@ -67,7 +67,7 @@ public class Java19PreviewTreeDumpTest extends BaseTreeDumpTest {
}
});
assertTrue("Unexpected message: " + thrown.getMessage(),
thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 18 Preview or JDK 19 Preview."));
thrown.getMessage().contains("Pattern matching for switch is a preview feature of JDK 19, you should select your language version accordingly"));
}
@Test
@ -84,7 +84,7 @@ public class Java19PreviewTreeDumpTest extends BaseTreeDumpTest {
}
});
assertTrue("Unexpected message: " + thrown.getMessage(),
thrown.getMessage().contains("Pattern Matching in Switch is only supported with JDK 18 Preview or JDK 19 Preview."));
thrown.getMessage().contains("Pattern matching for switch is a preview feature of JDK 19, you should select your language version accordingly"));
}
@Test
@ -116,6 +116,6 @@ public class Java19PreviewTreeDumpTest extends BaseTreeDumpTest {
}
});
assertTrue("Unexpected message: " + thrown.getMessage(),
thrown.getMessage().contains("Record Patterns are only supported with JDK 19 Preview."));
thrown.getMessage().contains("Record patterns is a preview feature of JDK 19, you should select your language version accordingly"));
}
}

View File

@ -31,19 +31,22 @@ class ASTInstanceOfExpressionTest : ParserTestSpec({
inContext(ExpressionParsingCtx) {
"o instanceof (String s && s.length() > 4)" should parseAs {
infixExpr(BinaryOp.INSTANCEOF) {
it::getLeftOperand shouldBe variableAccess("o")
it::getRightOperand shouldBe patternExpr {
guardedPattern {
it::getPattern shouldBe typePattern {
"o instanceof String s && s.length() > 4" should parseAs {
infixExpr(BinaryOp.CONDITIONAL_AND) {
infixExpr(BinaryOp.INSTANCEOF) {
it::getLeftOperand shouldBe variableAccess("o")
it::getRightOperand shouldBe patternExpr {
typePattern {
modifiers()
classType("String")
variableId("s")
}
it::getGuard shouldBe infixExpr(BinaryOp.GT)
}
}
infixExpr(BinaryOp.GT) {
it::getLeftOperand shouldBe methodCall("length")
it::getRightOperand shouldBe number { }
}
}
}
}

View File

@ -1,7 +1,80 @@
+- CompilationUnit[@PackageName = ""]
+- ClassOrInterfaceDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "DealingWithNull", @CanonicalName = "DealingWithNull", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Image = "DealingWithNull", @Interface = false, @Local = false, @Native = false, @Nested = false, @PackageName = "", @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "DealingWithNull", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = true, @SyntacticallyStatic = false, @TopLevel = true, @Transient = false, @Visibility = Visibility.V_PUBLIC, @Volatile = false]
+- ModifierList[]
+- ClassOrInterfaceBody[@Empty = false, @Size = 4]
+- ClassOrInterfaceBody[@Empty = false, @Size = 6]
+- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "testFooBar", @MainMethod = false, @MethodName = "testFooBar", @Name = "testFooBar", @Native = false, @Overridden = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = true, @Transient = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true, @Volatile = false]
| +- ModifierList[]
| +- VoidType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @PrimitiveType = false, @TypeImage = "void"]
| +- FormalParameters[@Empty = false, @Size = 1]
| | +- FormalParameter[@Abstract = false, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @Varargs = false, @Visibility = Visibility.V_LOCAL, @Volatile = false]
| | +- ModifierList[]
| | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = false, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
| +- Block[@Empty = false, @Size = 1, @containsComment = false]
| +- SwitchStatement[@DefaultCase = true, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = false]
| +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false]
| +- SwitchArrowBranch[@Default = false]
| | +- SwitchLabel[@Default = false]
| | | +- NullLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = false, @DoubleLiteral = false, @Expression = true, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @NullLiteral = true, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = false]
| | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false]
| | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- TypeExpression[@CompileTimeConstant = false, @Expression = true, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "System", @TypeImage = "System"]
| | +- ArgumentList[@Empty = false, @Size = 1]
| | +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "Oops", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"Oops\"", @IntLiteral = false, @Length = 4, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
| +- SwitchArrowBranch[@Default = false]
| | +- SwitchLabel[@Default = false]
| | | +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "Foo", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"Foo\"", @IntLiteral = false, @Length = 3, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
| | | +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "Bar", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"Bar\"", @IntLiteral = false, @Length = 3, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
| | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false]
| | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- TypeExpression[@CompileTimeConstant = false, @Expression = true, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "System", @TypeImage = "System"]
| | +- ArgumentList[@Empty = false, @Size = 1]
| | +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "Great", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"Great\"", @IntLiteral = false, @Length = 5, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
| +- SwitchArrowBranch[@Default = true]
| +- SwitchLabel[@Default = true]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false]
| +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false]
| | +- TypeExpression[@CompileTimeConstant = false, @Expression = true, @ParenthesisDepth = 0, @Parenthesized = false]
| | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "System", @TypeImage = "System"]
| +- ArgumentList[@Empty = false, @Size = 1]
| +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "Ok", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"Ok\"", @IntLiteral = false, @Length = 2, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
+- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "testStringOrNull", @MainMethod = false, @MethodName = "testStringOrNull", @Name = "testStringOrNull", @Native = false, @Overridden = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = true, @Transient = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true, @Volatile = false]
| +- ModifierList[]
| +- VoidType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @PrimitiveType = false, @TypeImage = "void"]
| +- FormalParameters[@Empty = false, @Size = 1]
| | +- FormalParameter[@Abstract = false, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Native = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @Varargs = false, @Visibility = Visibility.V_LOCAL, @Volatile = false]
| | +- ModifierList[]
| | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "Object", @TypeImage = "Object"]
| | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @Image = "o", @LambdaParameter = false, @LocalVariable = false, @Name = "o", @Native = false, @PackagePrivate = false, @PatternBinding = false, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "o", @Visibility = Visibility.V_LOCAL, @Volatile = false]
| +- Block[@Empty = false, @Size = 1, @containsComment = false]
| +- SwitchStatement[@DefaultCase = true, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = false]
| +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "o", @Name = "o", @ParenthesisDepth = 0, @Parenthesized = false]
| +- SwitchArrowBranch[@Default = false]
| | +- SwitchLabel[@Default = false]
| | | +- NullLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = false, @DoubleLiteral = false, @Expression = true, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @NullLiteral = true, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = false]
| | | +- PatternExpression[@CompileTimeConstant = false, @Expression = true, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- TypePattern[@Abstract = false, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Native = false, @PackagePrivate = true, @ParenthesisDepth = 0, @Private = false, @Protected = false, @Public = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @Visibility = Visibility.V_PACKAGE, @Volatile = false]
| | | +- ModifierList[]
| | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "String", @TypeImage = "String"]
| | | +- VariableDeclaratorId[@Abstract = false, @ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @Image = "s", @LambdaParameter = false, @LocalVariable = false, @Name = "s", @Native = false, @PackagePrivate = false, @PatternBinding = true, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "s", @Visibility = Visibility.V_LOCAL, @Volatile = false]
| | +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false]
| | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- TypeExpression[@CompileTimeConstant = false, @Expression = true, @ParenthesisDepth = 0, @Parenthesized = false]
| | | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "System", @TypeImage = "System"]
| | +- ArgumentList[@Empty = false, @Size = 1]
| | +- InfixExpression[@CompileTimeConstant = false, @Expression = true, @Operator = BinaryOp.ADD, @ParenthesisDepth = 0, @Parenthesized = false]
| | +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "String: ", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"String: \"", @IntLiteral = false, @Length = 8, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
| | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false]
| +- SwitchArrowBranch[@Default = true]
| +- SwitchLabel[@Default = true]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "print", @MethodName = "print", @ParenthesisDepth = 0, @Parenthesized = false]
| +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Expression = true, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false]
| | +- TypeExpression[@CompileTimeConstant = false, @Expression = true, @ParenthesisDepth = 0, @Parenthesized = false]
| | +- ClassOrInterfaceType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = true, @FullyQualified = false, @PrimitiveType = false, @ReferenceToClassSameCompilationUnit = false, @SimpleName = "System", @TypeImage = "System"]
| +- ArgumentList[@Empty = false, @Size = 1]
| +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "default case", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"default case\"", @IntLiteral = false, @Length = 12, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
+- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Image = "test", @MainMethod = false, @MethodName = "test", @Name = "test", @Native = false, @Overridden = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = true, @Transient = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true, @Volatile = false]
| +- ModifierList[]
| +- VoidType[@ArrayDepth = 0, @ArrayType = false, @ClassOrInterfaceType = false, @PrimitiveType = false, @TypeImage = "void"]
@ -196,7 +269,7 @@
| | +- ArrayDimensions[@Empty = false, @Size = 1]
| | +- ArrayTypeDim[@Varargs = false]
| +- VariableDeclaratorId[@Abstract = false, @ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @Image = "args", @LambdaParameter = false, @LocalVariable = false, @Name = "args", @Native = false, @PackagePrivate = false, @PatternBinding = false, @Private = false, @Protected = false, @Public = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyAbstract = false, @SyntacticallyFinal = false, @SyntacticallyPublic = false, @SyntacticallyStatic = false, @Transient = false, @TypeInferred = false, @VariableName = "args", @Visibility = Visibility.V_LOCAL, @Volatile = false]
+- Block[@Empty = false, @Size = 6, @containsComment = false]
+- Block[@Empty = false, @Size = 12, @containsComment = false]
+- ExpressionStatement[]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "test", @MethodName = "test", @ParenthesisDepth = 0, @Parenthesized = false]
| +- ArgumentList[@Empty = false, @Size = 1]
@ -233,6 +306,30 @@
| +- ArgumentList[@Empty = false, @Size = 1]
| +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "test", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"test\"", @IntLiteral = false, @Length = 4, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
+- ExpressionStatement[]
+- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "test3", @MethodName = "test3", @ParenthesisDepth = 0, @Parenthesized = false]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "test3", @MethodName = "test3", @ParenthesisDepth = 0, @Parenthesized = false]
| +- ArgumentList[@Empty = false, @Size = 1]
| +- NullLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = false, @DoubleLiteral = false, @Expression = true, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @NullLiteral = true, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = false]
+- ExpressionStatement[]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "testFooBar", @MethodName = "testFooBar", @ParenthesisDepth = 0, @Parenthesized = false]
| +- ArgumentList[@Empty = false, @Size = 1]
| +- NullLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = false, @DoubleLiteral = false, @Expression = true, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @NullLiteral = true, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = false]
+- ExpressionStatement[]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "testFooBar", @MethodName = "testFooBar", @ParenthesisDepth = 0, @Parenthesized = false]
| +- ArgumentList[@Empty = false, @Size = 1]
| +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "Foo", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"Foo\"", @IntLiteral = false, @Length = 3, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
+- ExpressionStatement[]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "testFooBar", @MethodName = "testFooBar", @ParenthesisDepth = 0, @Parenthesized = false]
| +- ArgumentList[@Empty = false, @Size = 1]
| +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "Bar", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"Bar\"", @IntLiteral = false, @Length = 3, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
+- ExpressionStatement[]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "testFooBar", @MethodName = "testFooBar", @ParenthesisDepth = 0, @Parenthesized = false]
| +- ArgumentList[@Empty = false, @Size = 1]
| +- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "baz", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"baz\"", @IntLiteral = false, @Length = 3, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]
+- ExpressionStatement[]
| +- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "testStringOrNull", @MethodName = "testStringOrNull", @ParenthesisDepth = 0, @Parenthesized = false]
| +- ArgumentList[@Empty = false, @Size = 1]
| +- NullLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = false, @DoubleLiteral = false, @Expression = true, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @NullLiteral = true, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = false]
+- ExpressionStatement[]
+- MethodCall[@CompileTimeConstant = false, @Expression = true, @Image = "testStringOrNull", @MethodName = "testStringOrNull", @ParenthesisDepth = 0, @Parenthesized = false]
+- ArgumentList[@Empty = false, @Size = 1]
+- NullLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = false, @DoubleLiteral = false, @Expression = true, @FloatLiteral = false, @IntLiteral = false, @LongLiteral = false, @NullLiteral = true, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = false]
+- StringLiteral[@BooleanLiteral = false, @CharLiteral = false, @CompileTimeConstant = true, @ConstValue = "some string", @DoubleLiteral = false, @Empty = false, @Expression = true, @FloatLiteral = false, @Image = "\"some string\"", @IntLiteral = false, @Length = 11, @LongLiteral = false, @NullLiteral = false, @NumericLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringLiteral = true, @TextBlock = false]