diff --git a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/DefaultConstructorMarkerProvider.kt b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/DefaultConstructorMarkerProvider.kt index dbb12d62a..fc903cb02 100644 --- a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/DefaultConstructorMarkerProvider.kt +++ b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/DefaultConstructorMarkerProvider.kt @@ -4,7 +4,6 @@ import net.jqwik.api.Arbitraries import net.jqwik.api.Arbitrary import net.jqwik.api.providers.ArbitraryProvider import net.jqwik.api.providers.TypeUsage -import net.jqwik.kotlin.api.IntRangeArbitrary import kotlin.jvm.internal.DefaultConstructorMarker class DefaultConstructorMarkerProvider: ArbitraryProvider { diff --git a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinReflectionSupport.kt b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinReflectionSupport.kt index 9d90e6cf3..ccfd1f2df 100644 --- a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinReflectionSupport.kt +++ b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinReflectionSupport.kt @@ -31,7 +31,7 @@ val Parameter.kotlinParameter: KParameter? // A generated parameter e.g. DefaultConstructorMarker return null } - return parameters.get(kotlinIndex) + return parameters[kotlinIndex] } private fun Parameter.isSuspendFunctionContinuationParameter() = diff --git a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinSizeConfigurator.kt b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinSizeConfigurator.kt index 10ded0165..22a09e242 100644 --- a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinSizeConfigurator.kt +++ b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinSizeConfigurator.kt @@ -11,6 +11,7 @@ class KotlinIntRangeConfigurator : ArbitraryConfiguratorBase() { return targetType.isAssignableFrom(IntRange::class.java) } + @Suppress("unused") // Used by jqwik fun configure(arbitrary: Arbitrary, range: JqwikIntRange): Arbitrary { return if (arbitrary is IntRangeArbitrary) { arbitrary.between(range.min, range.max) diff --git a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinUniqueElementsConfigurator.kt b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinUniqueElementsConfigurator.kt index 9dda1ea8e..6a764ded0 100644 --- a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinUniqueElementsConfigurator.kt +++ b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KotlinUniqueElementsConfigurator.kt @@ -11,7 +11,7 @@ import net.jqwik.kotlin.api.isAssignableFrom import java.util.function.Function class KotlinUniqueElementsConfigurator : ArbitraryConfigurator { - @Suppress("UNCHECKED_CAST") + @Suppress("UNCHECKED_CAST", "WRONG_NULLABILITY_FOR_JAVA_OVERRIDE") override fun configure(arbitrary: Arbitrary, targetType: TypeUsage): Arbitrary { return targetType.findAnnotation(UniqueElements::class.java).map { uniqueness -> return@map when { @@ -21,7 +21,7 @@ class KotlinUniqueElementsConfigurator : ArbitraryConfigurator { sequenceArbitrary.filter { isUnique( it.toList(), - extractor(uniqueness) as Function + extractor(uniqueness) as Function ) } } @@ -40,11 +40,11 @@ class KotlinUniqueElementsConfigurator : ArbitraryConfigurator { arbitrary: SequenceArbitrary, uniqueness: UniqueElements ): SequenceArbitrary { - val extractor = extractor(uniqueness) as Function + val extractor = extractor(uniqueness) as Function return arbitrary.uniqueElements(extractor) } - private fun extractor(uniqueElements: UniqueElements): Function<*, *> { + private fun extractor(uniqueElements: UniqueElements): Function<*, *> { val extractorClass: Class> = uniqueElements.by.java return if (extractorClass == NOT_SET::class.java) Function.identity() // TODO: Create instance in context of test instance. diff --git a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/PairReportingFormat.kt b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/PairReportingFormat.kt index a64b29072..5bbf46e75 100644 --- a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/PairReportingFormat.kt +++ b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/PairReportingFormat.kt @@ -9,6 +9,7 @@ class PairReportingFormat : SampleReportingFormat { return value is Pair<*, *> } + @Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") override fun report(value: Any): Any { val pair = value as Pair<*, *> return Tuple.of(pair.first, pair.second) diff --git a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/SuspendedPropertyMethodsHook.kt b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/SuspendedPropertyMethodsHook.kt index c417c0ca3..33b017ab8 100644 --- a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/SuspendedPropertyMethodsHook.kt +++ b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/SuspendedPropertyMethodsHook.kt @@ -20,7 +20,7 @@ class SuspendedPropertyMethodsHook : ResolveParameterHook, InvokePropertyMethodH override fun propagateTo(): PropagationMode = PropagationMode.ALL_DESCENDANTS - override fun appliesTo(element: Optional) = + override fun appliesTo(element: Optional): Boolean = element.map { e -> e.isSuspendFunction() }.orElse(false) @Suppress("UNCHECKED_CAST") diff --git a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/TripleReportingFormat.kt b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/TripleReportingFormat.kt index 9ebb283dc..a3bd346a8 100644 --- a/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/TripleReportingFormat.kt +++ b/kotlin/src/main/kotlin/net/jqwik/kotlin/internal/TripleReportingFormat.kt @@ -9,6 +9,7 @@ class TripleReportingFormat : SampleReportingFormat { return value is Triple<*, *, *> } + @Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") override fun report(value: Any): Any { val triple = value as Triple<*, *, *> return Tuple.of(triple.first, triple.second, triple.third)