javavisual-studio-codedecompiler

How to decompile Java class with correct line numbers in Visual Studio Code?


I am using vscode version 1.92.2 in macOS with Extension Pack for Java v0.29.0. When I command + click or right click -> Go to definition of a class that I do not have source code, vscode opens the .class file using FernFlower decompiler. However it does not maintain the original line numbers. This is for IntelliJ. How to do the same for vscode?

The reason why I require the original line numbers as I can navigate to exact line that threw exception from stack trace.

FYI, I have checked with external decompiler where it shows correct line numbers, means the classes or jar files still have the debug information.


Solution

  • After conducting a thorough search, I have discovered an open issue regarding the implementation of a Java decompiler in Visual Studio Code, which can be found at https://github.com/dgileadi/vscode-java-decompiler/issues/4.

    It appears that this functionality has not been implemented as of yet. Therefore, you have two options: either wait patiently for the implementation to be completed, or take the initiative to implement it yourself.