forked from phoedos/pmd
[apex] Use new apex-parser 4.2.0
Verify that #5163 and #5182 are fixed.
This commit is contained in:
parent
c46fe6e6aa
commit
07ae01b4ea
@ -15,6 +15,9 @@ This is a {{ site.pmd.release_type }} release.
|
||||
### 🚀 New and noteworthy
|
||||
|
||||
### 🐛 Fixed Issues
|
||||
* apex
|
||||
* [#5163](https://github.com/pmd/pmd/issues/5163): \[apex] Parser error when using toLabel in SOSL query
|
||||
* [#5182](https://github.com/pmd/pmd/issues/5182): \[apex] Parser error when using GROUPING in a SOQL query
|
||||
|
||||
### 🚨 API Changes
|
||||
|
||||
|
@ -92,12 +92,17 @@
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.apex-dev-tools</groupId>
|
||||
<artifactId>apex-parser</artifactId>
|
||||
<version>4.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.summit</groupId>
|
||||
<artifactId>summit-ast</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.apex-dev-tools</groupId>
|
||||
<artifactId>apex-ls_2.13</artifactId>
|
||||
|
@ -70,4 +70,20 @@ class ApexTreeDumpTest extends BaseTreeDumpTest {
|
||||
void trigger() {
|
||||
doTest("AccountTrigger");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://github.com/pmd/pmd/issues/5163">[apex] Parser error when using toLabel in SOSL query</a>
|
||||
*/
|
||||
@Test
|
||||
void toLabelInSosl() {
|
||||
doTest("ToLabelInSosl");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://github.com/pmd/pmd/issues/5182">[apex] Parser error when using GROUPING in a SOQL query</a>
|
||||
*/
|
||||
@Test
|
||||
void groupingInSoql() {
|
||||
doTest("GroupingInSoql");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
// https://github.com/pmd/pmd/issues/5182
|
||||
|
||||
public class GroupingInSoql {
|
||||
private List<AggregateResult> getDefects() {
|
||||
AggregateResult[] defects = [
|
||||
SELECT
|
||||
OBJ1__c O1,
|
||||
OBJ2__c O2,
|
||||
OBJ3__c O3,
|
||||
SUM(OBJ4__c) O4,
|
||||
GROUPING(OBJ1__c) O1Group,
|
||||
GROUPING(OBJ2__c) O2Group,
|
||||
GROUPING(OBJ3__c) O3Group
|
||||
FROM OBJ4__c
|
||||
GROUP BY ROLLUP(OBJ1__c, OBJ2__c, OBJ3__c)
|
||||
];
|
||||
return defects;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
+- ApexFile[@DefiningType = "GroupingInSoql", @RealLoc = true]
|
||||
+- UserClass[@DefiningType = "GroupingInSoql", @Image = "GroupingInSoql", @InterfaceNames = (), @Nested = false, @RealLoc = true, @SimpleName = "GroupingInSoql", @SuperClassName = ""]
|
||||
+- ModifierNode[@Abstract = false, @DefiningType = "GroupingInSoql", @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 = "getDefects", @Constructor = false, @DefiningType = "GroupingInSoql", @Image = "getDefects", @RealLoc = true, @ReturnType = "List<AggregateResult>", @StaticInitializer = false]
|
||||
+- ModifierNode[@Abstract = false, @DefiningType = "GroupingInSoql", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 2, @Override = false, @Private = true, @Protected = false, @Public = false, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false]
|
||||
+- BlockStatement[@CurlyBrace = true, @DefiningType = "GroupingInSoql", @RealLoc = true]
|
||||
+- VariableDeclarationStatements[@DefiningType = "GroupingInSoql", @RealLoc = true]
|
||||
| +- ModifierNode[@Abstract = false, @DefiningType = "GroupingInSoql", @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 = "GroupingInSoql", @Image = "defects", @RealLoc = true, @Type = "AggregateResult[]"]
|
||||
| +- SoqlExpression[@CanonicalQuery = "SELECT\n OBJ1__c O1,\n OBJ2__c O2,\n OBJ3__c O3,\n SUM(OBJ4__c) O4,\n GROUPING(OBJ1__c) O1Group,\n GROUPING(OBJ2__c) O2Group,\n GROUPING(OBJ3__c) O3Group\n FROM OBJ4__c\n GROUP BY ROLLUP(OBJ1__c, OBJ2__c, OBJ3__c)", @DefiningType = "GroupingInSoql", @Query = "SELECT\n OBJ1__c O1,\n OBJ2__c O2,\n OBJ3__c O3,\n SUM(OBJ4__c) O4,\n GROUPING(OBJ1__c) O1Group,\n GROUPING(OBJ2__c) O2Group,\n GROUPING(OBJ3__c) O3Group\n FROM OBJ4__c\n GROUP BY ROLLUP(OBJ1__c, OBJ2__c, OBJ3__c)", @RealLoc = true]
|
||||
| +- VariableExpression[@DefiningType = "GroupingInSoql", @Image = "defects", @RealLoc = true]
|
||||
| +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false]
|
||||
+- ReturnStatement[@DefiningType = "GroupingInSoql", @RealLoc = true]
|
||||
+- VariableExpression[@DefiningType = "GroupingInSoql", @Image = "defects", @RealLoc = true]
|
||||
+- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false]
|
@ -0,0 +1,16 @@
|
||||
// https://github.com/pmd/pmd/issues/5163
|
||||
|
||||
public with sharing class ToLabelInSosl {
|
||||
public Object doSoslSearch() {
|
||||
|
||||
List<List<SObject>> searchResults = [
|
||||
FIND :searchTerm
|
||||
IN ALL FIELDS
|
||||
RETURNING
|
||||
Account(Id, toLabel(Name))
|
||||
LIMIT 10
|
||||
];
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
+- ApexFile[@DefiningType = "ToLabelInSosl", @RealLoc = true]
|
||||
+- UserClass[@DefiningType = "ToLabelInSosl", @Image = "ToLabelInSosl", @InterfaceNames = (), @Nested = false, @RealLoc = true, @SimpleName = "ToLabelInSosl", @SuperClassName = ""]
|
||||
+- ModifierNode[@Abstract = false, @DefiningType = "ToLabelInSosl", @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 = true, @WithoutSharing = false]
|
||||
+- Method[@Arity = 0, @CanonicalName = "doSoslSearch", @Constructor = false, @DefiningType = "ToLabelInSosl", @Image = "doSoslSearch", @RealLoc = true, @ReturnType = "Object", @StaticInitializer = false]
|
||||
+- ModifierNode[@Abstract = false, @DefiningType = "ToLabelInSosl", @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 = "ToLabelInSosl", @RealLoc = true]
|
||||
+- VariableDeclarationStatements[@DefiningType = "ToLabelInSosl", @RealLoc = true]
|
||||
| +- ModifierNode[@Abstract = false, @DefiningType = "ToLabelInSosl", @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 = "ToLabelInSosl", @Image = "searchResults", @RealLoc = true, @Type = "List<List<SObject>>"]
|
||||
| +- SoslExpression[@CanonicalQuery = "FIND :tmpVar1\n IN ALL FIELDS\n RETURNING\n Account(Id, TOLABEL(Name))\n LIMIT 10", @DefiningType = "ToLabelInSosl", @Query = "\n FIND :searchTerm\n IN ALL FIELDS\n RETURNING\n Account(Id, toLabel(Name))\n LIMIT 10\n ", @RealLoc = true]
|
||||
| | +- BindExpressions[@DefiningType = "ToLabelInSosl", @RealLoc = true]
|
||||
| | +- VariableExpression[@DefiningType = "ToLabelInSosl", @Image = "searchTerm", @RealLoc = true]
|
||||
| | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false]
|
||||
| +- VariableExpression[@DefiningType = "ToLabelInSosl", @Image = "searchResults", @RealLoc = true]
|
||||
| +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false]
|
||||
+- ReturnStatement[@DefiningType = "ToLabelInSosl", @RealLoc = true]
|
||||
+- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ToLabelInSosl", @Double = false, @Image = "", @Integer = false, @LiteralType = LiteralType.NULL, @Long = false, @Name = null, @Null = true, @RealLoc = true, @String = false]
|
Loading…
x
Reference in New Issue
Block a user