From 96bf5093ff3d9c0eb629476a9bf95163cb17e67b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 8 Jul 2021 18:26:49 +0200 Subject: [PATCH] Fix compilation --- .../pmd/lang/apex/ast/ASTApexFile.java | 6 +- .../pmd/lang/apex/ast/ASTBlockStatement.java | 6 +- .../pmd/lang/apex/ast/ApexParser.java | 7 +- .../pmd/lang/apex/ast/ApexTreeBuilder.java | 32 ++- .../pmd/lang/apex/ast/ApexParserTest.java | 4 +- .../lang/apex/ast/SafeNavigationOperator.txt | 198 +++++++++--------- .../java/ast/ASTConditionalExpression.java | 2 +- .../codestyle/UseDiamondOperatorRule.java | 2 +- 8 files changed, 129 insertions(+), 128 deletions(-) diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTApexFile.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTApexFile.java index e352518331..287a2b1456 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTApexFile.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTApexFile.java @@ -25,10 +25,10 @@ public final class ASTApexFile extends AbstractApexNode implements Root private final @NonNull ApexMultifileAnalysis multifileAnalysis; ASTApexFile(ParserTask task, - AbstractApexNode child, // this is not entirely initialized when we get here + Compilation jorjeNode, Map suppressMap, @NonNull ApexMultifileAnalysis multifileAnalysis) { - super(child.getNode()); + super(jorjeNode); this.astInfo = new AstInfo<>(task, this, suppressMap); this.multifileAnalysis = multifileAnalysis; this.setRegion(TextRegion.fromOffsetLength(0, task.getTextDocument().getLength())); @@ -60,6 +60,6 @@ public final class ASTApexFile extends AbstractApexNode implements Root } public List getGlobalIssues() { - return multifileAnalysis.getFileIssues(getAstInfo().getFileName()); + return multifileAnalysis.getFileIssues(getAstInfo().getTextDocument().getPathId()); } } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java index 2805177083..5c9212b50c 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java @@ -26,8 +26,8 @@ public final class ASTBlockStatement extends AbstractApexNode { } @Override - void closeNode(TextDocument positioner) { - super.closeNode(positioner); + void closeNode(TextDocument document) { + super.closeNode(document); if (!hasRealLoc()) { return; } @@ -35,7 +35,7 @@ public final class ASTBlockStatement extends AbstractApexNode { // check, whether the this block statement really begins with a curly brace // unfortunately, for-loop and if-statements always contain a block statement, // regardless whether curly braces where present or not. - curlyBrace = positioner.getText().startsWith('{', node.getLoc().getStartIndex()); + curlyBrace = document.getText().startsWith('{', node.getLoc().getStartIndex()); } @Override diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java index 9c1b99daff..ef356b4b19 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexParser.java @@ -9,7 +9,6 @@ import net.sourceforge.pmd.lang.apex.ApexJorjeLogging; import net.sourceforge.pmd.lang.apex.multifile.ApexMultifileAnalysis; import net.sourceforge.pmd.lang.ast.ParseException; import net.sourceforge.pmd.lang.ast.Parser; -import net.sourceforge.pmd.lang.ast.SourceCodePositioner; import net.sourceforge.pmd.properties.PropertyDescriptor; import net.sourceforge.pmd.properties.PropertyFactory; @@ -42,8 +41,12 @@ public final class ApexParser implements Parser { throw new ParseException("Couldn't parse the source - there is not root node - Syntax Error??"); } + String property = task.getProperties().getProperty(MULTIFILE_DIRECTORY); + ApexMultifileAnalysis analysisHandler = ApexMultifileAnalysis.getAnalysisInstance(property); + + final ApexTreeBuilder treeBuilder = new ApexTreeBuilder(task); - return treeBuilder.buildTree(astRoot); + return treeBuilder.buildTree(astRoot, analysisHandler); } catch (apex.jorje.services.exception.ParseException e) { throw new ParseException(e); } diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexTreeBuilder.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexTreeBuilder.java index 6c7f599fbf..6bc49b2b09 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexTreeBuilder.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ApexTreeBuilder.java @@ -10,11 +10,11 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.sourceforge.pmd.lang.apex.multifile.ApexMultifileAnalysis; import net.sourceforge.pmd.lang.ast.Parser.ParserTask; import net.sourceforge.pmd.util.document.Chars; import net.sourceforge.pmd.util.document.TextDocument; @@ -243,7 +243,6 @@ final class ApexTreeBuilder extends AstVisitor { // The nodes having children built. private final Stack> nodes = new Stack<>(); - private ASTApexFile root; // The Apex nodes with children to build. private final Stack parents = new Stack<>(); @@ -283,9 +282,20 @@ final class ApexTreeBuilder extends AstVisitor { } } - ASTApexFile buildTree(Compilation astNode) { + ASTApexFile buildTree(Compilation astNode, ApexMultifileAnalysis analysisHandler) { + assert nodes.isEmpty() : "stack should be empty"; + ASTApexFile root = new ASTApexFile(task, astNode, suppressMap, analysisHandler); + nodes.push(root); + parents.push(astNode); + build(astNode); - return Objects.requireNonNull(root); + + nodes.pop(); + parents.pop(); + + addFormalComments(); + closeTree(root); + return root; } private void build(T astNode) { @@ -293,12 +303,7 @@ final class ApexTreeBuilder extends AstVisitor { AbstractApexNode node = createNodeAdapter(astNode); // Append to parent - AbstractApexNode parent; - if (nodes.isEmpty()) { - parent = root = new ASTApexFile(task, (AbstractApexNode) node, suppressMap); - } else { - parent = nodes.peek(); - } + AbstractApexNode parent = nodes.peek(); parent.addChild(node, parent.getNumChildren()); // Build the children... @@ -307,13 +312,6 @@ final class ApexTreeBuilder extends AstVisitor { astNode.traverse(this, scope); nodes.pop(); parents.pop(); - - if (nodes.isEmpty()) { - // add the comments only at the end of the processing as the last step - addFormalComments(); - closeTree(node); - } - } private void closeTree(AbstractApexNode node) { diff --git a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/ast/ApexParserTest.java b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/ast/ApexParserTest.java index 56547ceedd..3210720966 100644 --- a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/ast/ApexParserTest.java +++ b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/ast/ApexParserTest.java @@ -85,7 +85,7 @@ public class ApexParserTest extends ApexParserTestBase { // BlockStatement - the whole method body Node blockStatement = method1.getChild(1); - assertTrue(((ASTBlockStatement) blockStatement).hasCurlyBrace()); + assertTrue("should detect curly brace", ((ASTBlockStatement) blockStatement).hasCurlyBrace()); assertPosition(blockStatement, 2, 27, 5, 6); // the expression ("System.out...") @@ -187,7 +187,7 @@ public class ApexParserTest extends ApexParserTestBase { visitPosition(rootNode, 0); - Assert.assertEquals("InnerClassLocations", rootNode.getSimpleName()); + Assert.assertEquals("InnerClassLocations", rootNode.getMainNode().getSimpleName()); // Note: Apex parser doesn't provide positions for "public class" keywords. The // position of the UserClass node is just the identifier. So, the node starts // with the identifier and not with the first keyword in the file... 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 00e30c80d7..a9fd23b1f5 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,99 +1,99 @@ -+- ApexFile[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(4, 14, 180, 183)", @Namespace = "", @RealLoc = "true"] - +- UserClass[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "Foo", @Location = "(4, 14, 180, 183)", @Namespace = "", @RealLoc = "true", @SimpleName = "Foo", @SuperClassName = ""] - +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(4, 14, 180, 183)", @Modifiers = "1", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "true", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - +- Field[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Location = "(5, 13, 198, 199)", @Name = "x", @Namespace = "", @RealLoc = "true", @Type = "Integer", @Value = null] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(5, 13, 198, 199)", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - +- Field[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "profileUrl", @Location = "(8, 12, 365, 375)", @Name = "profileUrl", @Namespace = "", @RealLoc = "true", @Type = "String", @Value = null] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(8, 12, 365, 375)", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - +- FieldDeclarationStatements[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(5, 5, 190, 199)", @Namespace = "", @RealLoc = "true", @TypeName = "Integer"] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "no location", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "false", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- FieldDeclaration[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "anIntegerField", @Location = "(5, 13, 198, 199)", @Name = "anIntegerField", @Namespace = "", @RealLoc = "true"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "anIntegerField", @Location = "(5, 27, 212, 226)", @Namespace = "", @RealLoc = "true"] - | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] - | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "anObject", @Location = "(5, 17, 202, 210)", @Namespace = "", @RealLoc = "true"] - | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Location = "(5, 13, 198, 199)", @Namespace = "", @RealLoc = "true"] - | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - +- FieldDeclarationStatements[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(8, 5, 358, 375)", @Namespace = "", @RealLoc = "true", @TypeName = "String"] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "no location", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "false", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- FieldDeclaration[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "profileUrl", @Location = "(8, 12, 365, 375)", @Name = "profileUrl", @Namespace = "", @RealLoc = "true"] - | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "toExternalForm", @InputParametersSize = "0", @Location = "(8, 47, 400, 414)", @MethodName = "toExternalForm", @Namespace = "", @RealLoc = "true"] - | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "METHOD", @SafeNav = "true"] - | | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "user.getProfileUrl", @InputParametersSize = "0", @Location = "(8, 30, 383, 396)", @MethodName = "getProfileUrl", @Namespace = "", @RealLoc = "true"] - | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Image = "user", @Location = "(8, 25, 378, 382)", @Namespace = "", @RealLoc = "true", @ReferenceType = "METHOD", @SafeNav = "false"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "profileUrl", @Location = "(8, 12, 365, 375)", @Namespace = "", @RealLoc = "true"] - | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - +- Method[@ApexVersion = "51.0", @Arity = "1", @CanonicalName = "bar1", @Constructor = "false", @DefiningType = "Foo", @Image = "bar1", @Location = "(10, 17, 435, 439)", @Namespace = "", @RealLoc = "true", @ReturnType = "void", @Synthetic = "false"] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(10, 17, 435, 439)", @Modifiers = "1", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "true", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- Parameter[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Location = "(10, 29, 447, 448)", @Namespace = "", @RealLoc = "true", @Type = "Object"] - | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(10, 29, 447, 448)", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- BlockStatement[@ApexVersion = "51.0", @CurlyBrace = "true", @DefiningType = "Foo", @Location = "(10, 32, 450, 538)", @Namespace = "", @RealLoc = "true"] - | +- ExpressionStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(11, 12, 463, 465)", @Namespace = "", @RealLoc = "true"] - | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "b", @Location = "(11, 12, 463, 464)", @Namespace = "", @RealLoc = "true"] - | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] - | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Location = "(11, 9, 460, 461)", @Namespace = "", @RealLoc = "true"] - | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - | +- ExpressionStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(12, 22, 527, 532)", @Namespace = "", @RealLoc = "true"] - | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "c1", @InputParametersSize = "0", @Location = "(12, 22, 527, 529)", @MethodName = "c1", @Namespace = "", @RealLoc = "true"] - | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "METHOD", @SafeNav = "true"] - | +- CastExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(12, 10, 515, 518)", @Namespace = "", @RealLoc = "true"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "b1", @Location = "(12, 17, 522, 524)", @Namespace = "", @RealLoc = "true"] - | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a1", @Location = "(12, 13, 518, 520)", @Namespace = "", @RealLoc = "true"] - | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - +- Method[@ApexVersion = "51.0", @Arity = "2", @CanonicalName = "bar2", @Constructor = "false", @DefiningType = "Foo", @Image = "bar2", @Location = "(15, 17, 556, 560)", @Namespace = "", @RealLoc = "true", @ReturnType = "void", @Synthetic = "false"] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(15, 17, 556, 560)", @Modifiers = "1", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "true", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- Parameter[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Location = "(15, 31, 570, 571)", @Namespace = "", @RealLoc = "true", @Type = "List"] - | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(15, 31, 570, 571)", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- Parameter[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Location = "(15, 38, 577, 578)", @Namespace = "", @RealLoc = "true", @Type = "int"] - | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(15, 38, 577, 578)", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- BlockStatement[@ApexVersion = "51.0", @CurlyBrace = "true", @DefiningType = "Foo", @Location = "(15, 41, 580, 688)", @Namespace = "", @RealLoc = "true"] - | +- ExpressionStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(16, 25, 606, 613)", @Namespace = "", @RealLoc = "true"] - | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "aField", @Location = "(16, 25, 606, 612)", @Namespace = "", @RealLoc = "true"] - | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "false"] - | | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = "0", @Location = "(16, 15, 596, 603)", @MethodName = "aMethod", @Namespace = "", @RealLoc = "true"] - | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "METHOD", @SafeNav = "true"] - | | +- ArrayLoadExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(16, 9, 590, 591)", @Namespace = "", @RealLoc = "true"] - | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Location = "(16, 9, 590, 591)", @Namespace = "", @RealLoc = "true"] - | | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Location = "(16, 11, 592, 593)", @Namespace = "", @RealLoc = "true"] - | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - | +- ExpressionStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(17, 25, 675, 682)", @Namespace = "", @RealLoc = "true"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "aField", @Location = "(17, 25, 675, 681)", @Namespace = "", @RealLoc = "true"] - | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] - | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = "0", @Location = "(17, 14, 664, 671)", @MethodName = "aMethod", @Namespace = "", @RealLoc = "true"] - | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "METHOD", @SafeNav = "false"] - | +- ArrayLoadExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(17, 9, 659, 660)", @Namespace = "", @RealLoc = "true"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Location = "(17, 9, 659, 660)", @Namespace = "", @RealLoc = "true"] - | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Location = "(17, 11, 661, 662)", @Namespace = "", @RealLoc = "true"] - | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - +- Method[@ApexVersion = "51.0", @Arity = "1", @CanonicalName = "getName", @Constructor = "false", @DefiningType = "Foo", @Image = "getName", @Location = "(20, 19, 708, 715)", @Namespace = "", @RealLoc = "true", @ReturnType = "String", @Synthetic = "false"] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(20, 19, 708, 715)", @Modifiers = "1", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "true", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- Parameter[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "accId", @Location = "(20, 31, 720, 725)", @Namespace = "", @RealLoc = "true", @Type = "int"] - | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(20, 31, 720, 725)", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | +- BlockStatement[@ApexVersion = "51.0", @CurlyBrace = "true", @DefiningType = "Foo", @Location = "(20, 38, 727, 905)", @Namespace = "", @RealLoc = "true"] - | +- VariableDeclarationStatements[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(21, 9, 737, 745)", @Namespace = "", @RealLoc = "true"] - | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "no location", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "false", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - | | +- VariableDeclaration[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "s", @Location = "(21, 16, 744, 745)", @Namespace = "", @RealLoc = "true", @Type = "String"] - | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "BillingCity", @Location = "(21, 37, 765, 776)", @Namespace = "", @RealLoc = "true"] - | | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] - | | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "Account", @Location = "(21, 28, 756, 763)", @Namespace = "", @RealLoc = "true"] - | | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Image = "contact", @Location = "(21, 20, 748, 755)", @Namespace = "", @RealLoc = "true", @ReferenceType = "LOAD", @SafeNav = "false"] - | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "s", @Location = "(21, 16, 744, 745)", @Namespace = "", @RealLoc = "true"] - | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - | +- ReturnStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(23, 9, 841, 899)", @Namespace = "", @RealLoc = "true"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "Name", @Location = "(23, 62, 894, 898)", @Namespace = "", @RealLoc = "true"] - | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] - | +- SoqlExpression[@ApexVersion = "51.0", @CanonicalQuery = "SELECT Name FROM Account WHERE Id = :tmpVar1", @DefiningType = "Foo", @Location = "(23, 16, 848, 892)", @Namespace = "", @Query = "SELECT Name FROM Account WHERE Id = :accId", @RealLoc = "true"] - | +- BindExpressions[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "(23, 16, 848, 892)", @Namespace = "", @RealLoc = "true"] - | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "accId", @Location = "(23, 54, 886, 891)", @Namespace = "", @RealLoc = "true"] - | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Location = "no location", @Namespace = null, @RealLoc = "false"] - +- Method[@ApexVersion = "51.0", @Arity = "0", @CanonicalName = "", @Constructor = "false", @DefiningType = "Foo", @Image = "", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReturnType = "void", @Synthetic = "true"] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Location = "(4, 14, 180, 183)", @Modifiers = "8", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "true", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - +- Method[@ApexVersion = "51.0", @Arity = "0", @CanonicalName = "clone", @Constructor = "false", @DefiningType = "Foo", @Image = "clone", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReturnType = "Object", @Synthetic = "true"] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "true", @InheritedSharing = "false", @Location = "no location", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "false", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - +- UserClassMethods[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false"] - | +- Method[@ApexVersion = "51.0", @Arity = "0", @CanonicalName = "", @Constructor = "true", @DefiningType = "Foo", @Image = "", @Location = "no location", @Namespace = "", @RealLoc = "false", @ReturnType = "void", @Synthetic = "true"] - | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "true", @InheritedSharing = "false", @Location = "(4, 14, 180, 183)", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] - +- BridgeMethodCreator[@ApexVersion = "51.0", @DefiningType = "Foo", @Location = "no location", @Namespace = "", @RealLoc = "false"] ++- ApexFile[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + +- UserClass[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "Foo", @Namespace = "", @RealLoc = "true", @SimpleName = "Foo", @SuperClassName = ""] + +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "1", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "true", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + +- Field[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Name = "x", @Namespace = "", @RealLoc = "true", @Type = "Integer", @Value = null] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + +- Field[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "profileUrl", @Name = "profileUrl", @Namespace = "", @RealLoc = "true", @Type = "String", @Value = null] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + +- FieldDeclarationStatements[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true", @TypeName = "Integer"] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "false", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- FieldDeclaration[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "anIntegerField", @Name = "anIntegerField", @Namespace = "", @RealLoc = "true"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "anIntegerField", @Namespace = "", @RealLoc = "true"] + | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] + | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "anObject", @Namespace = "", @RealLoc = "true"] + | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Namespace = "", @RealLoc = "true"] + | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + +- FieldDeclarationStatements[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true", @TypeName = "String"] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "false", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- FieldDeclaration[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "profileUrl", @Name = "profileUrl", @Namespace = "", @RealLoc = "true"] + | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "toExternalForm", @InputParametersSize = "0", @MethodName = "toExternalForm", @Namespace = "", @RealLoc = "true"] + | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "METHOD", @SafeNav = "true"] + | | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "user.getProfileUrl", @InputParametersSize = "0", @MethodName = "getProfileUrl", @Namespace = "", @RealLoc = "true"] + | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Image = "user", @Namespace = "", @RealLoc = "true", @ReferenceType = "METHOD", @SafeNav = "false"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "profileUrl", @Namespace = "", @RealLoc = "true"] + | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + +- Method[@ApexVersion = "51.0", @Arity = "1", @CanonicalName = "bar1", @Constructor = "false", @DefiningType = "Foo", @Image = "bar1", @Namespace = "", @RealLoc = "true", @ReturnType = "void", @Synthetic = "false"] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "1", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "true", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- Parameter[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Namespace = "", @RealLoc = "true", @Type = "Object"] + | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- BlockStatement[@ApexVersion = "51.0", @CurlyBrace = "true", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- ExpressionStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "b", @Namespace = "", @RealLoc = "true"] + | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] + | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Namespace = "", @RealLoc = "true"] + | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + | +- ExpressionStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "c1", @InputParametersSize = "0", @MethodName = "c1", @Namespace = "", @RealLoc = "true"] + | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "METHOD", @SafeNav = "true"] + | +- CastExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "b1", @Namespace = "", @RealLoc = "true"] + | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a1", @Namespace = "", @RealLoc = "true"] + | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + +- Method[@ApexVersion = "51.0", @Arity = "2", @CanonicalName = "bar2", @Constructor = "false", @DefiningType = "Foo", @Image = "bar2", @Namespace = "", @RealLoc = "true", @ReturnType = "void", @Synthetic = "false"] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "1", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "true", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- Parameter[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Namespace = "", @RealLoc = "true", @Type = "List"] + | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- Parameter[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Namespace = "", @RealLoc = "true", @Type = "int"] + | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- BlockStatement[@ApexVersion = "51.0", @CurlyBrace = "true", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- ExpressionStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "aField", @Namespace = "", @RealLoc = "true"] + | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "false"] + | | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = "0", @MethodName = "aMethod", @Namespace = "", @RealLoc = "true"] + | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "METHOD", @SafeNav = "true"] + | | +- ArrayLoadExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Namespace = "", @RealLoc = "true"] + | | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Namespace = "", @RealLoc = "true"] + | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + | +- ExpressionStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "aField", @Namespace = "", @RealLoc = "true"] + | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] + | +- MethodCallExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = "0", @MethodName = "aMethod", @Namespace = "", @RealLoc = "true"] + | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "METHOD", @SafeNav = "false"] + | +- ArrayLoadExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "a", @Namespace = "", @RealLoc = "true"] + | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "x", @Namespace = "", @RealLoc = "true"] + | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + +- Method[@ApexVersion = "51.0", @Arity = "1", @CanonicalName = "getName", @Constructor = "false", @DefiningType = "Foo", @Image = "getName", @Namespace = "", @RealLoc = "true", @ReturnType = "String", @Synthetic = "false"] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "1", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "true", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- Parameter[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "accId", @Namespace = "", @RealLoc = "true", @Type = "int"] + | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | +- BlockStatement[@ApexVersion = "51.0", @CurlyBrace = "true", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- VariableDeclarationStatements[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "false", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + | | +- VariableDeclaration[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "s", @Namespace = "", @RealLoc = "true", @Type = "String"] + | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "BillingCity", @Namespace = "", @RealLoc = "true"] + | | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] + | | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "Account", @Namespace = "", @RealLoc = "true"] + | | | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Image = "contact", @Namespace = "", @RealLoc = "true", @ReferenceType = "LOAD", @SafeNav = "false"] + | | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "s", @Namespace = "", @RealLoc = "true"] + | | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + | +- ReturnStatement[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "Name", @Namespace = "", @RealLoc = "true"] + | +- ReferenceExpression[@ApexVersion = "51.0", @Context = null, @DefiningType = "Foo", @Namespace = "", @RealLoc = "false", @ReferenceType = "LOAD", @SafeNav = "true"] + | +- SoqlExpression[@ApexVersion = "51.0", @CanonicalQuery = "SELECT Name FROM Account WHERE Id = :tmpVar1", @DefiningType = "Foo", @Namespace = "", @Query = "SELECT Name FROM Account WHERE Id = :accId", @RealLoc = "true"] + | +- BindExpressions[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "true"] + | +- VariableExpression[@ApexVersion = "51.0", @DefiningType = "Foo", @Image = "accId", @Namespace = "", @RealLoc = "true"] + | +- EmptyReferenceExpression[@ApexVersion = "51.0", @DefiningType = null, @Namespace = null, @RealLoc = "false"] + +- Method[@ApexVersion = "51.0", @Arity = "0", @CanonicalName = "", @Constructor = "false", @DefiningType = "Foo", @Image = "", @Namespace = "", @RealLoc = "false", @ReturnType = "void", @Synthetic = "true"] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "false", @InheritedSharing = "false", @Modifiers = "8", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "true", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + +- Method[@ApexVersion = "51.0", @Arity = "0", @CanonicalName = "clone", @Constructor = "false", @DefiningType = "Foo", @Image = "clone", @Namespace = "", @RealLoc = "false", @ReturnType = "Object", @Synthetic = "true"] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "true", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "false", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + +- UserClassMethods[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "false"] + | +- Method[@ApexVersion = "51.0", @Arity = "0", @CanonicalName = "", @Constructor = "true", @DefiningType = "Foo", @Image = "", @Namespace = "", @RealLoc = "false", @ReturnType = "void", @Synthetic = "true"] + | +- ModifierNode[@Abstract = "false", @ApexVersion = "51.0", @DefiningType = "Foo", @DeprecatedTestMethod = "false", @Final = "false", @Global = "true", @InheritedSharing = "false", @Modifiers = "0", @Namespace = "", @Override = "false", @Private = "false", @Protected = "false", @Public = "false", @RealLoc = "true", @Static = "false", @Test = "false", @TestOrTestSetup = "false", @Transient = "false", @WebService = "false", @WithSharing = "false", @WithoutSharing = "false"] + +- BridgeMethodCreator[@ApexVersion = "51.0", @DefiningType = "Foo", @Namespace = "", @RealLoc = "false"] diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTConditionalExpression.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTConditionalExpression.java index c5e5e0baef..eaa8450c44 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTConditionalExpression.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTConditionalExpression.java @@ -62,7 +62,7 @@ public final class ASTConditionalExpression extends AbstractJavaExpr { */ // very internal boolean isStandalone() { - assert getAstInfo().getLanguageVersion().compareToVersion("8") >= 0 + assert getLanguageVersion().compareToVersion("8") >= 0 : "This method's result is undefined in pre java 8 code"; return this.isStandalone; } 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 8e5436f868..080e453295 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 @@ -91,7 +91,7 @@ public class UseDiamondOperatorRule extends AbstractJavaRulechainRule { } private static boolean supportsDiamondOnAnonymousClass(ASTConstructorCall ctorCall) { - return ctorCall.getAstInfo().getLanguageVersion().compareToVersion("9") >= 0; + return ctorCall.getLanguageVersion().compareToVersion("9") >= 0; }