@@ -45,6 +45,14 @@ public final class PropertyBasedCreator
4545 */
4646 protected final SettableBeanProperty [] _allProperties ;
4747
48+ /**
49+ * Indexes of properties with associated Injectable values, if any:
50+ * {@code null} if none.
51+ *
52+ * @since 2.21
53+ */
54+ protected final BitSet _injectablePropIndexes ;
55+
4856 /*
4957 /**********************************************************
5058 /* Construction, initialization
@@ -61,11 +69,8 @@ protected PropertyBasedCreator(DeserializationContext ctxt,
6169 if (caseInsensitive ) {
6270 _propertyLookup = CaseInsensitiveMap .construct (ctxt .getConfig ().getLocale ());
6371 } else {
64- _propertyLookup = new HashMap <String , SettableBeanProperty >();
72+ _propertyLookup = new HashMap <>();
6573 }
66- final int len = creatorProps .length ;
67- _propertyCount = len ;
68- _allProperties = new SettableBeanProperty [len ];
6974
7075 // 26-Feb-2017, tatu: Let's start by aliases, so that there is no
7176 // possibility of accidental override of primary names
@@ -83,14 +88,27 @@ protected PropertyBasedCreator(DeserializationContext ctxt,
8388 }
8489 }
8590 }
91+ final int len = creatorProps .length ;
92+ _propertyCount = len ;
93+ _allProperties = new SettableBeanProperty [len ];
94+ BitSet injectablePropIndexes = null ;
95+
8696 for (int i = 0 ; i < len ; ++i ) {
8797 SettableBeanProperty prop = creatorProps [i ];
8898 _allProperties [i ] = prop ;
8999 // 22-Jan-2018, tatu: ignorable entries should be skipped
90100 if (!prop .isIgnorable ()) {
91101 _propertyLookup .put (prop .getName (), prop );
92102 }
103+ if (prop .getInjectionDefinition () != null ) {
104+ if (injectablePropIndexes == null ) {
105+ injectablePropIndexes = new BitSet (len );
106+ }
107+ injectablePropIndexes .set (i );
108+ }
93109 }
110+
111+ _injectablePropIndexes = injectablePropIndexes ;
94112 }
95113
96114 /**
@@ -102,6 +120,7 @@ protected PropertyBasedCreator(PropertyBasedCreator base,
102120 {
103121 _propertyCount = base ._propertyCount ;
104122 _valueInstantiator = base ._valueInstantiator ;
123+ _injectablePropIndexes = base ._injectablePropIndexes ;
105124 _propertyLookup = propertyLookup ;
106125 _allProperties = allProperties ;
107126 }
0 commit comments