Skip to content

[java] Update rule UseTryWithResources#3181

Merged
adangel merged 2 commits into
pmd:pmd/7.0.xfrom
oowekyala:update-UseTryWithResources
Apr 10, 2021
Merged

[java] Update rule UseTryWithResources#3181
adangel merged 2 commits into
pmd:pmd/7.0.xfrom
oowekyala:update-UseTryWithResources

Conversation

@oowekyala

Copy link
Copy Markdown
Member

Describe the PR

Update rule UseTryWithResources

Related issues

Ready?

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

- Test case for pmd#2882
- Test case for pmd#2650
- Update ci file
- Update release notes
@oowekyala oowekyala added this to the 7.0.0 milestone Mar 29, 2021
@ghost

ghost commented Mar 29, 2021

Copy link
Copy Markdown
2 Messages
📖 Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 6632 new violations, 605 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
📖 Compared to master:
This changeset changes 1146 violations,
introduces 11589 new violations, 601 new errors and 0 new configuration errors,
removes 239605 violations, 5 errors and 2 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 7744 new violations, 605 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 1092 violations,
introduces 10632 new violations, 601 new errors and 0 new configuration errors,
removes 237353 violations, 5 errors and 2 configuration errors.
Full report

Generated by 🚫 Danger

@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.

Looks good.

There are a few new violations, which seem technically correct, but it might be challenging to really use try-with-resources in that situation: This is about verifying a mock after a exception... e.g. https://github.com/spring-projects/spring-framework/blob/v5.0.6.RELEASE/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateQueryTests.java#L151 - close is not really called here, but instead it is verified that it has been called somewhere else....

@adangel adangel self-assigned this Apr 10, 2021
@adangel adangel merged commit f7f67a4 into pmd:pmd/7.0.x Apr 10, 2021
@oowekyala oowekyala deleted the update-UseTryWithResources branch April 10, 2021 11:25
@adangel adangel mentioned this pull request Jan 23, 2023
55 tasks
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] UseTryWithResources - false negative for explicit close [java] UseTryWithResources false positive when AutoCloseable helper used

2 participants