docs: public static String derivedAutomaticModuleName(final String jarPath) {
          // If jar path does not end in a file extension (with ".jar" most likely), strip off everything after
          // the last '!', in order to remove package root
          int endIdx = jarPath.length();
          final int lastPlingIdx = jarPath.lastIndexOf('!');
          if (lastPlingIdx > 0
                  // If there is no '.' after the last '/' (if any) after the last '!'
                  && jarPath.lastIndexOf('.') <= Math.max(lastPlingIdx, jarPath.lastIndexOf('/'))) {
              // Then truncate at last '!'
              endIdx = lastPlingIdx;
          }
          // Find the second to last '!' (or -1, if none)
          final int secondToLastPlingIdx = endIdx == 0 ? -1 : jarPath.lastIndexOf("!", endIdx - 1);
          // Find last '/' between the second to last and the last '!'
          final int startIdx = Math.max(secondToLastPlingIdx, jarPath.lastIndexOf('/', endIdx - 1)) + 1;
          // Find last '.' after that '/'
          final int lastDotBeforeLastPlingIdx = jarPath.lastIndexOf('.', endIdx - 1);
          if (lastDotBeforeLastPlingIdx > startIdx) {
              // Strip off extension
              endIdx = lastDotBeforeLastPlingIdx;
          }
  
          // Remove .jar extension
          String moduleName = jarPath.substring(startIdx, endIdx);
  
          // Find first occurrence of "-[0-9]"
          final Matcher matcher = DASH_VERSION.matcher(moduleName);
          if (matcher.find()) {
              moduleName = moduleName.substring(0, matcher.start());
          }
  
          // Replace non-alphanumeric characters with dots
          moduleName = NON_ALPHANUM.matcher(moduleName).replaceAll(".");
  
          // Collapse repeating dots into a single dot
          moduleName = REPEATING_DOTS.matcher(moduleName).replaceAll(".");
  
          // Drop leading dots
          if (moduleName.length() > 0 && moduleName.charAt(0) == '.') {
              moduleName = LEADING_DOTS.matcher(moduleName).replaceAll("");
          }
  
          // Drop trailing dots
          final int len = moduleName.length();
          if (len > 0 && moduleName.charAt(len - 1) == '.') {
              moduleName = TRAILING_DOTS.matcher(moduleName).replaceAll("");
          }
          return moduleName;
      }