@@ -232,28 +232,42 @@ public Class<?> materializeGenericType(MapperConfig<?> config, JavaType type)
232
232
String abstractName = _defaultPackage +"abstract." +cls .getName ()+"_TYPE_RESOLVE" ;
233
233
TypeBuilder tb = new TypeBuilder (type );
234
234
byte [] code = tb .buildAbstractBase (abstractName );
235
- Class <?> raw = _classLoader . loadAndResolve (abstractName , code , cls );
235
+ Class <?> raw = _loadAndResolve (abstractName , code , cls );
236
236
// and only with that intermediate non-generic type, do actual materialization
237
237
AnnotatedClass ac = AnnotatedClassResolver .resolve (config ,
238
238
config .getTypeFactory ().constructType (raw ), config );
239
- return materializeRawType (config , ac );
239
+ final String implClassName = _defaultPackage + cls .getName ();
240
+ return _materializeRawType (config , ac , implClassName );
240
241
}
241
242
242
243
/**
243
244
* NOTE: should not be called for generic types.
244
245
*
245
246
* @since 2.4
246
247
*/
247
- public Class <?> materializeRawType (MapperConfig <?> config , AnnotatedClass typeDef )
248
+ public Class <?> materializeRawType (MapperConfig <?> config , AnnotatedClass typeDef ) {
249
+ Class <?> rawType = typeDef .getRawType ();
250
+ final String implClassName = _defaultPackage + rawType .getName ();
251
+ return _materializeRawType (config , typeDef , implClassName );
252
+ }
253
+
254
+ // @since 2.12 refactored to allow passing specific name to use; needed to support
255
+ // both generic and non-generic cases
256
+ protected Class <?> _materializeRawType (MapperConfig <?> config , AnnotatedClass typeDef ,
257
+ String nameToUse )
248
258
{
249
259
final JavaType type = typeDef .getType ();
250
260
Class <?> rawType = type .getRawClass ();
251
- String newName = _defaultPackage +rawType .getName ();
252
261
BeanBuilder builder = BeanBuilder .construct (config , type , typeDef );
253
- byte [] bytecode = builder .implement (isEnabled (Feature .FAIL_ON_UNMATERIALIZED_METHOD )).build (newName );
254
- return _classLoader . loadAndResolve ( newName , bytecode , rawType );
262
+ byte [] bytecode = builder .implement (isEnabled (Feature .FAIL_ON_UNMATERIALIZED_METHOD )).build (nameToUse );
263
+ return _loadAndResolve ( nameToUse , bytecode , rawType );
255
264
}
256
265
266
+ // @since 2.12
267
+ protected Class <?> _loadAndResolve (String className , byte [] bytecode , Class <?> rawType ) {
268
+ return _classLoader .loadAndResolve (className , bytecode , rawType );
269
+ }
270
+
257
271
// private until 2.9.9
258
272
protected boolean _suitableType (JavaType type )
259
273
{
0 commit comments