From e658c2657574fe57f5a8064dfa9f931daf1a81d7 Mon Sep 17 00:00:00 2001 From: Johannes Link Date: Fri, 2 Aug 2024 09:08:17 +0200 Subject: [PATCH] Introduced update section for Kotlin 2.0 --- docs/README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/README.md b/docs/README.md index 762403f..a0a7313 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,6 @@ # Property-based Testing in Kotlin -#### Last Update: July 30, 2024 +#### Last Update: August 2, 2024 Kotlin is currently the most hyped language on the JVM. With good reason. Most parts of Kotlin are fully compatible with Java. @@ -18,12 +18,19 @@ __This article__ wants to fill the gap a little bit. It covers the application of PBT in Kotlin using [jqwik](https://jqwik.net) and [jqwik's Kotlin module](https://jqwik.net/docs/current/user-guide.html#kotlin-module). -#### Update +#### Update 1 In May 2022 I was a guest on JetBrains' Kotlin YouTube channel talking about the PBT with Kotlin. You may want to [watch the recording](https://www.youtube.com/watch?v=dPhZIo27fYE) hopefully being motivated by it to read on. +#### Update 2 + +As of jqwik version `1.9.0` the kotlin module supports Kotlin 2.0 - including the new K2 compiler. +Among other things, this requires a different parameter to handle nullability annotations correctly. +See [configuration](#setting-up-jqwik-for-kotlin) for details. + + @@ -185,7 +192,9 @@ Here's how you can do that in a Gradle build file using the Kotlin syntax: tasks.withType { kotlinOptions { freeCompilerArgs = listOf( - "-Xjsr305=strict", // Strict interpretation of nullability annotations in jqwik API + // Strict interpretation of nullability annotations in jqwik API + "-Xjsr305=strict", // For jqwik < 1.9.0 + "-Xnullability-annotations=@org.jspecify.annotations:strict" // For jqwik >= 1.9.0 "-Xemit-jvm-type-annotations" // Enable nnotations on type variables ) jvmTarget = "17" // 1.8 or above