Skip to content

[BUG] Generated code for jvm-okhttp4 yields compiler warning on Kotlin 2.1+ #20636

Closed
@paulchen

Description

@paulchen

KT-52469 introduced a compiler warning in Kotlin 2.1 in case a reified type parameter is inferred to an intersection type. In future Kotlin releases, this will lead to an error.

The generated Kotlin code for the library jvm-okhttp4 contains a section that generates this warning: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache#L483-L490

    protected fun parameterToString(value: Any?): String = when (value) {
        /* ... */
        is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime ->
            parseDateToQueryString(value)
        /* ... */
    }

This issue can simply be reproduced by generating Kotlin code for any OpenAPI specification using the library jvm-okhttp4 and compiling it with Kotlin 2.1 or above.

This is not an urgent issue, but something that will need to be fixed in order to ensure compatibility with future Kotlin releases.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions