title: How to use Generic bounded param in method
body: <p>I am trying to write some generic code and facing issue. Here is code </p>
  
  <pre><code>public abstract class AbstractService&lt;D extends IDTO&gt; {
      public String ex(D dto) {
          return null;
      }
  }
  
  
  public class AService extends AbstractService&lt;TestA&gt; {
      @Override
      public String ex(TestA dto) {
          return "a";
      }
  }
  
  public class BService extends AbstractService&lt;TestB&gt; {
      @Override
      public String ex(TestB dto) {
          return "b";
      }
  }
  
  class TestA impements IDTO {
  }
  
  class TestB impements IDTO {
  }
  </code></pre>
  
  <p>So as you can see, its really simple code, one AbstractService with bounded param that extends IDTO.
  Two implementation of service AService and BService which uses their respective DTO.</p>
  
  <p>Not there is another class that need to call <code>ex()</code> method on basis of runtime instance. 
  here I am facing the problem. </p>
  
  <pre><code>public class TestAll {
      public void executeRequest(final IDTO dto){
          // serviceMap contains list of all Services here A and B
          serviceMap.get(type).ex(dto);
      }
  }
  </code></pre>
  
  <p>Problem on line build(). </p>
  
  <p>The method build(capture#5-of ? extends IDTO) in the type AbstractService is not applicable for the arguments (IDTO)</p>
  
  <p>Could someone help to fix this issue?</p>