private static List<String> ensurePatterns(List<String> patterns) {
    return patterns == null ? Collections.emptyList() : patterns;
  }
private static List<String> ensurePatterns(List<String> patterns)