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] Separate receiver parameter from formal parameter by oowekyala · Pull Request #1980 · pmd/pmd

Conversation

@oowekyala

@oowekyala oowekyala commented Aug 15, 2019

Copy link
Copy Markdown
Member

This introduces a new node type, ReceiverParameter. This is because a receiver parameter is not a formal parameter, even though it looks like one: it doesn't declare a variable, and doesn't affect the arity of the method or constructor. It's so rarely used that giving it its own node avoids matching it by mistake and simplifies the API and grammar of the ubiquitous FormalParameter and VariableDeclaratorId.

This also simplifies the few places where we pay attention to the receiver parameter --- to ignore it.

So for example:

CodeOld ASTNew AST
(@A Foo this, Foo other)
FormalParameters
  + FormalParameter[@ReceiverParameter=true()]
    + ClassOrInterfaceType
       + Annotation "A"
    + VariableDeclaratorId[@Image="this", @ReceiverParameter=true()]
  + FormalParameter
    + ClassOrInterfaceType
    + VariableDeclaratorId "other"
FormalParameters
  + ReceiverParameter
    + ClassOrInterfaceType
       + Annotation "A"
  + FormalParameter
    + ClassOrInterfaceType
    + VariableDeclaratorId "other"

Sorry, something went wrong.

Uh oh!

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

All reactions
oowekyala added 6 commits August 15, 2019 13:55
@oowekyala
Deal with receiver parameter explicitly
121d4c7
@oowekyala
Remove VariableDeclaratorId::isExplicitReceiverParameter
06f82c6
@oowekyala
Revert changes to annotation methods
86cb07c
@oowekyala
Add some tests
a234e33
@oowekyala
Remove stuff for later
fe37b6b
(revert me when improving MethodOrConstructorDeclaration
@oowekyala
Fix FormalParameter*s* not being a SingleChildNode anymore
111ab93
@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
Update comment
94f47f2
@oowekyala oowekyala mentioned this pull request Aug 15, 2019
[java] Simplify array allocation expressions #1981
Merged
oowekyala added 2 commits September 25, 2019 22:55
@oowekyala
Merge branch 'java-grammar' into grammar-receiver
f702295
@oowekyala
Fix parser corner test
16a89b5
@ghost

ghost commented Sep 25, 2019

Copy link
Copy Markdown
1 Message
📖 No java rules are changed!

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 16a89b5 into pmd:java-grammar Sep 27, 2019
@oowekyala oowekyala mentioned this pull request Sep 30, 2019
[java] Grammar type expr #2039
Merged
@oowekyala
oowekyala deleted the grammar-receiver branch October 1, 2019 08:52
This was referenced Jan 17, 2023
[java] Breaking Java Grammar changes for PMD 7.0.0 #1019
Closed
PMD 7 Tracking Issue #3898
Closed
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.