[apex] Duplicate warning for EmptyStatementBlock and EmptyIfStmt
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5.5k
- Forks
- 1.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 54
Description
Affects PMD Version:
PMD 6.32
Description:
With a class that contains code like this:
[...]
if( processCasesMap.containsKey('C_RT_TakeoverEle') ) {}
[...]
PMD will report 2 warnings, one for ]EmptyStatementBlock](https://pmd.github.io/latest/pmd_rules_apex_errorprone.html#emptystatementblock) the other for EmptyIfStmt on the same line
Code Sample demonstrating the issue:
is reporting duplicate warning on the following lines:

Steps to reproduce:
- Download the TestClass.cls.txt file
- Rename the file to TestClass.cls
- run PMF 6.32 with apex_ruleset.xml.txt
Running PMD through: [CLI]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report with TestClass.cls.txt and apex_ruleset.xml.txt using the PMD CLI, then inspect the EmptyStatementBlock and EmptyIfStmt rules. Done means the empty if statement no longer produces duplicate warnings while the relevant rule behavior remains covered.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100