Open volosied opened 2 years ago
The following post says:
If the underlying field is final, a Field object has write access if and only if
- setAccessible(true) has succeeded for this Field object;
- the field is non-static; and
- the field's declaring class is not a hidden class; and
- the field's declaring class is not a record class.
The second point looks to be the issue since our field is static.
@pnicolucci I'd like to close this issue unless you think we should change the unit test code?
@volosied if we can make minor updates to the unit tests it would make sense to do so so we can mark this final in the runtime.
Unit tests failed (when I tried to set the final variable via reflection)
I don't think I can set this to final without the unit tests failing. I kept getting:
java.lang.IllegalAccessException: Can not set static final int field com.ibm.ws.webcontainer.osgi.WebContainer.loadedContainerSpecLevel to (int)30
I even tried using Field.setInt instead.
_Originally posted by @volosied in https://github.com/OpenLiberty/open-liberty/pull/20004#discussion_r803093599_