Skip to content

Commit f91ec27

Browse files
authored
One more tweak post #4515 to remove non-visible implicit factory methods (#4549)
1 parent b6af5aa commit f91ec27

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertiesCollector.java

+14
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,9 @@ protected void _addCreators(Map<String, POJOPropertyBuilder> props)
713713
}
714714

715715
// Anything else left, add as possible implicit Creators
716+
// ... but first, trim non-visible
717+
_removeNonVisibleCreators(constructors);
718+
_removeNonVisibleCreators(factories);
716719
creators.setImplicitDelegating(constructors, factories);
717720

718721
// And finally add logical properties for the One Properties-based
@@ -765,6 +768,17 @@ private void _removeDisabledCreators(List<PotentialCreator> ctors)
765768
}
766769
}
767770

771+
private void _removeNonVisibleCreators(List<PotentialCreator> ctors)
772+
{
773+
Iterator<PotentialCreator> it = ctors.iterator();
774+
while (it.hasNext()) {
775+
PotentialCreator ctor = it.next();
776+
if (!_visibilityChecker.isCreatorVisible(ctor.creator())) {
777+
it.remove();
778+
}
779+
}
780+
}
781+
768782
private void _removeNonFactoryStaticMethods(List<PotentialCreator> ctors)
769783
{
770784
final Class<?> rawType = _type.getRawClass();

0 commit comments

Comments
 (0)