Affects PMD Version: 6.0.1
Rule: errorprone.xml/EmptyStatementBlock, but maybe others as well
Description:
Supressing this violation with @SuppressWarnings("PMD.EmptyStatementBlock") doesn't work.
Code Sample demonstrating the issue:
public class ConfigExtractor {
@SuppressWarnings("PMD.EmptyStatementBlock")
public static void orgIdent () {
}
}
as well as this:
@SuppressWarnings("PMD.EmptyStatementBlock")
public class ConfigExtractor {
public static void orgIdent () {
}
}
Running PMD through: [CLI]
See https://sourceforge.net/p/pmd/discussion/188193/thread/9ae8d154/
True. It doesn't work. For a simple and a more complex reason. You can't use " in Apex. Replace it with a single '.
@SuppressWarnings('PMD.EmptyStatementBlock')
The other reason is that Salesforce currently doesn't compile Apex classes with that annotation. I will take care about this. Please assign it to me.
@rsoesemann can you grant login access to Salesforce Support from a test org where that fails and send me the organizationId, as well as a sample class that fails to compile? (you can send these to me out of band if you prefer).
@capeterson I was wrong. The Dev Console perfectly saved a class using the annotation. It was my IDE which rejected it in a way. (I created a bug with @SCWells72 at https://bitbucket.org/RoseSilverSoftware/illuminatedcloud/issues/866).
@adangel I tried it with 6.0.1 and added a test and it works perfectly when you use
@SuppressWarnings('PMD.EmptyStatementBlock')
instead of
@SuppressWarnings("PMD.EmptyStatementBlock")
Please close this.
@adangel if the example above doesn't work in your org, please do provide the orgId so I can check into any environmental factors that might contribute, but this should work.
@adangel @rsoesemann I'd keep this open. Our doc currently tells people to use double quotes instead of single quotes. We should update it https://pmd.github.io/pmd-6.0.1/pmd_userdocs_suppressing.html
@jsotuyod Maybe you should rename it then.
Most helpful comment
@adangel @rsoesemann I'd keep this open. Our doc currently tells people to use double quotes instead of single quotes. We should update it https://pmd.github.io/pmd-6.0.1/pmd_userdocs_suppressing.html