GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Breaking Java Grammar changes for PMD 7.0.0 · Issue #1019 · pmd/pmd

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

New issue
Copy link
New issue
Copy link
Closed
Closed
[java] Breaking Java Grammar changes for PMD 7.0.0#1019
Copy link
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
Milestone
7.0.0

Description

@adangel
adangel
opened on Apr 3, 2018
Issue body actions

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

  • Deal with ExplicitReceiverParameters explicitely in the grammar, see JLS §8.4.1. Refs [java] Better handle explicit receiver parameters #1017
    • [java] Separate receiver parameter from formal parameter  #1980
    • 121d4c7
  • Add node for anonymous class declarations, refs [java] Add new node for anonymous class declaration #905
  • Separate FormalParameter from catch clause formal parameters (see JLS §14.20) and other improvements around FormalParameter, refs [java] AST inconsistencies around FormalParameter #998
  • Improvements to LocalVariableDeclaration and FieldDeclaration, refs [java] Improve ASTLocalVariableDeclaration #1128
  • For ShiftExpression, it makes no sense to have these extra
    RUNSIGNEDSHIFT and RSIGNEDSHIFT, which only match the token anyway. They could
    set the image on their parent, but shouldn't be pushed on the stack... we can
    use a #void production for that, like in oowekyala/pmd@87f05fc
  • Parsing ASTClassOrInterfaceType recursively to preserve annotation and type parameter location, refs [java] ClassOrInterfaceType AST improvements #1150. (Left recursive parsing is forbidden by javacc but we can build a "left-recursive node" by manipulating the jjtree stack
  • Make ImportDeclaration regular node instead of TypeNode
    • [java] Remove Name nodes in Import- and PackageDeclaration #1888
    • 303b962
  • Make FieldDeclaration regular node instead of TypeNode
    • [java] Leftovers about Dimensionable & type annotations #2203
    • 1fefbd2
  • Make ASTType and ASTReferenceType interfaces, make new node ArrayType -> helps type resolution, easier to specialize the API
  • Use an ArrayDimensions node to represent array dimensions on ArrayType, VariableDeclaratorId, MethodDeclarator and other contexts instead of Dimensionable
    • [java] New expression and type grammar #1759
    • [java] Leftovers about Dimensionable & type annotations #2203
    • 6378080

Proposed

  • Split ForStatement into ForStatement and ForeachStatement
    • b03e233
    • [java] Improve statement grammar #2164
  • 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

  • Remove setters from AccessNode interface and make FormalParameter, Resource and LocalVariableDeclaration not implement it anymore
    • tracked in [java] AccessNode API changes #1307

Activity

  1. adangel
    added this to the 7.0.0 milestone on Apr 3, 2018
  2. jsotuyod
    added
    an:enhancementAn improvement on existing features / rules
    in:pmd-internalsAffects PMD's internals
    on Apr 3, 2018
  3. jsotuyod commented on Apr 3, 2018

    @jsotuyod
    jsotuyod
    on Apr 3, 2018
    Member
    More actions

    @oowekyala should we merge #905 into this?

  4. oowekyala commented on Apr 6, 2018

    @oowekyala
    oowekyala
    on Apr 6, 2018
    Member
    More actions

    @jsotuyod I think adding that issue to the checklist is a good idea, but I'd prefer the issue to stay open. It gives room for clearer discussions/ easier referencing. Same for #998. I'll do that

    I'd really love the grammar for expressions to be revamped for 7.0.0 too (#497), but I get a feeling this would have been a task for a GSoC given the number of rules and other clients to update. It also interacts with possible typeres GSoCs so it's hard to implement before the end of the summer

  5. oowekyala
    added
    in:astAbout the AST structure or API, the parsing step
    on May 27, 2018
  6. adangel commented on Jul 14, 2019

    @adangel
    adangel
    on Jul 14, 2019
    MemberAuthor
    More actions

    I'm closing this - the tasks are collected on https://github.com/pmd/pmd/wiki/PMD-7.0.0-Java

  7. adangel
    closed this as completedon Jul 14, 2019
  8. adangel
    added
    in:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception
    and removed
    in:pmd-internalsAffects PMD's internals
    on Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Projects

    No projects

      Milestone

      • 7.0.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.