Skip to content

Differentiate between TypeDescriptors with same annotations but different attributes [SPR-13714] #18287

Closed

Description

@spring-projects-issues

Nathan Piper opened SPR-13714 and commented

The current implementation of TypeDescriptor.equals only checks for the presence of matching annotations when comparing two type descriptors (as apposed to testing property values for the same annotation on both type descriptors). This ultimately leads to problems when used with the GenericConversionService cache as the service can return the wrong converter when multiple converters are being used that rely on annotations with distinct property values.


Affects: 4.2.3

Reference URL: #924

Issue Links:

Activity

  1. spring-projects-issues commented on Nov 21, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Nathan Piper commented

    I have submitted a fix in this pull request:

    #924

  2. spring-projects-issues commented on Nov 23, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    As far as I can see, this is actually intentional: Converters are usually triggered by a specific annotation type and then process the specific annotation attributes for each invocation; see e.g. AnnotationFormatterFactory. For that purpose, caching converters per annotation type is optimal.

    That said, I do see the point that registering converters for specific annotation attribute values would be nice to have. I'll turn this into an improvement ticket for the 4.3 timeframe, assuming that we're able to accept the cache overhead of one entry per attribute combination then.

    Juergen

  3. spring-projects-issues commented on Dec 18, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Rolled in a slightly revised form, including the suggested TypeDescriptorTests unit test as well as an actual test for converter matching in GenericConversionServiceTests.

    Juergen

  4. added
    type: enhancement
    in: core
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions