Skip to content

Conversation

chonton
Copy link
Contributor

@chonton chonton commented Aug 22, 2024

see https://openjdk.org/jeps/8337395

Describe the PR

Modify advice for AvoidSynchronizedAtMethodLevel and add AvoidSynchronizedStatement.
See https://openjdk.org/jeps/8337395 for detailed information about virtual thread pinning concerns.

Related issues

  • Fixes #

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)

@ghost
Copy link

ghost commented Aug 22, 2024

1 Message
📖 Compared to master:
This changeset changes 969 violations,
introduces 1689 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 2 errors and 7 configuration errors.
Download full report as build artifact
Compared to master:
This changeset changes 969 violations,
introduces 1689 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 2 errors and 7 configuration errors.
Download full report as build artifact
Compared to master:
This changeset changes 969 violations,
introduces 1689 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 2 errors and 7 configuration errors.
Download full report as build artifact

Generated by 🚫 Danger

@jsotuyod jsotuyod changed the title update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock [java] update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock Aug 22, 2024
@jsotuyod
Copy link
Member

@chonton thanks for the PR!

This looks overall very good, but the new rule AvoidSynchronizedStatement would require tests. Doing so in PMD is quite easy, simply create an empty AvoidSynchronizedStatementTest similar to the one for AvoidSynchronizedAtMethodLevelTest. And then create a copy of AvoidSynchronizedAtMethodLevel.xml for AvoidSynchronizedStatement, replacing the test samples appropriately.

If the names between rule, test and xml match as expected, they will be run automatically.

@jsotuyod jsotuyod added the a:new-rule Proposal to add a new built-in rule label Aug 23, 2024
@jsotuyod jsotuyod added this to the 7.5.0 milestone Aug 24, 2024
@adangel adangel changed the title [java] update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock [java] Update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock, new rule AvoidSynchronizedStatement Aug 27, 2024
Copy link
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks!

adangel added a commit that referenced this pull request Aug 29, 2024
adangel added a commit that referenced this pull request Aug 29, 2024
…rantLock, new rule AvoidSynchronizedStatement (#5175)

Merge pull request #5175 from chonton:ReentrantLock
@adangel adangel merged commit 93db59b into pmd:master Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:new-rule Proposal to add a new built-in rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants