File tree 1 file changed +6
-5
lines changed
src/main/java/com/fasterxml/jackson/databind/ser
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -688,18 +688,19 @@ protected List<BeanPropertyWriter> filterBeanProperties(SerializationConfig conf
688
688
protected List <BeanPropertyWriter > filterUnwantedJDKProperties (SerializationConfig config ,
689
689
BeanDescription beanDesc , List <BeanPropertyWriter > props )
690
690
{
691
- // First, only consider something that implement `CharSequence`
691
+ // First, only consider something that implements `CharSequence`
692
692
if (beanDesc .getType ().isTypeOrSubTypeOf (CharSequence .class )) {
693
- Iterator < BeanPropertyWriter > it = props . iterator ();
694
- while ( it . hasNext () ) {
695
- BeanPropertyWriter prop = it . next ( );
693
+ // And only has a single property from "isEmpty()" default method
694
+ if ( props . size () == 1 ) {
695
+ BeanPropertyWriter prop = props . get ( 0 );
696
696
// And only remove property induced by `isEmpty()` method declared
697
697
// in `CharSequence` (default implementation)
698
+ // (could in theory relax this limit, probably but... should be fine)
698
699
AnnotatedMember m = prop .getMember ();
699
700
if ((m instanceof AnnotatedMethod )
700
701
&& "isEmpty" .equals (m .getName ())
701
702
&& m .getDeclaringClass () == CharSequence .class ) {
702
- it .remove ();
703
+ props .remove (0 );
703
704
}
704
705
}
705
706
}
You can’t perform that action at this time.
0 commit comments