Skip to content

Add java final variable to existing constructor feature is gone. #3873

Closed

Description

@nguyencobap

In previous version (I dont know cause of this is vscode itself or extension) when I create a final variable and not init it, vscode will suggest add this variable to class constructor. I just have to ctrl + . at class constructor and vscode will suggest add this variable to existing constructor. Now this feature is gone.

When I hover constructor there is an exception in log:

ERR Internal error.: Error: Internal error.
at /home/maychu1/.vscode-server/extensions/redhat.java-1.36.0-linux-x64/dist/extension.js:2:1072098
at re (/home/maychu1/.vscode-server/extensions/redhat.java-1.36.0-linux-x64/dist/extension.js:2:1072392)
at /home/maychu1/.vscode-server/extensions/redhat.java-1.36.0-linux-x64/dist/extension.js:2:1067176
at Immediate. (/home/maychu1/.vscode-server/extensions/redhat.java-1.36.0-linux-x64/dist/extension.js:2:1067196)
at process.processImmediate (node:internal/timers:483:21)

Image

Step to produces:

Create a java class in spring boot project.
Create an empty constructor.
Create a final varibable.
Ctrl + . at class constructor

Activity

  1. TechScar commented on Feb 6, 2025

    @TechScar

    Can confirm I have the same problem. Definitely been facing this issue for at least a few months now, if not since mid-2024. Which is a shame, because it was such a helpful feature.

    The Language Support for Java output prints the following error for me:

    [Error - 8:37:17 AM] Request textDocument/codeAction failed.
      Message: Internal error.
      Code: -32603 
    java.util.concurrent.CompletionException: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
    	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
    	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
    	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
    	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
    	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
    Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
    	at org.eclipse.jdt.internal.ui.text.correction.proposals.InitializeFinalFieldProposalCore.<init>(InitializeFinalFieldProposalCore.java:79)
    	at org.eclipse.jdt.ls.core.internal.corrections.UnInitializedFinalFieldSubProcessor.createInitializeFinalFieldProposal(UnInitializedFinalFieldSubProcessor.java:41)
    	at org.eclipse.jdt.ls.core.internal.corrections.UnInitializedFinalFieldSubProcessor.createInitializeFinalFieldProposal(UnInitializedFinalFieldSubProcessor.java:1)
    	at org.eclipse.jdt.internal.ui.text.correction.UnInitializedFinalFieldBaseSubProcessor.addProposals(UnInitializedFinalFieldBaseSubProcessor.java:72)
    	at org.eclipse.jdt.ls.core.internal.corrections.QuickFixProcessor.process(QuickFixProcessor.java:165)
    	at org.eclipse.jdt.ls.core.internal.corrections.QuickFixProcessor.getCorrections(QuickFixProcessor.java:91)
    	at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:190)
    	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$14(JDTLanguageServer.java:759)
    	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
    	... 7 more
    

    I am running extension version 1.39.0 in VSCode version 1.96.4

  2. datho7561 commented on Jun 24, 2026

    @datho7561
    Contributor

    Seems to be working for me now. I'm guessing something in the past year fixed this. Let me know if you can still reproduce this.

  3. TechScar commented on Jun 25, 2026

    @TechScar

    Wow, I had completely forgotten about this issue - you are right, it's been working for a while now. Always nice when bugs fix themselves 😄

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions