Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/pmdPublic

[java] Separate receiver parameter from formal parameter#1980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
oowekyala merged 9 commits intopmd:java-grammarfromoowekyala:grammar-receiver
Sep 27, 2019

Conversation

oowekyala
Copy link
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
(@AFoothis,Fooother)
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"

@oowekyalaoowekyala added the in:astAbout the AST structure or API, the parsing step labelAug 15, 2019
@oowekyalaoowekyala added this to the7.0.0 milestoneAug 15, 2019
@ghost
Copy link

1 Message
📖No java rules are changed!

Generated by 🚫Danger

@oowekyalaoowekyala merged commit16a89b5 intopmd:java-grammarSep 27, 2019
@oowekyalaoowekyala mentioned this pull requestSep 30, 2019
@oowekyalaoowekyala deleted the grammar-receiver branchOctober 1, 2019 08:52
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
in:astAbout 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.

1 participant
@oowekyala

[8]ページ先頭

©2009-2025 Movatter.jp