code: static List<String> splitCommandLine(String commandLine) {
          // Split the commandLine by whitespace.
          // Allow escaping single and double quoted strings.
          if (Objects.requireNonNull(commandLine, "commandLine").isEmpty()) {
              return new LinkedList<>();
          }
  
          final List<String> elements = new ArrayList<>();
          final QuoteStack quoteStack = new QuoteStack();
          char c = commandLine.charAt(0);
          boolean matching = !isWhitespace(c);
          int matchStart = 0;
          if (isQuote(c)) {
              quoteStack.push(c);
              matchStart = 1;
          }
          for (int i = 1; i < commandLine.length(); i++) {
              c = commandLine.charAt(i);
              if (matching) {
                  if (isWhitespace(c) && quoteStack.isEmpty()) {
                      // Detected a whitespace after matching, and we're not in a quote -
                      // this is a word boundary.
                      elements.add(commandLine.substring(matchStart, i));
                      matching = false;
                  } else if (isQuote(c) && quoteStack.quoteMatches(c)) {
                      // Quote closes a previous section of quoted text.
                      elements.add(commandLine.substring(matchStart, i));
                      quoteStack.pop();
                      matching = false;
                  }
              } else if (isQuote(c)) {
                  // We're not matching - Quote opens a new section of quoted text.
                  quoteStack.push(c);
                  matchStart = i + 1;
                  matching = true;
              } else if (!isWhitespace(c)) {
                  // Done slurping whitespaces - non-whitespace detected, start matching.
                  matching = true;
                  matchStart = i;
              }
          }
          if (matching) {
              // Finished processing commandLine, but we're still matching - add the last word.
              elements.add(commandLine.substring(matchStart, commandLine.length()));
          }
  
          return elements;
      }
docs: Package-protected for testing