@@ -63,48 +63,71 @@ public class AnnotatedClassResolver
63
63
public static AnnotatedClass resolve (MapperConfig <?> config , JavaType forType ,
64
64
MixInResolver r )
65
65
{
66
+ if (forType .isArrayType () && skippableArray (config , forType .getRawClass ())) {
67
+ return createArrayType (config , forType .getRawClass ());
68
+ }
66
69
return new AnnotatedClassResolver (config , forType , r ).resolveFully ();
67
70
}
68
71
72
+ public static AnnotatedClass resolveWithoutSuperTypes (MapperConfig <?> config , Class <?> forType ) {
73
+ return resolveWithoutSuperTypes (config , forType , config );
74
+ }
75
+
69
76
public static AnnotatedClass resolveWithoutSuperTypes (MapperConfig <?> config , JavaType forType ,
70
77
MixInResolver r )
71
78
{
79
+ if (forType .isArrayType () && skippableArray (config , forType .getRawClass ())) {
80
+ return createArrayType (config , forType .getRawClass ());
81
+ }
72
82
return new AnnotatedClassResolver (config , forType , r ).resolveWithoutSuperTypes ();
73
83
}
74
84
75
- public static AnnotatedClass resolveWithoutSuperTypes (MapperConfig <?> config , Class <?> forType ) {
76
- return resolveWithoutSuperTypes (config , forType , config );
77
- }
78
-
79
85
public static AnnotatedClass resolveWithoutSuperTypes (MapperConfig <?> config , Class <?> forType ,
80
86
MixInResolver r )
81
87
{
88
+ if (forType .isArray () && skippableArray (config , forType )) {
89
+ return createArrayType (config , forType );
90
+ }
82
91
return new AnnotatedClassResolver (config , forType , r ).resolveWithoutSuperTypes ();
83
92
}
84
93
94
+ private static boolean skippableArray (MapperConfig <?> config , Class <?> type ) {
95
+ return (config == null ) || (config .findMixInClassFor (type ) == null );
96
+
97
+ }
98
+
85
99
/**
86
- * Internal helper class used for resolving a small set of "primordial" types for which
100
+ * Internal helper method used for resolving a small set of "primordial" types for which
87
101
* we do not accept any annotation information or overrides.
88
102
*/
89
103
static AnnotatedClass createPrimordial (Class <?> raw ) {
90
- Annotations noClassAnn = new AnnotationMap ();
91
104
List <JavaType > superTypes = Collections .emptyList ();
92
- return new AnnotatedClass (null , raw , superTypes , null , noClassAnn ,
105
+ return new AnnotatedClass (null , raw , superTypes , null , NO_ANNOTATIONS ,
106
+ TypeBindings .emptyBindings (), null , null , null );
107
+ }
108
+
109
+ /**
110
+ * Internal helper method used for resolving array types, unless they happen
111
+ * to have associated mix-in to apply.
112
+ */
113
+ static AnnotatedClass createArrayType (MapperConfig <?> config , Class <?> raw ) {
114
+ List <JavaType > superTypes = Collections .emptyList ();
115
+ return new AnnotatedClass (null , raw , superTypes , null , NO_ANNOTATIONS ,
93
116
TypeBindings .emptyBindings (), null , null , null );
94
117
}
95
118
96
119
AnnotatedClass resolveFully () {
97
120
List <JavaType > superTypes = ClassUtil .findSuperTypes (_type , null , false );
98
- Annotations classAnn = resolveClassAnnotations ( superTypes );
99
- return new AnnotatedClass ( _type , _class , superTypes , _primaryMixin , classAnn , _bindings ,
100
- _intr , _mixInResolver , _config .getTypeFactory ());
121
+ return new AnnotatedClass ( _type , _class , superTypes , _primaryMixin ,
122
+ resolveClassAnnotations ( superTypes ) ,
123
+ _bindings , _intr , _mixInResolver , _config .getTypeFactory ());
101
124
102
125
}
103
126
104
127
AnnotatedClass resolveWithoutSuperTypes () {
105
128
List <JavaType > superTypes = Collections .<JavaType >emptyList ();
106
- Annotations classAnn = resolveClassAnnotations ( superTypes );
107
- return new AnnotatedClass ( null , _class , superTypes , _primaryMixin , classAnn ,
129
+ return new AnnotatedClass ( null , _class , superTypes , _primaryMixin ,
130
+ resolveClassAnnotations ( superTypes ) ,
108
131
_bindings , _intr , _config , _config .getTypeFactory ());
109
132
}
110
133
0 commit comments