Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS #997

Closed
cowtowncoder opened this issue Nov 5, 2015 · 0 comments
Closed

Add MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS #997

cowtowncoder opened this issue Nov 5, 2015 · 0 comments
Milestone

Comments

@cowtowncoder
Copy link
Member

(note: offshoot of #992)

By default, Jackson will try to call setAccessible(true) on all methods and fields it has to access via Reflection. This is necessary for cases where member are non-public, but it has also been beneficial for other cases since doing so will suppress some access checks JVM would otherwise perform; this was benchmarked to have significant effect on JDK 1.5 at least.

It is possible to suppress all calls to setAccessible by disabling MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS. This is needed on platforms where SecurityManager prevents all access.
However, it seems useful to also allow more granular change, to avoid calls for public members, and only try to make it for non-public cases where access would otherwise fail.

To do this, let's add new MapperFeature, OVERRIDE_PUBLIC_ACCESS_MODIFIERS in 2.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant