Affects PMD Version:
Description:
Version 6.27.0 breaks support for Lombok's Cleanup Annotation which generates invocation of the close()
method for closable objects.
Falling back to 6.26.0 works as expected by not producing the same violation.
Exception Stacktrace:
<violation ... rule="CloseResource" ruleset="Error Prone" ... class="ShabbatTimesStreamHandler" method="getCreator" variable="context" externalInfoUrl="https://pmd.github.io/pmd-6.27.0/pmd_rules_java_errorprone.html#closeresource" priority="3"> Ensure that resources like this AnnotationConfigApplicationContext object are closed after use </violation>
Code Sample demonstrating the issue:
Copied from a public repository: TomerFi/alexa-skill-shabbat-times
public class ShabbatTimesStreamHandler extends SkillStreamHandler { private static ShabbatTimesSkillCreator getCreator() { @Cleanup val context = new AnnotationConfigApplicationContext(DiProdConfiguration.class); return context.getBean(ShabbatTimesSkillCreator.class); } public ShabbatTimesStreamHandler() { super(getCreator().getSkill()); } }
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
git clone https://github.com/TomerFi/alexa-skill-shabbat-times.git
cd alexa-skill-shabbat-times
pmd.version
property in pom.xml
to 6.27.0 to catch the violation:<properties> ... <pmd.version>6.27.0</pmd.version> ... </properties>
will now produce:
You have 1 PMD violation.
Running PMD through: Maven
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4