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] Improve try-with-resources grammar by oowekyala · Pull Request #1897 · pmd/pmd

Conversation

@oowekyala

@oowekyala oowekyala commented Jul 1, 2019

Copy link
Copy Markdown
Member
  • ASTResources is made void. There were two layers of nodes that represented the "resource list" abstraction, and that wasn't necessary
  • Rename ResourceSpecification to ResourceList (this is more consistent with some other *List nodes we have: ExtendsList, ArgumentList, ImplementsList, soon-to-be ThrowsList)
  • Add a LocalVariableDeclaration node inside Resource node, when they're not a concise resource
    • This is because Resource in that case has an identical API/ represents the same concept
    • This simplifies type resolution, since ClassTypeResolver can work on the VariableDeclarator's initializer just like in other LocalVariableDeclaration
  • Remove the workaround in OccurenceFinder. This worked around the fact that concise resources were just a Name, however, it's now an expression, so is handled by the rest of the class
  • Resource doesn't extend FormalParameter anymore, refs [java] AST inconsistencies around FormalParameter #998 point 3
  • Add an attribute to ResourceList to expose whether there was a trailing semicolon or not -> we can make a rule later to check that

Sorry, something went wrong.

Uh oh!

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

All reactions
@oowekyala
Improve try-with-resources grammar
968c7d0
@oowekyala oowekyala added the in:ast About the AST structure or API, the parsing step label Jul 1, 2019
@oowekyala oowekyala added this to the 7.0.0 milestone Jul 1, 2019
oowekyala added 6 commits July 16, 2019 14:05
@oowekyala
Merge branch 'java-grammar' into grammar-improve-resource
eab8e6a
@oowekyala
Remove unused imports
8dbf95d
@oowekyala
Fix doc
faf3747
@oowekyala
Merge branch 'java-grammar' into grammar-improve-resource
682da63
@oowekyala
Update ResourceSpecification to ResourceList
f13e303
@oowekyala
Merge branch 'java-grammar' into grammar-improve-resource
425af93
adangel
adangel reviewed Aug 5, 2019
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we renamed here ResourceSpecification into ResourceList. I don't remember, what we should do here in terms of documentation/API compatibility... we can't deprecate ResourceSpecification on PMD6 since the successor is only in PMD7 available. Maybe just mention it in the javadoc, like for the nodes that will be gone?

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTTryStatementTest.kt Resolved

Uh oh!

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

Comment thread pmd-java/etc/grammar/Java.jjt Resolved

Uh oh!

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

Comment thread pmd-java/etc/grammar/Java.jjt Resolved

Uh oh!

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

@oowekyala oowekyala mentioned this pull request Aug 5, 2019
[java] Merge different increment/decrement expressions #1890
Merged
oowekyala added 2 commits August 6, 2019 01:58
@oowekyala
Test stable name
bc11a66
@oowekyala
Cleanup grammar as suggested by adangel
ec57361
Rename ResourceSpecification production to ResourceList,
remove Resources production
@oowekyala

oowekyala commented Aug 6, 2019

Copy link
Copy Markdown
Member Author

@adangel I'm not sure what mentioning this in the javadocs right now would achieve... Maybe we should just think about this when we're done updating the grammar. We're keeping a tidy list so that seems easy

All reactions

Sorry, something went wrong.

Uh oh!

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

@adangel

adangel commented Aug 6, 2019

Copy link
Copy Markdown
Member

I'm not sure what mentioning this in the javadocs right now would achieve... Maybe we should just think about this when we're done updating the grammar. We're keeping a tidy list so that seems easy

Agreed. Let's just collect the removed nodes in the wiki. It's maybe better suited for a later "Upgrade guide".

All reactions

Sorry, something went wrong.

Uh oh!

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

adangel
adangel approved these changes Aug 6, 2019
View reviewed changes
@adangel adangel self-assigned this Aug 6, 2019
@adangel
adangel merged commit ec57361 into pmd:java-grammar Aug 6, 2019
@adangel

adangel commented Aug 6, 2019

Copy link
Copy Markdown
Member

Merged and added a section here: https://github.com/pmd/pmd/wiki/Java_clean_changes#improve-try-with-resources-grammar

oowekyala reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@oowekyala
oowekyala deleted the grammar-improve-resource branch August 6, 2019 15:12
@oowekyala oowekyala mentioned this pull request Jan 16, 2020
[java] AST inconsistencies around FormalParameter #998
Closed
@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

@adangel adangel adangel approved these changes

Uh oh!

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

Assignees

@adangel adangel

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.

2 participants

@oowekyala @adangel
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.