You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gradle Kotlin DSL generated accessors for JVM types, e.g. a Project extension whose type is declared in the JDK, should be propertly typed.
Current Behavior
They are considered inaccessible and thus typed Any.
Types from the Kotlin stdlib are currently working (e.g. List), so this is really about types from the JDK that aren't handled by the Kotlin stdlib.
See AccessorsClassPath.loadAccessibilityInfoFor(className: String): TypeAccessibilityInfo
…VM target to 8
Previously, the compilation of `.gradle.kts` scripts always used Java 8 as the Kotlin JVM target.
Starting with this PR, it now uses the version of the JVM running the build.
If your team is using e.g. Java 11 to run Gradle, this allows you to use Java 11 librairies and language features in your build scripts.
----
Implementation notes
* [x] IDE editor uses the Gradle build JVM in its context thus reflects the JVM target used to compile the scripts
* [x] Generated Gradle API Kotlin DSL extensions JAR is still compiled with target JVM 8
* [x] Selected JVM target is part of the cache key for script compilation
* [x] Accessors generation still uses JVM 8
JVM types in accessors are not accessible anyway
#22968
Adding JVM selection would not provide any enhancement, would be convoluted to test and add complexity at this point
Related optimistic fixes
* [x] `plugins {}` block compilation for precompiled scripts now honors configured `jvmTarget`
----
* Fixes#21041
Co-authored-by: Paul Merlin <paul@gradle.com>
Expected Behavior
Gradle Kotlin DSL generated accessors for JVM types, e.g. a Project extension whose type is declared in the JDK, should be propertly typed.
Current Behavior
They are considered inaccessible and thus typed
Any
.Types from the Kotlin stdlib are currently working (e.g.
List
), so this is really about types from the JDK that aren't handled by the Kotlin stdlib.See
AccessorsClassPath.loadAccessibilityInfoFor(className: String): TypeAccessibilityInfo
Context
Steps to Reproduce
See the reproducer test introduced in b4e0464
The text was updated successfully, but these errors were encountered: