For WildcardType, use Types of upper bounds (i.e. erase wildcard)#244
Merged
bartoszwalacik merged 2 commits intojavers:masterfrom Nov 3, 2015
Merged
Conversation
Member
|
You are right, upper-bounded wildcard should be treated as bound type, so your Pull goes in right direction. Thanks for contributing. Could you please add test case (in Considering your second issue about allowing unbounded wildcards, we could disqus it, but as you said, there should be separate issue/pull for this. |
Contributor
Author
|
Great, thanks. I've added a test to this effect. |
Member
|
Excellent! |
bartoszwalacik
added a commit
that referenced
this pull request
Nov 3, 2015
For WildcardType, use Types of upper bounds (i.e. erase wildcard)
Member
|
going to release it tomorrow morning |
Contributor
Author
|
Great - thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If I try to use JaVers to compare classes with upper-bounded wildcard types, I get an exception with message like the following:
with an instruction to:
For reasons, we cannot easily alter our model to narrow to
Set<Foo>orSet<SpecificSubclassOfFoo>, and anyway we would prefer not to let our choice of this (admittedly wonderful) tool drive such things.The error actually does not say that bounded parameters are not supported, so this pull request - treating wildcards with an upper bound as having the type of the upper bound - seems consistent with it. Certainly the tests still pass, and the behaviour is as we would expect.
In addition (and perhaps this should be the subject of another pull request), a more general change to include unbounded types (which seems like it's the same as "Try at least ") might be worth considering, though such a change would break your tests (but only the ones that expect the GENERIC_TYPE_NOT_PARAMETRIZED error).
We've only recently started using JaVers, and our usage may be fairly narrow, so it's quite possible we've missed some obvious reason why this is not a good idea, but would appreciate if you would consider it.