@@ -644,24 +644,21 @@ 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
- // (but do NOT filter out DISABLED ones yet! )
647
+ // (note: will skip ones annotated as DISABLED )
648
648
List <PotentialCreator > constructors = _collectCreators (_classDef .getConstructors ());
649
649
List <PotentialCreator > factories = _collectCreators (_classDef .getFactoryMethods ());
650
650
651
- final PotentialCreator canonical ;
652
-
653
- // Find and mark "canonical" constructor for Records.
651
+ // Then find and mark the "canonical" constructor (if one exists):
652
+ // for Java Records and potentially other types too ("data classes":
654
653
// Needs to be done early to get implicit names populated
654
+ final PotentialCreator canonical ;
655
655
if (_isRecordType ) {
656
656
canonical = JDK14Util .findCanonicalRecordConstructor (_config , _classDef , constructors );
657
657
} else {
658
658
canonical = _annotationIntrospector .findCanonicalCreator (_config , _classDef ,
659
659
constructors , factories );
660
660
}
661
661
662
- // Next: remove creators marked as explicitly disabled
663
- _removeDisabledCreators (constructors );
664
- _removeDisabledCreators (factories );
665
662
// And then remove non-annotated static methods that do not look like factories
666
663
_removeNonFactoryStaticMethods (factories , canonical );
667
664
@@ -762,7 +759,10 @@ private List<PotentialCreator> _collectCreators(List<? extends AnnotatedWithPara
762
759
for (AnnotatedWithParams ctor : ctors ) {
763
760
JsonCreator .Mode creatorMode = _useAnnotations
764
761
? _annotationIntrospector .findCreatorAnnotation (_config , ctor ) : null ;
765
- result .add (new PotentialCreator (ctor , creatorMode ));
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
+ }
766
766
}
767
767
return (result == null ) ? Collections .emptyList () : result ;
768
768
}
0 commit comments