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

Kotlin types are lost on specific operations #913

Open
MartinX3 opened this issue May 10, 2022 · 3 comments
Open

Kotlin types are lost on specific operations #913

MartinX3 opened this issue May 10, 2022 · 3 comments
Assignees
Labels
Kotlin Kotlin support

Comments

@MartinX3
Copy link

MartinX3 commented May 10, 2022

With kotlin and smallyre sometimes I need to declare the type again.

Additional details

Examples:

  • .transformToMulti { fetch(it.bananas).onItem().disjoint<Banana>() }
    Without <Banana> it doesn't know that I fetch the Bananas.
  • .call { it -> if (it.type?.entityType == Apple) serviceApple.updateBy(it) else createUniFrom().nullItem<Apple>() }
    Without <Apple> it doesn't know that it should return a nullItem with this type.
    But shouldn't it know it already, because I return an Uni in the true case?
    PS: nullItem<Void> and nullItem<Unit> are working too, which confuses me more.
    There is .voidItem(), but that I would otherwise need to declare the type confuses me.
    Maybe the java code of smallrye confuses kotlin?

Maybe we need kotlin classes as a layer in smallrye which optimize the kotlin compatibility?
As far as I know the Quarkus Framework uses this approach.

PS: I like the word confusing

@jponge jponge added this to Backlog in Mutiny development via automation May 10, 2022
@heubeck
Copy link
Collaborator

heubeck commented May 13, 2022

Like the idea and would love to investigate, unfortunately, I'm blocked for the next month.
@MartinX3 how about meet at https://www.cloudland.org/ and discuss in person? ;)

@MartinX3
Copy link
Author

MartinX3 commented Jun 28, 2022

@heubeck Sadly it's too expensive for me and I use Mutiny only for my job.
I don't use it in my volunteer tasks and my studies, so I also don't have time as well.

I found a new issue
It needs the type for the mapping function.
So .map(List<Double>::average) and .map { it.average() } are working, but .map(::average) throws an error.

    fun findAverageScoreByA(id: UUID): Uni<Double> =
        stream("b.aId", id).group().by { it.category.name }
            .onItem().transformToUniAndMerge { it.collect().asList() }.map { it.map(b::score).average() }
            .collect().asList().map(List<Double>::average)

@heubeck
Copy link
Collaborator

heubeck commented Jul 6, 2022

Thanks @MartinX3 ,
no issue, my own organization has a way to go as well in regards of official support on OSS contributions.

Just keep reporting, will care as soon as possible.

@heubeck heubeck added the Kotlin Kotlin support label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kotlin Kotlin support
Projects
No open projects
Development

No branches or pull requests

2 participants