Affects: 5.2.7
When using Jackson2ObjectMapperBuilder#modulesToInstall(Class<? extends Module>...)
you get the following warning
Type safety: A generic array of Class<? extends Module> is created for a varargs parameter
This can for example be seen in Jackson2ObjectMapperBuilderTests#customizeWellKnownModulesWithModuleClass()
which needs an additional @SuppressWarnings("unchecked")
This could easily be solved by annotating #modulesToInstall
with @SafeVarargs
instead of @SuppressWarnings("unchecked")
. The downside of this is that #modulesToInstall
would have to be declared final
. If this is acceptable I can submit a PR.
This also applied to Jackson2ObjectMapperFactoryBean#setModulesToInstall(Class<? extends Module>...)
.
Comment From: sbrannen
After a brief discussion with @jhoeller, we've decided that this sort of change should be acceptable in 5.3.
Thus, feel free to submit a PR with the use of @SafeVarargs
. Also, feel free to make all such builder methods final
since they are not generally meant to be overridden in custom subclasses.
Comment From: marschall
Awesome
Comment From: sbrannen
Superseded by #25311