Repository navigation
apply property suppression after all bean introspectors - #449
Open
rootvector2 wants to merge 1 commit into
Open
rootvector2 wants to merge 1 commit into
rootvector2 wants to merge 1 commit into
Conversation
fetchIntrospectionData ran the introspectors in registration order, so an introspector added after a SuppressPropertiesBeanIntrospector could add a suppressed property back. FluentPropertyBeanIntrospector does this for any suppressed property with a plain setter, making it writable again through populate/setProperty. Re-apply the suppressed names once all introspectors have run.
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fetchIntrospectionDataruns the registeredBeanIntrospectors strictly in registration order, andSuppressPropertiesBeanIntrospectoronly removes descriptors that exist at its turn, so an introspector added after it can put a suppressed property back. WithSuppressPropertiesBeanIntrospector(["admin"])followed byFluentPropertyBeanIntrospector, the fluent introspector sees the plainvoid setAdmin(boolean), finds noadmindescriptor and adds a write-only one, soBeanUtilsBean.populate(account, {"name": "bob", "admin": "true"})callssetAdmin(true)(isWriteable(account, "admin")istrue). The user guide describes suppressed names as properties that "should not be accessible on beans" with no ordering caveat, and the built-inSUPPRESS_CLASS/SUPPRESS_DECLARING_CLASSinstances always sit before any introspector added throughaddBeanIntrospector. The fix re-applies every suppressor's names once the loop finishes, so suppression no longer depends on registration order; orderings that already worked are unchanged. This is a different path from #413/#431 (mapped fallback ingetPropertyDescriptor) and #435 (stale cache): here the cached introspection data itself contains the suppressed descriptor. Found while auditing how the introspector chain interacts with suppression.PropertyUtilsTest#testCustomIntrospectionSuppressedPropertyNotRestoredByLaterIntrospectorfails without the change (the fluent write-onlystringPropertydescriptor is returned) and passes with it;mvndefault goal green (1318 tests, 0 failures, rat/checkstyle/javadoc clean).mvn; that'smvnon the command line by itself.