A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2757 below:

support Lombok's @Cleanup annotation · Issue #2757 · pmd/pmd · GitHub

Affects PMD Version:

6.27.0

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.

  1. clone the repository:
git clone https://github.com/TomerFi/alexa-skill-shabbat-times.git
  1. step into the cloned folder:
cd alexa-skill-shabbat-times
  1. invoke maven goal (no violation is detected with version 6.26.0):
  1. update the pmd.version property in pom.xml to 6.27.0 to catch the violation:
  <properties>
   ...
    <pmd.version>6.27.0</pmd.version>
   ...
  </properties>
  1. invoke maven goal

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