title: Java wildcard generic as return warning in Eclipse and SonarQube
body: <pre><code>private List gridModel;
  
  public List getGridModel() {
          return gridModel;
  }
  </code></pre>
  
  <p>Eclipse shows a warning:</p>
  
  <blockquote>
    <p>List is a raw type. References to generic type List should be parameterized.</p>
  </blockquote>
  
  <p>Changing the code to below will remove the warning</p>
  
  <pre><code>private List&lt;?&gt; gridModel;
  
  public List&lt;?&gt; getGridModel() {
          return gridModel;
  }
  </code></pre>
  
  <p>However the above code shows a Major pitfall error in SonarQube which says:</p>
  
  <blockquote>
    <p>Remove usage of generic wildcard type. Generic wildcard types should not be used in return parameters</p>
  </blockquote>
  
  <p>So how can I fix this warning?<br>
  I see a <a href="https://stackoverflow.com/questions/22815023/generic-wildcard-types-should-not-be-used-in-return-parameters">similar question here</a> but could not find the solution .</p>
  
  <p>Using <code>Class&lt;? extends Object&gt;</code> did not remove Sonar warning.</p>