private static List findClassesInJar()

in core/src/main/java/com/google/cloud/sql/nativeimage/CloudSqlFeature.java [179:201]


  private static List<String> findClassesInJar(JarURLConnection urlConnection, String packageName)
      throws IOException {

    List<String> result = new ArrayList<>();

    final JarFile jarFile = urlConnection.getJarFile();
    final Enumeration<JarEntry> entries = jarFile.entries();

    while (entries.hasMoreElements()) {
      JarEntry entry = entries.nextElement();
      String entryName = entry.getName();

      if (entryName.endsWith(".class")) {
        String javaClassName = entryName.replace(".class", "").replace('/', '.');

        if (javaClassName.startsWith(packageName)) {
          result.add(javaClassName);
        }
      }
    }

    return result;
  }