Skip to content

[java] Remove Name nodes in Import- and PackageDeclaration#1888

Merged
adangel merged 6 commits into
pmd:java-grammarfrom
oowekyala:grammar-remove-names
Jul 28, 2019
Merged

[java] Remove Name nodes in Import- and PackageDeclaration#1888
adangel merged 6 commits into
pmd:java-grammarfrom
oowekyala:grammar-remove-names

Conversation

@oowekyala

@oowekyala oowekyala commented Jun 26, 2019

Copy link
Copy Markdown
Member
  • 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