We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
From checkstyle/checkstyle#3323
public class TestClass { public void somePublicMethod() { try (FileOutputStream out = new FileOutputStream("......")) { //... } } }
public class TestClass { public void somePublicMethod() { try (final FileOutputStream out = new FileOutputStream("......")) { //... } } }
This is an interesting one as Checkstyle will flag this as a redundant modifier via checkstyle/checkstyle#3323 RedundantModifier. The JLS spec has try/with resources variables implicitly final as per https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.20.3
RedundantModifier
You can see the implementation here https://github.com/checkstyle/checkstyle/blob/888a78f904ea173a4d5e71825aa63c3f35130376/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java#L211
The text was updated successfully, but these errors were encountered:
Thanks for the report! Looks like we could do something very similar to what we already do for for-loops:
rewrite-static-analysis/src/main/java/org/openrewrite/staticanalysis/FinalizeLocalVariables.java
Lines 61 to 63 in 6646f06
Sorry, something went wrong.
No branches or pull requests
What is the smallest, simplest way to reproduce the problem?
From checkstyle/checkstyle#3323
What did you expect to see?
What did you see instead?
This is an interesting one as Checkstyle will flag this as a redundant modifier via checkstyle/checkstyle#3323
RedundantModifier
. The JLS spec has try/with resources variables implicitly final as per https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.20.3You can see the implementation here https://github.com/checkstyle/checkstyle/blob/888a78f904ea173a4d5e71825aa63c3f35130376/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java#L211
Are you interested in contributing a fix to OpenRewrite?
The text was updated successfully, but these errors were encountered: