openrewrite / openrewrite/rewrite-static-analysis
`RenamePrivateFieldsToCamelCase` should not rename annotated fields, similar to `FinalizePrivateFields`
Open
Nobody has claimed this yet.
bug
- Dominant language
- Java
- Stars
- 62
- Forks
- 112
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 40
Description
What version of OpenRewrite are you using?
I am using
- Maven/Gradle plugin v5.22.0
- rewrite-static-analysis_v1.3.0
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.22.0</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.staticanalysis.CommonStaticAnalysis</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-static-analysis</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
</plugin>
What is the smallest, simplest way to reproduce the problem?
Haven't tested this, original has a slightly different name and longer class, but result should be the same.
class A {
private static String USERNAME_TOO_LONG = "User name too long";
}
What did you expect to see?
class A {
private static final String USERNAME_TOO_LONG = "User name too long";
}
What did you see instead?
class A {
private static String usernameTooLong = "User name too long";
}
What is the full stack trace of any errors you encountered?
stacktrace output here
Are you interested in contributing a fix to OpenRewrite?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the RenamePrivateFieldsToCamelCase recipe and compare its behavior with FinalizePrivateFields. Add a regression case for an annotated private field, using the issue's expected result as the reference; done means the annotation is preserved and the field is not renamed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100