@@ -644,7 +644,7 @@ protected void _addCreators(Map<String, POJOPropertyBuilder> props)
644
644
final PotentialCreators creators = _potentialCreators ;
645
645
646
646
// First, resolve explicit annotations for all potential Creators
647
- // (note: will skip ones annotated as DISABLED)
647
+ // (but do NOT filter out DISABLED ones yet! )
648
648
List <PotentialCreator > constructors = _collectCreators (_classDef .getConstructors ());
649
649
List <PotentialCreator > factories = _collectCreators (_classDef .getFactoryMethods ());
650
650
@@ -658,7 +658,10 @@ protected void _addCreators(Map<String, POJOPropertyBuilder> props)
658
658
canonical = _annotationIntrospector .findPrimaryCreator (_config , _classDef ,
659
659
constructors , factories );
660
660
}
661
-
661
+ // Next: remove creators marked as explicitly disabled
662
+ _removeDisabledCreators (constructors );
663
+ _removeDisabledCreators (factories );
664
+
662
665
// And then remove non-annotated static methods that do not look like factories
663
666
_removeNonFactoryStaticMethods (factories , canonical );
664
667
@@ -759,14 +762,23 @@ private List<PotentialCreator> _collectCreators(List<? extends AnnotatedWithPara
759
762
for (AnnotatedWithParams ctor : ctors ) {
760
763
JsonCreator .Mode creatorMode = _useAnnotations
761
764
? _annotationIntrospector .findCreatorAnnotation (_config , ctor ) : null ;
762
- // 06-Jul-2024, tatu: Let's immediately drop ones marked for ignoral
763
- if (creatorMode != JsonCreator .Mode .DISABLED ) {
764
- result .add (new PotentialCreator (ctor , creatorMode ));
765
- }
765
+ // 06-Jul-2024, tatu: Can't yet drop DISABLED ones; add all (for now)
766
+ result .add (new PotentialCreator (ctor , creatorMode ));
766
767
}
767
768
return (result == null ) ? Collections .emptyList () : result ;
768
769
}
769
770
771
+ private void _removeDisabledCreators (List <PotentialCreator > ctors )
772
+ {
773
+ Iterator <PotentialCreator > it = ctors .iterator ();
774
+ while (it .hasNext ()) {
775
+ // explicitly prevented? Remove
776
+ if (it .next ().creatorMode () == JsonCreator .Mode .DISABLED ) {
777
+ it .remove ();
778
+ }
779
+ }
780
+ }
781
+
770
782
private void _removeNonVisibleCreators (List <PotentialCreator > ctors )
771
783
{
772
784
Iterator <PotentialCreator > it = ctors .iterator ();
0 commit comments