title: Wildcard capture in Java, unable to call a method
body: <p>I currently have three classes and trying to implement Generic Visitor pattern  for putting it into a library shared among all our projects:</p>
  
  <pre><code>public interface Visitable&lt;ReturnType&gt; {
  
      public ReturnType accept(Visitor&lt;?, ?&gt; v);
  
  }
  
  public interface Visitor&lt;SomeVisitable extends Visitable&lt;?&gt;, ReturnType&gt; {
  
      public ReturnType visit(SomeVisitable v);
  
  }
  
  public class BaseObject implements Visitable&lt;Void&gt;{
      public Void accept(Visitor&lt;?, ?&gt; v) {
          v.visit(this); //1
                         // The method visit(capture#1-of ?) in the type                                        
                         // Visitor&lt;capture#1-of ?,capture#2-of ?&gt; is not
                         // applicable for the arguments (BaseObject)
      }
  }
  </code></pre>
  
  <p>Why did I get the compile-time error at <code>//1</code>? Honestly I really don't know what I should redisign in that code to make it compile.</p>