private static void ensureDirectMethodReference()

in pojo/src/main/java/com/spotify/hamcrest/pojo/IsPojo.java [248:260]


  private static void ensureDirectMethodReference(final SerializedLambda serializedLambda) {
    try {
      final Class<?> implClass = Class.forName(serializedLambda.getImplClass().replace('/', '.'));
      if (stream(implClass.getMethods())
          .noneMatch(
              m -> m.getName().equals(serializedLambda.getImplMethodName()) && !m.isSynthetic())) {
        throw new IllegalArgumentException("The supplied lambda is not a direct method reference");
      }
    } catch (final ClassNotFoundException e) {
      throw new IllegalStateException(
          "serializeLambda returned a SerializedLambda pointing to an invalid class", e);
    }
  }