mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 08:24:13 +00:00
Prior to this commit, ConversionService#canConvert(Class, Class) threw an IllegalArgumentException when invoked with Enum.class as the target type (i.e., `canConvert(String.class, Enum.class)`), because ConverterFactory#getConverter() in StringToEnumConverterFactory and IntegerToEnumConverterFactory eagerly resolved the concrete enum type. To address that, StringToEnumConverterFactory and IntegerToEnumConverterFactory now implement ConditionalConverter so that matches() can reject non-concrete-enum targets before getConverter() is ever invoked. Closes gh-34532 Signed-off-by: MoonFruit <dkmoonfruit@gmail.com> Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com>