redhat-developer / redhat-developer/vscode-java

Alternative equals code generation

Open
#890 0 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.