Skip to content

Commit

Permalink
Make build of Kotlin module work with Java 8 again
Browse files Browse the repository at this point in the history
  • Loading branch information
jlink committed Jun 21, 2024
1 parent bf26aca commit 48d0961
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,23 @@ signing {
}
}

def kotlinCompilerArgs = [
"[email protected]:strict",
"-Xemit-jvm-type-annotations" // Required for annotations on type variables
]

// See https://github.com/jqwik-team/jqwik/issues/546#issuecomment-2180009926
// Not supported by Java 8
def isJava8 = javaTargetVersion == '8' || javaTargetVersion == '1.8'
if (!isJava8) {
kotlinCompilerArgs += [
"-Xjvm-target=${javaTargetVersion}"
]
}

tasks.withType(KotlinCompile).configureEach {
compilerOptions {
freeCompilerArgs = [
"[email protected]:strict",
"-Xemit-jvm-type-annotations", // Required for annotations on type variables
"-Xjdk-release=${javaTargetVersion}" // See https://github.com/jqwik-team/jqwik/issues/546#issuecomment-2180009926
]
freeCompilerArgs = kotlinCompilerArgs
apiVersion = KotlinVersion.KOTLIN_1_9
languageVersion = KotlinVersion.KOTLIN_1_9
javaParameters = true // Required to get correct parameter names in reporting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SizableArbitraryExtensionsTests {
@Example
fun `StreamArbitrary ofSize() with range`(@ForAll random: Random) {
val sizableArbitrary: StreamArbitrary<Int> = Int.any().stream().ofSize(2..12)
checkAllGenerated(sizableArbitrary, random) { sizable -> sizable.toList().size in 2..12 }
checkAllGenerated(sizableArbitrary, random) { sizable -> sizable.count() in 2..12 }
}

@Example
Expand Down

0 comments on commit 48d0961

Please sign in to comment.