Gradle toolchains are rarely a good idea
[]
Jake Wharton
If you are using the Java compiler from JDK 8 to target Java 8 JVMs you can still run into those bugs. But is using the Java compiler from JDK 22 on sources targeting Java 8 using only Java 8 language features much safer than using one from JDK 8? Using the Java compiler from JDK 8 I can set -source and -target to "1.7" to compile a class that works on a Java 7 JVM.