Convention usage syntax

I’m grokking Gradle API and found project,convention accessor. After:

convention.plugins.forEach {name, plug ->
    logger.lifecycle("name: {}, plug: {}", name, plug)
}

I wrote:

convention.java.sourceCompatibility = JavaVersion.VERSION_11
logger.lifecycle("conv: {}", convention.getByName("java").sourceCompatibility)
java.sourceCompatibility = JavaVersion.VERSION_1_10
logger.lifecycle("conv: {}", convention.getByName("java").sourceCompatibility)
sourceCompatibility = JavaVersion.VERSION_1_9
logger.lifecycle("conv: {}", convention.getByName("java").sourceCompatibility)

with output:

conv: 11
conv: 1.10
conv: 1.9

What is the proper way to use conventions? Which one:

convention.java.sourceCompatibility = JavaVersion.VERSION_11
java.sourceCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11

Should Gradle users know about project.getConvention()?

Implementing Gradle plugins says:

Please avoid using the Convention concept when writing new plugins. The long term plan is to migrate all Gradle core plugins to use extensions and remove the Convention concept altogether.

That means that only:

java.sourceCompatibility = JavaVersion.VERSION_11

or:

java {
    sourceCompatibility = JavaVersion.VERSION_11
}

are future proof solutions as they require ZERO portage efforts to extentions.