docs: private static Collection<String> listPackageResources(URL packageURL, String packagePath, String fileNamesPattern)
    {
      if("file".equals(packageURL.getProtocol())) {
        FilteredStrings resources = new FilteredStrings(fileNamesPattern);
        try {
          if(!packagePath.isEmpty()) {
            packagePath += "/";
          }
          resources.addAll(packagePath, new File(packageURL.toURI()).list());
        }
        catch(URISyntaxException e) {
          throw new BugError("Invalid syntax on URL |%s| returned by getResource.", packageURL);
        }
        return resources;
      }
  
      if(packageURL.toExternalForm().startsWith("jar:file")) {
        String path = packageURL.getPath();
        String jarPath = path.substring(5, path.indexOf("!"));
  
        JarFile jar = null;
        try {
          jar = new JarFile(jarPath);
  
          FilteredStrings resources = new FilteredStrings(fileNamesPattern);
          assert jar != null;
          Enumeration<JarEntry> entries = jar.entries();
          while(entries.hasMoreElements()) {
            resources.add(entries.nextElement().getName());
          }
          return resources;
        }
        catch(IOException e) {
          // we are here for not well formed archive or file reading errors
          // both conditions are already checked by class loader when tried to discover the package
          throw new BugError("Java archive |%s| is not well formed or file reading fails.", packageURL.getPath());
        }
        finally {
          if(jar != null) {
            try {
              jar.close();
            }
            catch(IOException e) {
              log.error(e);
            }
          }
        }
      }
  
      throw new UnsupportedOperationException(String.format("Bad protocol |%s|.", packageURL));
    }