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] Remove Name nodes in Import- and PackageDeclaration #1888

Merged
merged 6 commits into from
Jul 28, 2019

Conversation

oowekyala
Copy link
Member

@oowekyala oowekyala commented Jun 26, 2019

  • Also, ImportDeclaration is not a TypeNode anymore, for the reasons described in the comment I'm deleting on the class
    • The two issues are dependent. Name is a TypeNode so making ImportDeclaration not a TypeNode strongly suggests the removal of the Name. It was clutter anyway to have a nested node just to carry a string.
  • Also, this removes getPackage on ImportDeclaration. For the same reasons ImportDeclaration shouldn't be a TypeNode, getPackage is hard to define (it was defined as the Package of the type of ImportDeclaration). Besides, it was not used even once in our codebase and I think it's utterly useless. If you have the Class then you have the Package. This should be deprecated on master
  • Fixing compilation required editing a few rules. They use the ClassTypeResolver of the CompilationUnit, which is only a temporary crutch. Those two rules (UnnecessaryQualifiedName and UnusedImport) will anyway probably be completely rewritten to make use of the new symbol table, instead of doing their thing in isolation.

See https://github.com/pmd/pmd/wiki/Java_clean_changes#import-and-package-declarations

@oowekyala oowekyala added the in:ast About the AST structure or API, the parsing step label Jun 26, 2019
@oowekyala oowekyala added this to the 7.0.0 milestone Jun 26, 2019
@adangel adangel merged commit 6f8adcd into pmd:java-grammar Jul 28, 2019
@oowekyala oowekyala deleted the grammar-remove-names branch July 31, 2019 13:52
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.

2 participants