I configured my Gradle build as follows:
tasks {
val preview = "--enable-preview"
withType<JavaCompile> {
options.compilerArgs.add(preview)
options.compilerArgs.add("-Xlint:preview")
}
withType<Test> {
useJUnitPlatform()
jvmArgs = jvmArgs!! + preview
}
withType<JavaExec> {
jvmArgs = jvmArgs!! + preview
}
}
However, when I compile, I get:
> Task :compileJava
warning: [preview] string templates are a preview feature and may be removed in a future release.
According to the manual, -Xlint:preview
enables the check for use of preview features.
Try using -Xlint:-preview
instead; i.e.
options.compilerArgs.add("-Xlint:-preview")