datatable: Replace wildcard type with its upper bound #829
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.
Summary
When registering steps in Kotlin using Kotlin collections as an argument e.g:
This argument is translated to Java type as
To handle this gracefully the simplified type system used by
DataTable
should understand upper bounds. We do this by replacing the wild card type
with its upper bound.
We can assume this is safe because when registering a transformer to
type ? extends SomeType
the transformer is guaranteed to produce anobject that is an instance of
SomeType
.When transforming a data table to
? extends SomeType
a transformer thatproduces
SomeType
is sufficient.This will result in ambiguity between a transformers for
SomeType
andtransformers for ``? extends SomeType` but that seems reasonable and might be
resolved by using a more specific producer.
Motivation and Context
cucumber/cucumber-jvm#1838
Types of changes