presto-main/src/main/java/io/prestosql/server/JavaVersion.java/JavaVersion/parse
class JavaVersion:    public static JavaVersion parse(String version)
    {
        Matcher matcher = LEGACY_PATTERN.matcher(version);
        if (matcher.matches()) {
            int major = Integer.parseInt(matcher.group("MAJOR"));
            int minor = Optional.ofNullable(matcher.group("MINOR"))
                    .map(Integer::parseInt)
                    .orElse(0);

            String update = matcher.group("UPDATE");
            if (update == null) {
                return new JavaVersion(major, minor);
            }

            return new JavaVersion(major, minor, OptionalInt.of(Integer.parseInt(update)));
        }

        matcher = PATTERN.matcher(version);
        if (matcher.matches()) {
            int major = Integer.parseInt(matcher.group("MAJOR"));
            int minor = Optional.ofNullable(matcher.group("MINOR"))
                    .map(Integer::parseInt)
                    .orElse(0);

            return new JavaVersion(major, minor);
        }

        throw new IllegalArgumentException(format("Cannot parse version %s", version));
    }