title: Generic parent and child and Incompatible types for parent fileds
body: <p>I have simple generic parent class and suppose I have a list in this class:</p>
  
  <pre><code>public class GenericParent&lt;N extends Number&gt; {
  protected List&lt;String&gt; s;
  }
  </code></pre>
  
  <p>And also I have a child class that extend from this class like this:</p>
  
  <pre><code>public class GenericChild extends GenericParent {
  
      private void testMethod() {
          for (String o : s) {
              //.....
          }
      }
  }
  </code></pre>
  
  <p>I get Incompatible types in this line <code>for (String o : s)</code> and tell me that <code>s</code> is not String, it is object. but if I define my child class like this <code>public class GenericChild extends GenericParent&lt;Integer&gt;</code> and declare my generic type, error goes away. Why this happened?
  My question is not about what is the raw type and generic class. I define List of String in class that have generic type of Number and I don't get it why in child class I can't use my list of String that defined in parent.</p>