[apex] Make apex have a single RootNode #2491
Conversation
Generated by 🚫 Danger |
| /** | ||
| * Adapter for the Apex jorje parser | ||
| */ | ||
| public class ApexParser extends AbstractParser { |
There was a problem hiding this comment.
This change effectively moves ApexParser from package lang.apex into lang.apex.ast.
I guess, we should internalize this one on master, as we did with the JavaLanguageParser.
Done in 23c08b5
| for (Object element : nodes) { | ||
| if (element instanceof ASTUserClass) { | ||
| visit((ASTUserClass) element, ctx); | ||
| } else if (element instanceof ASTUserInterface) { | ||
| visit((ASTUserInterface) element, ctx); | ||
| } else if (element instanceof ASTUserTrigger) { | ||
| visit((ASTUserTrigger) element, ctx); |
There was a problem hiding this comment.
On master, in seems we have a bug: we don't visit top-level ASTUserEnum and ASTAnonymousClass...
Enums in Apex can't have additional user defined methods, so they only define the constants. This means, only rules like Naming conventions would suffer from this bug.
Just tested it: this rule uses rulechain, so we directly visit UserEnum - that works. The tests look like, they were written before introducing rule chain, since they don't have a top-level enum...
ASTAnonymousClass - hm... a anonymous class can't be top-level. So, this should be no issue at all... In fact, I have no clue, how to write an anonymous class in Apex....
This is addressed in #2610
Describe the PR
Another unrelated change, is that CanSuppressWarning is now removed in Apex. This aligns apex annotation suppression with the java module (on java-grammar), see #1927
Related issues
Ready?
./mvnw clean verifypasses (checked automatically by travis)