Skip to content

AvoidSynchronizedStatement reported usage of synchronized #15821

@romani

Description

@romani

from #15812
https://pmd.github.io/pmd/pmd_rules_java_multithreading.html#avoidsynchronizedstatement

[INFO] --- maven-pmd-plugin:3.24.0:check (default-cli) @ checkstyle ---
[WARNING] PMD Failure: com.puppycrawl.tools.checkstyle.DefaultLogger:175
 Rule:AvoidSynchronizedStatement Priority:3 Use ReentrantLock rather than synchronization.
[WARNING] PMD Failure: com.puppycrawl.tools.checkstyle.MetadataGeneratorLogger:101
 Rule:AvoidSynchronizedStatement Priority:3 Use ReentrantLock rather than synchronization.
[WARNING] PMD Failure: com.puppycrawl.tools.checkstyle.XMLLogger:142
 Rule:AvoidSynchronizedStatement Priority:3 Use ReentrantLock rather than synchronization.
[WARNING] PMD Failure: com.puppycrawl.tools.checkstyle.XMLLogger:189
 Rule:AvoidSynchronizedStatement Priority:3 Use ReentrantLock rather than synchronization.
[WARNING] PMD Failure: com.puppycrawl.tools.checkstyle.XMLLogger:230
 Rule:AvoidSynchronizedStatement Priority:3 Use ReentrantLock rather than synchronization.

TODO: investigate why we have it and propose better solution.

To reproduce on local:
Revert suppressions https://github.com/checkstyle/checkstyle/pull/15812/files#diff-cda028477105c63d8f2be55eb016d5c52a475ab6cc8e0cade11c5b80e5f98127R69
Run mvn clean verify
It will fail on pmd violations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions