8000
Skip to content

[java] Leftovers about Dimensionable & type annotations#2203

Merged
oowekyala merged 5 commits intopmd:java-grammarfrom
oowekyala:grammar-dimensions
Jan 16, 2020
Merged

[java] Leftovers about Dimensionable & type annotations#2203
oowekyala merged 5 commits intopmd:java-grammarfrom
oowekyala:grammar-dimensions

Conversation

@oowekyala
Copy link
Copy Markdown
Member
  • The ArrayDimensions node is now used as a child of MethodDeclaration and VariableDeclaratorId to represent extra dimensions

  • Remove Dimensionable, remove its methods from the former implementations (except from ASTArrayDimsAndInits, which is itself deprecated)

  • FieldDeclaration is not a TypeNode anymore. This fixes [java] AST inconsistency between primitive and reference type arrays #910

  • Brush up API of those nodes which declare a variable (we had getVariableDeclaratorId, getId, getVariableId, etc) -> now getVarId for everyone

  • The varargs ellipsis is now represented as an ArrayTypeDim.

    • So for example, the type node of a formal parameter int... is is parsed as
    + ArrayType
      + PrimitiveType
      + ArrayDimensions
        + ArrayTypeDim[@IsVarargs=true()]
    
    • This allows for annotated varargs naturally, eg int @A ... is, where the annotations are part of the ArrayTypeDim, just as if the parameter was declared int @A [] is.
    • This affects FormalParameter and LambdaParameter

With that we can close #997: all forms of type annotations are supported and tested.

* Remove `Dimensionable`, remove its methods from the former implementations (except from ASTArrayDimsAndInits, which is itself deprecated)

* The varargs ellipsis is now represented as an ArrayTypeDim.
  * This affects FormalParameter and LambdaParameter

Closes pmd#997. All forms of type annotations are now supported.
@oowekyala oowekyala added the in:ast About the AST structure or API, the parsing step label Jan 7, 2020
@oowekyala oowekyala added this to the 7.0.0 milestone Jan 7, 2020
@ghost
Copy link
Copy Markdown
ghost commented Jan 7, 2020
1 Message
📖 No java rules are changed!

Generated by 🚫 Danger

@oowekyala oowekyala merged commit b4d03c2 into pmd:java-grammar Jan 16, 2020
@oowekyala oowekyala deleted the grammar-dimensions branch January 16, 2020 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:ast About the AST structure or API, the parsing step

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0