We should use Java 8 to build our modules since we have to be Java 8 compatible.
As of now, there is no way to know if we added a Java 9+ language feature.
We might use Gradle Toolchain in order to specify a Java version to run the tasks
Comment From: marcusdacoregio
Fixed via https://github.com/spring-projects/spring-security/pull/10817