Gradle fails to detect the java version when using openjdk 8

in org.gradle.launcher.daemon.client.JvmVersionValidator

static JavaVersion parseJavaVersionCommandOutput(BufferedReader reader) {
        try {
            String versionStr = reader.readLine();
            while (versionStr != null) {
                Matcher matcher = Pattern.compile("java version \"(.+?)\"").matcher(versionStr);
                if (matcher.matches()) {
                    return JavaVersion.toVersion(matcher.group(1));
                }
                versionStr = reader.readLine();
            }
        } catch (IOException e) {
            throw new org.gradle.api.UncheckedIOException(e);
        }
          throw new RuntimeException("Could not determine Java version.");
    }

(it looks wrong here, check the actual source)

Yet openjdk8 does this:

[guipsp@crimson]/usr/lib/jvm/java-1.8.0/bin% ./java -version

openjdk version “1.8.0_11” OpenJDK Runtime Environment (build 1.8.0_11-b12) OpenJDK 64-Bit Server VM (build 25.11-b02, mixed mode)