private static List<String> generateList() {

            try {
                final ClassLoader loader = Thread.currentThread().getContextClassLoader();

                List<String> classNames = ClassPath.from(loader).getAllClasses().stream()
                        .filter(classInfo -> classInfo.getPackageName().startsWith("java."))
                        .map(ClassPath.ClassInfo::getSimpleName)
                        .toList();

                if (classNames.isEmpty()) {
                    return NOT_FOUND_LIST;
                } else {
                    return classNames;
                }
            } catch (final IOException e) {
                LOGGER.error("Error reading classloader", e);
                return NOT_FOUND_LIST;
            }
        }
Holder class for the static class names list to allow for lazy initialisation
stroom-test-common/src/main/java/stroom/test/common/data/DataGenerator.java