xmolecules / jmolecules-integrations

Technology integration for jMolecules
Apache License 2.0
79 stars 21 forks source link

`ConvertibleType` declaration in `IdentifierToPrimitivesConverter` overly specific #246

Closed odrotbohm closed 2 months ago

odrotbohm commented 2 months ago

The detailed declaration of both UUID and String as target conversion types in IdentifierToPrimitivesConverter.getConvertibleTypes() causes problems in Spring Data's CustomConversions as it uses the pairs here to allow clients to detect the target type that will ultimately be handed into the convert(…) method.

This causes issues if the UUID type is returned first, as Identifiers using a sole String will try to be erroneously coerced into a UUID as reported here. Using String as the first value will always cause UUIDs to be rendered as String, even though a store might be able to persist UUIDs directly.

We should rather only return new ConvertiblePair(Identifier.class, Object.class) to delay the decision of which type to use to the actual conversion step.

Related tickets