This repository was archived by the owner on Jan 22, 2019. It is now read-only.
File tree 3 files changed +35
-2
lines changed
main/java/com/fasterxml/jackson/module/jaxb
test/java/com/fasterxml/jackson/module/jaxb/types
3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ Project: jackson-module-jaxb-annotations
8
8
9
9
No changes since 2.7
10
10
11
+ 2.7.9 (not yet released)
12
+
13
+ #63: Error in type resolution of reference type (`Optional`)
14
+ (reported by adrianriley@github)
15
+
11
16
2.7.8 (26-Sep-2016)
12
17
2.7.7 (27-Aug-2016)
13
18
2.7.6 (23-Jul-2016)
Original file line number Diff line number Diff line change @@ -563,8 +563,8 @@ public TypeResolverBuilder<?> findPropertyContentTypeResolver(MapperConfig<?> co
563
563
/* First: let's ensure property is a container type: caller should have
564
564
* verified but just to be sure
565
565
*/
566
- if (! containerType .isContainerType () ) {
567
- throw new IllegalArgumentException ("Must call method with a container type (got " +containerType +")" );
566
+ if (containerType .getContentType () == null ) {
567
+ throw new IllegalArgumentException ("Must call method with a container or reference type (got " +containerType +")" );
568
568
}
569
569
return _typeResolverFromXmlElements (am );
570
570
}
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .module .jaxb .types ;
2
+
3
+ import java .util .concurrent .atomic .AtomicReference ;
4
+
5
+ import com .fasterxml .jackson .databind .ObjectMapper ;
6
+ import com .fasterxml .jackson .module .jaxb .BaseJaxbTest ;
7
+
8
+ // [jaxb-annotations#63]
9
+ public class OptionalTypeRefinementTest extends BaseJaxbTest
10
+ {
11
+ static class Stuff63 {
12
+ public AtomicReference <String > value = new AtomicReference <String >("abc" );
13
+ }
14
+
15
+ public void testWithReferenceType () throws Exception
16
+ {
17
+ final ObjectMapper mapper = getJaxbMapper ();
18
+
19
+ String json = mapper .writeValueAsString (new Stuff63 ());
20
+ assertEquals ("{\" value\" :\" abc\" }" , json );
21
+
22
+ Stuff63 result = mapper .readValue ("{\" value\" :\" xyz\" }" ,
23
+ Stuff63 .class );
24
+ assertNotNull (result );
25
+ assertNotNull (result .value );
26
+ assertEquals ("xyz" , result .value .get ());
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments