private static ImmutableList<SerializerExtension> loadExtensions(
      ProcessingEnvironment processingEnv) {
    // The below is a workaround for a test-building bug. We don't expect to support it indefinitely
    // so don't depend on it.
    String allowedMissingClasses =
        processingEnv.getOptions().get("allowedMissingSerializableExtensionClasses");
    Optional<Pattern> allowedMissingClassesPattern =
        Optional.ofNullable(allowedMissingClasses).map(Pattern::compile);
    try {
      return ImmutableList.copyOf(
          SimpleServiceLoader.load(
              SerializerExtension.class,
              SerializerFactoryLoader.class.getClassLoader(),
              allowedMissingClassesPattern));
    } catch (Throwable t) {
      processingEnv
          .getMessager()
          .printMessage(
              Diagnostic.Kind.ERROR,
              "An exception occurred while looking for SerializerExtensions. No extensions will"
                  + " function.\n"
                  + Throwables.getStackTraceAsString(t));
      return ImmutableList.of();
    }
  }
Returns a {@link SerializerFactory} with {@link SerializerExtension} instances provided by the
{@link java.util.ServiceLoader}.
value/src/main/java/com/google/auto/value/extension/serializable/serializer/SerializerFactoryLoader.java