Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qualifiers preserve their case (no longer forced lower case) for BeanEntry and @QualifierMap keys (but still using case insensitive matching for wiring) #548

Merged
merged 4 commits into from
Apr 25, 2024

Conversation

SentryMan
Copy link
Collaborator

@SentryMan SentryMan commented Apr 20, 2024

Idk about this one, while I do think it's only natural that qualifiers be case sensitive, this can break a lot of stuff


Edit:

  • So qualifier names / keys in a @QualifierMap Map<String,T> will preserve their case (no longer forced toLowerCase)
  • Qualifier names returned by BeanEntry.qualifierName() also preserve their case (no longer forced toLowerCase)

The wiring will still be case insensitive such that @Named("red") and @Red are both matched the same via equalsIgnoreCase being used internally.

- So store the name qualifier in the case that it is given
- Match the qualifier case-insensitively

Effectively the change is that the scope.map() keys as qualifier names
are now returned in original case when they were previously all forced
toLowerCase()
@rbygrave
Copy link
Contributor

only natural that qualifiers be case sensitive, this can break a lot of stuff

For myself I see it more that avaje-inject can keep the original case but use case-insensitive matching. I think that is the more realistic approach, with the view that it is a breaking change for @QualifiedMap Map<String, T> with the keys now keeping their original case (rather than all forced toLowerCase).

@rbygrave rbygrave changed the title Make Qualifiers Case-Sensitive Make Qualifiers Case-Sensitive for BeanEntry and @QualifierMap keys (but still case insensitive matching) Apr 23, 2024
@rbygrave rbygrave changed the title Make Qualifiers Case-Sensitive for BeanEntry and @QualifierMap keys (but still case insensitive matching) Qualifiers preserve their case (no longer forced lower case) for BeanEntry and @QualifierMap keys (but still using case insensitive matching for wiring) Apr 23, 2024
@SentryMan
Copy link
Collaborator Author

For myself I see it more that avaje-inject can keep the original case but use case-insensitive matching.

I'm fine with this then

@SentryMan SentryMan self-assigned this Apr 23, 2024
@rob-bygrave
Copy link
Contributor

I'm fine with this then

Cool.

I think this is an improvement in that the qualifier map keys being forced to all lower case is kind of odd or unexpected. Also preserving the case of the qualifiers gives people a better chance of doing something like an EnumMap.

@rbygrave rbygrave disabled auto-merge April 25, 2024 20:15
@rbygrave rbygrave merged commit 194504c into avaje:master Apr 25, 2024
4 checks passed
@SentryMan SentryMan deleted the case branch April 25, 2024 20:20
@SentryMan SentryMan added this to the 10.0 milestone Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants