Repository navigation
Closed
Labels
a:bugPMD crashes or fails to analyse a file.in:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception
Milestone
Description
Affects PMD Version:
Pipeline: 7.10.0
Visual Studio Code Extension: 7.15.0
PMD CLI: 7.22.0
Description:
SOQL with GROUP BY ROLLUP and CALENDAR_YEAR.
Exception Stacktrace:
Syntax error at 279:21: mismatched input '(' expecting {')', ','}
Syntax error at 279:41: mismatched input ',' expecting {'instanceof', ')', '[', '.', '=', '>', '<', '?.', '?', '==', '===', '!=', '<>', '!==', '&&', '||', '??', '++', '--', '+', '-', '*', '/', '&', '|', '^', '+=', '-=', '*=', '/=', '&=', '|=', '^=', '<<=', '>>=', '>>>='}
Syntax error at 284:8: missing ';' at 'ExternalId__c'
Syntax error at 284:45: missing ';' at 'NULLS'
Syntax error at 285:34: missing ';' at 'ASC'
Syntax error at 285:44: missing ';' at 'FIRST'
Syntax error at 286:21: missing ';' at '('
Syntax error at 286:46: missing ';' at 'NULLS'
Syntax error at 287:6: missing ';' at 'LIMIT'
Syntax error at 288:4: mismatched input ']' expecting {'instanceof', '[', ';', '.', '=', '>', '<', '?.', '?', '==', '===', '!=', '<>', '!==', '&&', '||', '??', '++', '--', '+', '-', '*', '/', '&', '|', '^', '+=', '-=', '*=', '/=', '&=', '|=', '^=', '<<=', '>>=', '>>>='}
[INFO] An error occurred while executing PMD.
Code Sample demonstrating the issue:
SELECT
ExternalId__c,
CALENDAR_YEAR(CustomDateField__c) year,
SUM(CustomAmountField__c) amount,
COUNT(Id) counter
FROM
CustomObject__c
GROUP BY ROLLUP(
CALENDAR_YEAR(CustomDateField__c),
ExternalId__c
)
ORDER BY
ExternalId__c ASC NULLS FIRST,
CALENDAR_YEAR(CustomDateField__c) ASC NULLS LAST
LIMIT 2000Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
- Run Apex Static Analysis: On File
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
CLI
Visual Studio Code
Metadata
Metadata
Assignees
Labels
a:bugPMD crashes or fails to analyse a file.in:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception
Activity
LINTHESHWARS commentedon Mar 4, 2026
@andruts Could you provide more detailed steps to reproduce the issue?
andruts commentedon Mar 5, 2026
@LINTHESHWARS I am facing this issue while doing static analysis.
Output
[-]Parser error when using CALENDAR_YEAR() in SOQL[/-][+][apex] Parser error when using CALENDAR_YEAR() in SOQL[/+]adangel commentedon Mar 5, 2026
This is actually a bug in the upstream apex-parser project, see apex-dev-tools/apex-parser#84
adangel commentedon Jul 6, 2026
So, the new Apex Parser 5.1.0 has been released, which contains the grammar fix needed here: https://github.com/apex-dev-tools/apex-parser/releases/tag/v5.1.0
However, this is not enough, we also need an updated summit-ast library - however, the it has been archived... https://github.com/google/summit-ast
Preliminary branches:
We probably need to adopt summit-ast...
[apex] Fix pmd#6478: Bump apex-parser from 5.0.0 to 5.1.0
[doc] Update release notes (pmd#6478)
[apex] Fix pmd#6478: Bump apex-parser from 5.0.0 to 5.1.0 (pmd#6862)