Kotlin DSL Plugin doc is not reproducible

I followed this:

https://docs.gradle.org/current/userguide/kotlin_dsl.html#sec:kotlin-dsl_plugin

but getting back this error:

> Task :buildSrc:compileKotlin FAILED
The `kotlin-dsl` plugin applied to project ':buildSrc' enables experimental Kotlin compiler features. For more information see https://docs.gradle.org/6.2/userguide/kotlin_dsl.html#sec:k
otlin-dsl_plugin
e: D:\workspace\kotlin-dsl-test\buildSrc\src\main\kotlin\java-library-convention.gradle.kts: (8, 1): Expression 'java' cannot be invoked as a function. The function 'invoke()' is not fou
nd
e: D:\workspace\kotlin-dsl-test\buildSrc\src\main\kotlin\java-library-convention.gradle.kts: (8, 1): Unresolved reference. None of the following candidates is applicable because of recei
ver type mismatch:
internal val OrgGradlePluginGroup.java: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._1020ed028f53f219163b2772bae1b5e6 in file PluginSpecBuilders.kt
public val <T> KClass<TypeVariable(T)>.java: Class<TypeVariable(T)> defined in kotlin.jvm
public val PluginDependenciesSpec.java: PluginDependencySpec defined in org.gradle.kotlin.dsl
e: D:\workspace\kotlin-dsl-test\buildSrc\src\main\kotlin\java-library-convention.gradle.kts: (9, 5): Unresolved reference: sourceCompatibility
e: D:\workspace\kotlin-dsl-test\buildSrc\src\main\kotlin\java-library-convention.gradle.kts: (10, 5): Unresolved reference: targetCompatibility
e: D:\workspace\kotlin-dsl-test\buildSrc\src\main\kotlin\java-library-convention.gradle.kts: (13, 1): Expression 'checkstyle' cannot be invoked as a function. The function 'invoke()' is
not found
e: D:\workspace\kotlin-dsl-test\buildSrc\src\main\kotlin\java-library-convention.gradle.kts: (13, 1): Unresolved reference. None of the following candidates is applicable because of rece
iver type mismatch:
internal val OrgGradlePluginGroup.checkstyle: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._1020ed028f53f219163b2772bae1b5e6 in file PluginSpecBuilders.kt
public val PluginDependenciesSpec.checkstyle: PluginDependencySpec defined in org.gradle.kotlin.dsl
e: D:\workspace\kotlin-dsl-test\buildSrc\src\main\kotlin\java-library-convention.gradle.kts: (14, 5): Unresolved reference: maxWarnings
e: D:\workspace\kotlin-dsl-test\buildSrc\src\main\kotlin\java-library-convention.gradle.kts: (24, 5): Unresolved reference: testImplementation

FAILURE: Build failed with an exception.

Tried it with multiple gradle versions, but nothing. Even if I apply the plugins ins the java-library-convention.gradle.kts after the plugins block.

I got this same error when i upgraded Kotlin Gradle plugin from 3.6 to 4.0 and from gradle wrapper from 5.6.4 to 6.1.1. I am also unable to resolve my this problem.