redhat-developer / redhat-developer/vscode-java
Alternative equals code generation
Open
@testforstephen is already working on this.
Since Apr 18, 2019.
code action
enhancement
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
Currently, the first part of an equals method is generated as:
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
// ...
However, I'd prefer to have it as:
if (this == obj) {
return true;
} else if (obj == null || getClass() != obj.getClass()) {
return false;
}
// ...
condensing + adding a blank line after it.
If the current generation should be retained, it would be great to have a configuration option to set the preferred style, analog to what is available for toString generation already.
Environment
- Visual Studio Code version: 1.33.1
- Java extension version: 0.43.0
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.
Assessment
This issue has not been assessed yet.