Skip to content

ClassCastException possible when converting to a target type that is a subtype of T for a Converter<S, T> convertible type. [SPR-8718] #13360

@spring-projects-issues

Description

@spring-projects-issues

Keith Donald opened SPR-8718 and commented

test case:

  • register a StringToColorConverter implementing Converter<String, Color>
  • ask the conversion service to convert a String to a MyColor, where MyColor extends Color.
  • a class cast exception will occur, because a Color instance will be returned, which is not a MyColor.

instead of a class cast exception, a converter not found exception should be thrown.


Affects: 3.0.6

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions