title: Cannot use '<>' due to non-private method which doesn't override or implement a method from a supertype
body: <p>I have the below specified behavior.</p>
  <pre><code>interface ValueEditorPopupView&lt;T&gt; {
    void setValue(T value);
  
    void setApplyEnabled();
  }
  
  abstract class ValueEditorPopup&lt;T&gt; implements ValueEditorPopupView&lt;T&gt; {
    @Override
    public void setApplyEnabled() {
      System.out.println(&quot;In ValueEditorPopup.setApplyEnabled()&quot;);
    }
  }
  
  class ListEditorTextField {
    private final ValueEditorPopup&lt;String&gt; popup;
  
    ListEditorTextField() {
      popup = new ValueEditorPopup&lt;&gt;() {
        @Override
        public void setValue(String value) {
          System.out.println(&quot;In Anonymous Class impl setValue()&quot;);
        }
  
        // When I add a method that is NOT defined in the abstract class/interface
        // I get an error for using the diamond operator in the class declaration above
        // &quot;Cannot use '&lt;&gt;' due to non-private method which 
        // doesn't override or implement a method from a supertype&quot;
        // This error clears if I explicitly specify `new ValueEditorPopup&lt;String&gt;(){}`
        // in the anonymous class instantiation or 
        // add `getValues` to the abstract class/interface.
        public void getValues() {}
      };
    }
  
  }
  </code></pre>
  <p>As noted in a comment in the code above, when I add a method that is NOT defined in the abstract class/interface I get an error for using the diamond operator in the class declaration above:</p>
  <blockquote>
  <p>&quot;Cannot use '&lt;&gt;' due to non-private method which doesn't override or
  implement a method from a supertype&quot;</p>
  </blockquote>
  <p>This error clears if I explicitly specify <code>new ValueEditorPopup&lt;String&gt;(){}</code> in the anonymous class instantiation or add <code>getValues</code> to the abstract class/interface.</p>
  <p>I don't understand why the error is being caused and why adding those methods/types fixes it. Not sure what I am missing here.</p>