Skip to content

[java] Breaking Java Grammar changes for PMD 7.0.0 #1019

@adangel

Description

@adangel

The goal is, to resemble the official Java Language Specification with PMD's own java grammar.
This makes it easier to maintain the grammar in the future and avoids special solution inside PMD.

Scheduled

Proposed

  • Split ForStatement into ForStatement and ForeachStatement
  • Make ASTLiteral an interface, use a different node for each type of literal (integer,
  • Merge UnaryExpression and UnaryExpressionNotPlusMinus. The two productions are needed for correct parsing, but there's no need to have two different nodes, especially since they have the same precedence.
  • Add a VariableDeclaratorId under enum constant declaration. This would consistently make VariableDeclaratorId represent a declaration of any value (field, parameter, local var, enum constant, etc).
  • Clarify parsing of PrimaryPrefix/Suffix when using "this" or "super". See also [java] New rule: AvoidReassigningLoopVariables #1530 (comment)

Remaining open tasks

Metadata

Metadata

Assignees

No one assigned

    Labels

    an:enhancementAn improvement on existing features / rulesin:astAbout the AST structure or API, the parsing stepin:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions