RFR: 8280798: com.sun.jdi.ObjectReference::setValue spec should prohibit any final field modification

Alex Menkov amenkov at openjdk.org
Wed Nov 23 23:12:26 UTC 2022


On Mon, 21 Nov 2022 22:58:54 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> com.sun.jdi.ObjectReference::setValue spec says that final static fields cannot be modified, but openjdk implementation throws IllegalArgumentException for any final fields (static or instance).
> 
> The fix updates the spec to prohibit any final field modification
> CSR: JDK-8281652

I decided to check if VS Code shows the warning as Eclipse does, so I installed VS Code and tried to set final fields in debugger.
For both static and instance fields I got:
Failed to set variable. Reason: java.lang.UnsupportedOperationException: SetVariableRequest: Final field value cannot be changed.

So VS Code DOES NOT allow to set static final fields.

As far as I got VS Code uses Eclipse JDT only for editor (code navigation, auto completion, refactoring, etc), but debugging is implemented by another extension: Debugger for Java (https://github.com/Microsoft/java-debug). I.e. VS Code does not use Eclipse 
JDI implementation.

-------------

PR: https://git.openjdk.org/jdk/pull/11279


More information about the serviceability-dev mailing list