title: @SafeVarargs on interface method
body: <p>In this code,</p>
  
  <pre><code>package com.example;
  
  interface CollectorIF&lt;T&gt; {
      // @SafeVarargs         // Error: @SafeVarargs annotation cannot be applied to non-final instance method addAll
      void addAll(T... values);   
  }
  
  class Collector&lt;T&gt; implements CollectorIF&lt;T&gt; {
  
      @SafeVarargs
      public final void addAll(T... values) {
      }
  }
  
  class Component&lt;T&gt; {
  
      public void compute(T value) {
          Collector&lt;T&gt; col1 = new Collector&lt;&gt;();
          col1.addAll(value);   // No warning
  
          CollectorIF&lt;T&gt; col2 = new Collector&lt;&gt;();
          col2.addAll(value);   // Type safety: A generic array of T is created for a varargs parameter
      }
  }
  </code></pre>
  
  <p>the <code>Type safety: A generic array of T is created for a varargs parameter</code> warning does not occur when using a <code>Collector&lt;T&gt;</code> reference, due to the <code>@SafeVarargs</code> annotation.</p>
  
  <p>However, the warning <strong>does</strong> occur when accessing the method through the <code>CollectorIF&lt;T&gt;</code> interface. On interface methods, <code>@SafeVarargs</code> is not valid (which is obvious since the compiler can not perform any checks on the usage of the parameter in the method body).</p>
  
  <p>How can the warning be avoided when accessing the method through an interface?</p>