bug: `Command.Builder<C>.senderType` must narrow the sender type down
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 548
- Forks
- 60
- PR merge metrics
- No merged PRs in 30d
Description
As can be seen from this line:
https://github.com/Incendo/cloud/blob/3c83f9a680609299894406a2de2502209c16f113/cloud-kotlin/cloud-kotlin-extensions/src/main/kotlin/org/incendo/cloud/kotlin/extension/CommandBuildingExtensions.kt#L81
The type is not being narrowed, even though the Java version of the method for both Class and TypeToken overloads does narrow it down. This could be fixed in the following way:
public fun <C : Any, N : C> Command.Builder<C>.senderType(type: KClass<out N>): Command.Builder<N> =
senderType(type.java)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at cloud-kotlin/cloud-kotlin-extensions/src/main/kotlin/org/incendo/cloud/kotlin/extension/CommandBuildingExtensions.kt:81 and compare the Java Class and TypeToken overloads mentioned in the issue. Confirm that the KClass overload narrows Command.Builder to Command.Builder for KClass, and verify that the resulting Kotlin API has the expected inferred sender type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100