I was able to extract all of the classes from the src.zip file:
public class TypeUtils {
private static Set<Class<?>> classes;
private static final Set<String> CONSIDERED_MODULES = Set.of("java.base");
public static void main(String[] args) {
try {
findClasses();
classes.forEach(System.out::println);
}
catch (IOException e) {
e.printStackTrace();
}
}
private static void findClasses() throws IOException {
classes = new HashSet<>();
File root = new File(System.getProperty("java.home"));
File lib = new File(root, "lib");
ZipFile srczip = new ZipFile(new File(lib, "src.zip"));
Iterator<? extends ZipEntry> itr = srczip.entries().asIterator();
while(itr.hasNext())
extractFromEntry(itr.next());
}
private static void extractFromEntry(ZipEntry entry) {
String name = entry.getName();
if(name.endsWith(".java")) {
int firstSlash = name.indexOf('/');
String moduleName = name.substring(0, firstSlash);
if(!CONSIDERED_MODULES.contains(moduleName)) return;
String fullyQualifiedName = name.substring(firstSlash + 1, name.length() - 5).replace('/', '.');
if(fullyQualifiedName.endsWith("-info")) return; //catches module-info or package-info files
try {
Class<?> clazz = Class.forName(fullyQualifiedName);
classes.add(clazz);
}
catch (ClassNotFoundException e) {}
}
}
}