title: Cannot infer functional interface type Java 8
body: <p>I have a factory(Registry DP) which initializes the class:</p>
  
  <pre><code>public class GenericFactory extends AbstractFactory {
  
      public GenericPostProcessorFactory() {
          factory.put("Test",
                  defaultSupplier(() -&gt; new Test()));
          factory.put("TestWithArgs",
                  defaultSupplier(() -&gt; new TestWithArgs(2,4)));
      }
  
  }
  
  interface Validation
  
  Test implements Validation
  TestWithArgs implements Validation
  </code></pre>
  
  <p>And in the AbstractFactory</p>
  
  <pre><code> protected Supplier&lt;Validation&gt; defaultSupplier(Class&lt;? extends Validation&gt; validationClass) {
          return () -&gt; {
              try {
                  return validationClass.newInstance();
              } catch (InstantiationException | IllegalAccessException e) {
                  throw new RuntimeException("Unable to create instance of " + validationClass, e);
              }
          };
      }
  </code></pre>
  
  <p>But I keep getting Cannot infer functional interface type Error. What I am doing wrong here ?</p>