@@ -247,12 +247,12 @@ protected ValueInstantiator _constructDefaultValueInstantiator(DeserializationCo
247
247
BeanDescription beanDesc )
248
248
throws JsonMappingException
249
249
{
250
+ final MapperConfig <?> config = ctxt .getConfig ();
251
+ final PotentialCreators potentialCreators = beanDesc .getPotentialCreators ();
250
252
final CreatorCollectionState ccState ;
251
253
final ConstructorDetector ctorDetector ;
252
- final PotentialCreators potentialCreators = beanDesc .getPotentialCreators ();
253
254
254
255
{
255
- final MapperConfig <?> config = ctxt .getConfig ();
256
256
// need to construct suitable visibility checker:
257
257
final VisibilityChecker <?> vchecker = config .getDefaultVisibilityChecker (beanDesc .getBeanClass (),
258
258
beanDesc .getClassInfo ());
@@ -292,6 +292,16 @@ protected ValueInstantiator _constructDefaultValueInstantiator(DeserializationCo
292
292
if (isNonStaticInnerClass ) {
293
293
// TODO: look for `@JsonCreator` annotated ones, throw explicit exception?
294
294
} else {
295
+ // First things first: the "default constructor" (zero-arg
296
+ // constructor; whether implicit or explicit) is NOT included
297
+ // in list of constructors, so needs to be handled separately.
298
+ AnnotatedConstructor defaultCtor = beanDesc .findDefaultConstructor ();
299
+ if (defaultCtor != null ) {
300
+ if (!ccState .creators .hasDefaultCreator () || _hasCreatorAnnotation (config , defaultCtor )) {
301
+ ccState .creators .setDefaultCreator (defaultCtor );
302
+ }
303
+ }
304
+
295
305
// 18-Sep-2020, tatu: Although by default implicit introspection is allowed, 2.12
296
306
// has settings to prevent that either generally, or at least for JDK types
297
307
final boolean findImplicit = ctorDetector .shouldIntrospectorImplicitConstructors (beanDesc .getBeanClass ());
@@ -354,7 +364,13 @@ public ValueInstantiator _valueInstantiatorInstance(DeserializationConfig config
354
364
355
365
/*
356
366
/**********************************************************************
357
- /* Creator introspection: constructor creator introspection
367
+ /* Creator introspection: new (2.18) helper methods
368
+ /**********************************************************************
369
+ */
370
+
371
+ /*
372
+ /**********************************************************************
373
+ /* OLD Creator introspection: constructor creator introspection
358
374
/**********************************************************************
359
375
*/
360
376
@@ -369,15 +385,6 @@ protected void _addExplicitConstructorCreators(DeserializationContext ctxt,
369
385
final VisibilityChecker <?> vchecker = ccState .vchecker ;
370
386
final Map <AnnotatedWithParams , BeanPropertyDefinition []> creatorParams = ccState .creatorParams ;
371
387
372
- // First things first: the "default constructor" (zero-arg
373
- // constructor; whether implicit or explicit) is NOT included
374
- // in list of constructors, so needs to be handled separately.
375
- AnnotatedConstructor defaultCtor = beanDesc .findDefaultConstructor ();
376
- if (defaultCtor != null ) {
377
- if (!creators .hasDefaultCreator () || _hasCreatorAnnotation (config , defaultCtor )) {
378
- creators .setDefaultCreator (defaultCtor );
379
- }
380
- }
381
388
// 21-Sep-2017, tatu: First let's handle explicitly annotated ones
382
389
for (AnnotatedConstructor ctor : beanDesc .getConstructors ()) {
383
390
JsonCreator .Mode creatorMode = intr .findCreatorAnnotation (config , ctor );
0 commit comments