redhat-developer / redhat-developer/vscode-java

source.generate.finalModifiers should not add final modifiers to the fields

Open
#3,326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

If I have a field line that:

class User {
    @Parameter(names = { "--age", "-a" }, required = true, description = "User age")
    public int age = 1;
}

following option:

    "[java]": {
        "editor.codeActionsOnSave": {
            "source.generate.finalModifiers": true
        }
    }

add final modifier to it:

class User {
    @Parameter(names = { "--age", "-a" }, required = true, description = "User age")
    public final int age = 1;
}

but it should not, because it can be changes from other code or library like JCommander.

Environment
  • Operating System: macOS Sonoma 14.0
  • JDK version: Zulu 8.72.0.17-CA-macos-aarch64
  • Visual Studio Code version: 1.82.2
  • Java extension version: 0.25.14

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.

Research direction

Start by locating the implementation and tests for source.generate.finalModifiers in the vscode-java codebase. Reproduce the behavior with an annotated, mutable Java field like the issue's User.age example, then add regression coverage showing that the setting does not add final when the field may be changed externally.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.