Skip to content

Parse Kotlin metadata manually to honor nullability and avoid kotlin-metadata-jvm dep #3075

@AidanLaing

Description

@AidanLaing

Version: 2.6.0-SNAPSHOT
Exception: KotlinNullPointerException
Message: Response from {path to my suspend fun...} was null but response body type was declared as non-null

The current structure of my suspend fun in my service interface:

@POST("api/...")
suspend fun request(@Body body: Body): Response?

I'm using Gson for serialization.

Is there a way to declare the response body type as nullable that I'm missing? I've tried adding null safety on my response object with ? and @Nullable with no success.

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