Skip to content

Force Vertx Rx CodeGen To Generate MayBe As Return Type(Kotlin) #71

Open
@c-nnooka

Description

@c-nnooka

I am using following Kotlin code to generate proxy (This will also generate Rx methods)

@ProxyGen
@VertxGen
interface JobService {
    @Fluent
    fun getCertain(jobId: Int, handler: Handler<AsyncResult<Job?>>): JobService
}

When I see generated Rx Code it is as follows.

public Single<Job> rxGetCertain(int jobId) { 
   return new io.vertx.reactivex.core.impl.AsyncResultSingle<Job>(handler -> {
     getCertain(jobId, handler);
   });
}

Issue:-

Unfortunately i am not able to use this in Kotlin as kotlin won't allow null values for non-null fields and it is throwing following exception.

java.lang.IllegalArgumentException: Parameter specified as non-null is null

How do i force Vertx CodeGen to generate return type as MayBe so that my code works without any issues in kotlin.

Note: I have tried adding @nullable but no use

i have added Sample Project Here

https://github.com/c-nnooka/VertxCodeGenMayBe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions