TypeDescriptor does not check generics in equals
method (for ConversionService caching)
#31672
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Affects: 6.0.14
The type descriptors of
java.util.Optional<java.lang.Integer>
andjava.util.Optional<java.lang.String>
are considered equal.I encountered it in context of
GenericConversionService
caching. Let's say we have two distinctConditionalGenericConverter
as follows(1)
sourceType=Pojo, targetType=Optional<Integer>
(2)
sourceType=Pojo, targetType=Optional<String>
The
GenericConversionService
service is able to cache only one of converters mentioned above. Let's assume we successfully used (1) converter. When we want to convert using (2) converter theGenericConversionService
uses (1) converter which causes class cast exception later.The text was updated successfully, but these errors were encountered: