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] Simplify array allocation expressions by oowekyala · Pull Request #1981 · pmd/pmd

Conversation

@oowekyala

@oowekyala oowekyala commented Aug 15, 2019

Copy link
Copy Markdown
Member

This is a minor simplification of the grammar of array allocation expressions.

  • ArrayAllocation nodes now have an ArrayType as a child,instead of a type + ArrayAllocationDims. This allows sharing the API and is overall less surprising (you'd expect an array allocation expression to have an array type node somewhere)
  • ArrayTypeDims is renamed to ArrayDimensions (it's tricky to spot the extra s)
  • ArrayDimExpr extends ArrayTypeDim. So ArrayAllocationDims can be removed, since ArrayDimensions collects all dimensions, whether they're initialized with a length expression (ArrayDimExpr) or not.

I'm not sure we really need an ArrayDimExpr node, ArrayTypeDim could as well have an optional child for the expression, but I'm concerned the API of that node would be more complex.

This prepares for fixing #997. We now have a single node type for array dimensions. We can add it in VariableDeclaratorId and MethodDeclaration, and get rid of Dimensionable. This fix has to wait for #1980 because both touch the VariableDeclaratorId production

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
oowekyala added 2 commits August 15, 2019 17:27
@oowekyala
Merge ArrayAllocationDims with ArrayTypeDims
00649ac
This simplifies the grammar of allocation expressions,
they now have an array type as a child
@oowekyala
Rename to ArrayDimensions
84bc03e
@oowekyala oowekyala added the in:ast About the AST structure or API, the parsing step label Aug 15, 2019
@oowekyala oowekyala added this to the 7.0.0 milestone Aug 15, 2019
@oowekyala
Merge branch 'java-grammar' into grammar-array-dims
6a04f6a
@ghost

ghost commented Sep 25, 2019

Copy link
Copy Markdown
1 Warning
⚠️ This PR cannot be merged yet.

Generated by 🚫 Danger

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@oowekyala
oowekyala merged commit 6a04f6a into pmd:java-grammar Sep 27, 2019
@oowekyala
oowekyala deleted the grammar-array-dims branch October 1, 2019 08:52
@adangel adangel mentioned this pull request Jan 23, 2023
PMD 7 Tracking Issue #3898
Closed
55 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

7.0.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@oowekyala
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.