On Mon, 21 Nov 2022 22:58:54 GMT, Alex Menkov <amen...@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

The change makes Eclipse non-compliant, but it shouldn't be a problem as 
Eclipse JDI implementation is used only by Eclipse debugger (we discussed it 
with one of the Eclipse debugger contributors - he doesn't see problem here). 
And it's up to Eclipse team to decide if they want to update the implementation 
or keep it.
Relaxing the spec was one of the solutions considered, but looks like it 
doesn't make much sense.

Reflection allows to modify final instance fields, but its spec has a warning 
that changing final fields is meaningful only in certain cases (which are not 
common for debuggers). So if we decide to update implementation to modify final 
fields, it would be better to add similar warning to JDI spec (additionally to 
"non-modifiable final field" changes described by Alan)

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

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

Reply via email to