1111import org .reflections .util .ClasspathHelper ;
1212import org .reflections .util .ConfigurationBuilder ;
1313import org .reflections .util .FilterBuilder ;
14+ import java .lang .reflect .InvocationTargetException ;
1415import org .slf4j .Logger ;
1516import org .slf4j .LoggerFactory ;
1617
@@ -33,7 +34,7 @@ public class GlobalObjectTransformerLoader {
3334 private static volatile ImmutableMap <Class <?>, ObjectMapper <?>> register ;
3435
3536 public static <T > ObjectMapper <T > getObjectMapperForClass (final Class <T > genericType ) throws InstantiationException ,
36- IllegalAccessException {
37+ IllegalAccessException , InvocationTargetException , SecurityException , IllegalArgumentException , NoSuchMethodException , InvocationTargetException {
3738 Preconditions .checkNotNull (genericType , "genericType" );
3839
3940 // performance improvement. Volatile field is read only once in the commons scenario.
@@ -55,15 +56,15 @@ public static <T> ObjectMapper<T> getObjectMapperForClass(final Class<T> generic
5556 }
5657
5758 private static ImmutableMap <Class <?>, ObjectMapper <?>> buildMappers () throws InstantiationException ,
58- IllegalAccessException {
59+ IllegalAccessException , InvocationTargetException , SecurityException , IllegalArgumentException , NoSuchMethodException , InvocationTargetException {
5960
6061 final Map <Class <?>, ObjectMapper <?>> mappers = new HashMap <>();
6162
6263 for (final Class <?> foundGlobalObjectTransformer : findObjectMappers ()) {
6364
6465 if (ObjectMapper .class .isAssignableFrom (foundGlobalObjectTransformer )) {
6566
66- final ObjectMapper <?> mapper = (ObjectMapper <?>) foundGlobalObjectTransformer .newInstance ();
67+ final ObjectMapper <?> mapper = (ObjectMapper <?>) foundGlobalObjectTransformer .getDeclaredConstructor (). newInstance ();
6768 final Class <?> valueTransformerReturnType = mapper .getType ();
6869
6970 final ObjectMapper <?> previousMapper = mappers .put (valueTransformerReturnType , mapper );
0 commit comments