A broken setAccessible use case: enhanced diagnostics
russell.gold at oracle.com
Thu Jan 26 12:34:54 UTC 2017
The Glassfish Primitive Function Library (PFL) contains an interesting use case for setAccessible: an enhanced object-to-string capability. Now, in an ideal world, this shouldn’t be needed, as each object provides an adequate toString() method; however, it is not uncommon while trying to diagnose a problem, to need to see the actual state of objects, as represented by their fields, as the toString() function often doesn’t show everything. This is especially important to diagnose problems in production, where one could ask a customer to enable a debug flag. Until now, this was restricted only by the security manager. What can we do to keep such a capability in JDK9?
More information about the jigsaw-dev