This fits better to the return value of java.lang.reflect.Method.getExceptionTypes which only returns items of Class<?> and not of Class<? extends Throwable> (which I don't know why that's the case, but we should just cope with this)

A real world usage of ExceptionHandlerMethodResolver#resolveMethodByExceptionType is here.

This PR would remove this ugly uncheckedCast for users of ExceptionHandlerMethodResolver. Still the method resolveMethodByExceptionType throws IllegalArgumentException if anything else than Class<? extends Throwable> is passed to the method.

I've also added some test cases to show that it works as expected.

Comment From: neiser

@sbrannen Is there any chance that this PR going to be merged? I'd rebase the PR then to fix the merge conflicts in the meantime.

Comment From: rstoyanchev

@neiser we've discussed this among the team and decided that the current declaration provide good guidance and we do not want to relax the signature in this way. Furthermore this is an SPI that should be used infrequently, which makes it a good trade-off vs requiring a cast.