File tree 5 files changed +29
-2
lines changed
main/java/com/fasterxml/jackson/databind
test/java/com/fasterxml/jackson/databind
5 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -203,3 +203,7 @@ Zoltan Farkas (zolyfarkas@github)
203
203
Ludevik@github:
204
204
* Reported #682: Class<?>-valued Map keys not serialized properly
205
205
(2.5.1)
206
+
207
+ Charles Allen (drcrallen@github)
208
+ * Reported #696: Copy constructor does not preserve `_injectableValues`
209
+ (2.6.0)
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ Project: jackson-databind
7
7
2.6.0 (not yet released)
8
8
9
9
#649: Make `BeanDeserializer` use new `parser.nextFieldName()` and `.hasTokenId()` methods
10
+ #696: Copy constructor does not preserve `_injectableValues`
11
+ (reported by Charles A)
10
12
11
13
2.5.1 (not yet released)
12
14
Original file line number Diff line number Diff line change @@ -412,6 +412,8 @@ protected ObjectMapper(ObjectMapper src)
412
412
_subtypeResolver = src ._subtypeResolver ;
413
413
_rootNames = new RootNameLookup ();
414
414
_typeFactory = src ._typeFactory ;
415
+ _injectableValues = src ._injectableValues ;
416
+
415
417
HashMap <ClassKey ,Class <?>> mixins = new HashMap <ClassKey ,Class <?>>(src ._mixInAnnotations );
416
418
_mixInAnnotations = mixins ;
417
419
_serializationConfig = new SerializationConfig (src ._serializationConfig , mixins );
@@ -1522,7 +1524,14 @@ public ObjectMapper setInjectableValues(InjectableValues injectableValues) {
1522
1524
_injectableValues = injectableValues ;
1523
1525
return this ;
1524
1526
}
1525
-
1527
+
1528
+ /**
1529
+ * @since 2.6
1530
+ */
1531
+ public InjectableValues getInjectableValues () {
1532
+ return _injectableValues ;
1533
+ }
1534
+
1526
1535
/**
1527
1536
* Method for overriding default locale to use for formatting.
1528
1537
* Default value used is {@link Locale#getDefault()}.
Original file line number Diff line number Diff line change @@ -834,7 +834,14 @@ public TypeFactory getTypeFactory() {
834
834
public ContextAttributes getAttributes () {
835
835
return _config .getAttributes ();
836
836
}
837
-
837
+
838
+ /**
839
+ * @since 2.6
840
+ */
841
+ public InjectableValues getInjectableValues () {
842
+ return _injectableValues ;
843
+ }
844
+
838
845
/*
839
846
/**********************************************************
840
847
/* Deserialization methods; basic ones to support ObjectCodec first
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ public void testProps()
47
47
assertNotNull (m .getNodeFactory ());
48
48
JsonNodeFactory nf = JsonNodeFactory .instance ;
49
49
m .setNodeFactory (nf );
50
+ assertNull (m .getInjectableValues ());
50
51
assertSame (nf , m .getNodeFactory ());
51
52
}
52
53
@@ -138,13 +139,17 @@ public void testCopy() throws Exception
138
139
assertTrue (m .isEnabled (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES ));
139
140
m .disable (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES );
140
141
assertFalse (m .isEnabled (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES ));
142
+ InjectableValues inj = new InjectableValues .Std ();
143
+ m .setInjectableValues (inj );
141
144
142
145
// // First: verify that handling of features is decoupled:
143
146
144
147
ObjectMapper m2 = m .copy ();
145
148
assertFalse (m2 .isEnabled (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES ));
146
149
m2 .enable (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES );
147
150
assertTrue (m2 .isEnabled (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES ));
151
+ assertSame (inj , m2 .getInjectableValues ());
152
+
148
153
// but should NOT change the original
149
154
assertFalse (m .isEnabled (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES ));
150
155
You can’t perform that action at this time.
0 commit comments