Class SafeServiceLoader


  • public class SafeServiceLoader
    extends Object
    • Constructor Detail

      • SafeServiceLoader

        public SafeServiceLoader()
    • Method Detail

      • load

        public static <T> List<T> load​(Class<T> serviceClass,
                                       ClassLoader classLoader)
        Delegates to ServiceLoader.load(Class, ClassLoader) and then eagerly iterates over returned Iterable, ignoring any potential UnsupportedClassVersionError.

        Those errors can happen when some classes returned by ServiceLoader were compiled for later java version than is used by currently running JVM. During normal course of business this should not happen. Please read CONTRIBUTING.md, section "Testing - Java versions" for a background info why this is Ok.