Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] Improve statement grammar #2164

Merged
merged 4 commits into from Jan 6, 2020

Conversation

oowekyala
Copy link
Member

@oowekyala oowekyala commented Dec 15, 2019

This is a bunch of statement-related improvements. I left out switch statement improvements for another PR. Most of this is already described on the wiki or on TODOs in code.

Changelog

  • Turn ASTStatement into an interface
  • Remove BlockStatement
  • Introduce LocalClassDeclStatement
  • Introduce EmptyDeclaration (in preparation for future PR about declarations)
  • Replace StatementExpression with ExpressionStatement
  • Extract ForeachStatement from ForStatement
  • Rename node ASTCatchStatement -> ASTCatchClause
  • Rename node ASTFinallyStatement -> ASTFinallyClause

API

  • Rename method getGuardExpressionNode() -> getCondition() on the following nodes:
    • WhileStmt,
    • DoStmt,
    • ForStmt,
    • IfStmt,
    • AssertStmt
  • Rename ASTTryStatement#getCatchStatements() -> getCatchClauses()
  • Make ASTYieldStatement not a TypeNode
  • Remove ASTTryStatement#hasFinally()
  • Add a lot of documentation and usability methods

TODO on master

  • Introduce getCondition to replace getGuardExpressionNode
  • Deprecate ASTYieldStatement#getType[Definition]
  • Deprecate ASTTryStatement#hasFinally()

Remove BlockStatement
Introduce LocalClassDeclStatement
Introduce EmptyDeclaration (in preparation for PR about declarations)
Replace StatementExpression with ExpressionStatement

Make YieldStatement, ExplicitConstructorInvocation implement ASTStatement

Extract ForeachStatement from ForStatement

Rename
(ASTWhileStmt,
 ASTDoStmt,
 ASTForStmt,
 ASTIfStmt,
 ASTAssertStmt)#getGuardExpressionNode() -> getCondition()

Rename ASTCatchStatement -> ASTCatchClause
Rename ASTFinallyStatement -> ASTFinallyClause
Rename ASTTryStatement#getCatchStatements() -> getCatchClauses()

Make ASTYieldStatement not a TypeNode

Remove ASTTryStatement#hasFinally()

Add (ASTThrowStatement,  ASTYieldStatement, ASTReturnStatement)#getExpression()
Add ASTTryStatement#getBody()
@oowekyala oowekyala added the in:ast About the AST structure or API, the parsing step label Dec 15, 2019
@oowekyala oowekyala added this to the 7.0.0 milestone Dec 15, 2019
@pmd-test
Copy link

1 Message
📖 No java rules are changed!

Generated by 🚫 Danger

@oowekyala oowekyala changed the title [core] Improve statements [java] Improve statement grammar Dec 15, 2019
adangel added a commit that referenced this pull request Jan 5, 2020
[java] Deprecations for statements PR

Prerequisite for #2164 for PMD 7.0.0
@oowekyala oowekyala merged commit 2da8628 into pmd:java-grammar Jan 6, 2020
@oowekyala oowekyala deleted the grammar-new-statements branch January 6, 2020 02:06
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.

None yet

2 participants