-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
Description
What problem are you trying to solve?
Apply modern code standards.
I think it used to be a bit of a common practice to denote private class fields with names which either started with or ended with underscores. While technically allowed, I don't think this is mainstream in Java. Thus it makes sense to have a recipe to rename the fields not to have these _
prefixes/suffixes.
Describe the situation before applying the recipe
public class ParseLocation {
private String _ruleName;
public String getRuleName() {
return _ruleName;
}
public void setRuleName(String ruleName) {
_ruleName = ruleName;
}
}
Describe the situation after applying the recipe
public class ParseLocation {
private String ruleName;
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
}
Any additional context
- When making the changes, beware of name clashes. Even visible in the simple setter example above.
- For this reason, not marking this is a good-first-issue.
OSS repro
- leading underscores: https://github.com/apache/pinot/blob/a02253d671d7781acc16b81628e51bd11a3005a0/pinot-spi/src/main/java/org/apache/pinot/spi/utils/builder/TableConfigBuilder.java#L90-L140
- trailing underscores: https://github.com/rstudio/rstudio/blob/0baa88b0d03238603c1adaa1fe96241cd54b1ba7/src/gwt/src/org/rstudio/studio/client/rmarkdown/events/RenderRmdEvent.java#L120-L129
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Recipes Wanted