Skip to content

[java] java-unnecessarycode/UnnecessaryFinalModifier on try-with-resources #676

@jsotuyod

Description

@jsotuyod

When using try-with-resources, the resource variable is implicitly final. We should flag explicit modifiers as unnecessary.

Code Sample demonstrating the issue:

try (final FileWriter fw = new FileWriter(new File("something.txt"))) {
  // do something on fw
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-negativePMD doesn't flag a problematic piece of code

    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