docs: @Nullable
    public static Version parse(@Nullable String version) {
      if (version == null) {
        return null;
      }
  
      Matcher matcher = pattern.matcher(version);
      if (!matcher.matches()) {
        throw new IllegalArgumentException("Invalid version number: " + version);
      }
  
      try {
        int major = Integer.parseInt(matcher.group(1));
        int minor = Integer.parseInt(matcher.group(2));
  
        String pa = matcher.group(3);
        int patch =
            pa == null || pa.isEmpty()
                ? 0
                : Integer.parseInt(
                    pa.substring(1)); // dropping the initial '.' since it's included this time
  
        String dse = matcher.group(4);
        int dsePatch =
            dse == null || dse.isEmpty()
                ? -1
                : Integer.parseInt(
                    dse.substring(1)); // dropping the initial '.' since it's included this time
  
        String pr = matcher.group(5);
        String[] preReleases =
            pr == null || pr.isEmpty()
                ? null
                : pr.substring(1)
                    .split("\\-"); // drop initial '-' or '~' then split on the remaining ones
  
        String bl = matcher.group(6);
        String build = bl == null || bl.isEmpty() ? null : bl.substring(1); // drop the initial '+'
  
        return new Version(major, minor, patch, dsePatch, preReleases, build);
      } catch (NumberFormatException e) {
        throw new IllegalArgumentException("Invalid version number: " + version);
      }
    }