RFR: 8327786: Add fluent setAccessible()
Sergey
duke at openjdk.org
Thu Mar 14 07:01:42 UTC 2024
On Thu, 25 Jan 2024 21:35:45 GMT, Sergey <duke at openjdk.org> wrote:
> The feature allows to extract a private field value in a single expression, like so:
>
> object.getClass().getDeclaredField().setAccessible().get(object)
I'm sorry to hear this. It's done all the time in tests, by third-party libraries. I figured it'd be better if such a common procedure was more convenient
As a side note, encouraging the use of switch by adding more features to it (`when`, etc.) is more questionable than accessing private fields, in my view
Anyway, thanks for your feedback
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17578#issuecomment-1996676960
More information about the core-libs-dev
mailing list