All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.net.jqwik.kotlin.internal.NullabilityEnhancer.kt Maven / Gradle / Ivy

There is a newer version: 1.9.1
Show newest version
package net.jqwik.kotlin.internal

import net.jqwik.api.providers.TypeUsage
import net.jqwik.kotlin.api.kotlinType
import java.lang.reflect.Parameter

// Requires KTypeEnhancer to have run before
class NullabilityEnhancer : TypeUsage.Enhancer {

    override fun forParameter(original: TypeUsage, parameter: Parameter): TypeUsage {
        //val kParameter: KParameter? = parameter.kotlinParameter
        //val isNullable: Boolean = kParameter?.isMarkedNullable ?: false
        val isNullable = original.kotlinType?.isMarkedNullable ?: false
        return if (isNullable) original.asNullable() else original
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy