Skip to content

[java] Support type annotations properly#4197

Merged
adangel merged 8 commits into
pmd:masterfrom
oowekyala:pmd6-java-type-annotations
Nov 11, 2022
Merged

[java] Support type annotations properly#4197
adangel merged 8 commits into
pmd:masterfrom
oowekyala:pmd6-java-type-annotations

Conversation

@oowekyala

@oowekyala oowekyala commented Nov 5, 2022

Copy link
Copy Markdown
Member

Describe the PR

Type annotations are parsed properly in (hopefully) all cases, and they do push Annotation nodes on the tree. I initially implemented this in a way that didn't push annotations on the tree, but I think this may throw off rules like UnusedImports, because imports used only in type annotations would be missed. That's why I think it's better to have these nodes in even if they're not as tidy as in PMD 7.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@oowekyala oowekyala added this to the 6.52.0 milestone Nov 5, 2022
@ghost

ghost commented Nov 6, 2022

Copy link
Copy Markdown
1 Message
📖 Compared to master:
This changeset changes 12 violations,
introduces 1203 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 22 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 12 violations,
introduces 721 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 16 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 12 violations,
introduces 723 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 16 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

This is to avoid having rules like UnusedImports
fail to see an annotation usage. This makes the
tree rather messy when there are type annotations
though.
@oowekyala oowekyala marked this pull request as ready for review November 8, 2022 18:13

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@adangel adangel merged commit eaa6d43 into pmd:master Nov 11, 2022
adangel added a commit that referenced this pull request Nov 11, 2022
adangel added a commit to adangel/pmd that referenced this pull request Nov 11, 2022
@oowekyala oowekyala deleted the pmd6-java-type-annotations branch November 11, 2022 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] Parse error on array type annotations [java] More parser edge cases

2 participants