Java constructor using generic types
<p>I'm having a hard time wrapping my head around Java generic types. Here's a simple piece of code that in my mind should work, but I'm obviously doing something wrong.</p>

<p>Eclipse reports this error in BreweryList.java:</p>

<pre><code>The method initBreweryFromObject() is undefined for the type &lt;T&gt;
</code></pre>

<p>The idea is to fill a Vector with instances of objects that are a subclass of the Brewery class, so the invocation would be something like:</p>

<pre><code>BreweryList breweryList = new BreweryList(BrewerySubClass.class, list);
</code></pre>

<p><strong>BreweryList.java</strong></p>

<pre><code>package com.beerme.test;

import java.util.Vector;

public class BreweryList&lt;T extends Brewery&gt; extends Vector&lt;T&gt; {
 public BreweryList(Class&lt;T&gt; c, Object[] j) {
  super();
  for (int i = 0; i &lt; j.length; i++) {
   T item = c.newInstance();

   // initBreweryFromObject() is an instance method
   // of Brewery, of which &lt;T&gt; is a subclass (right?)

   c.initBreweryFromObject();

   // "The method initBreweryFromObject() is undefined
   // for the type &lt;T&gt;"
  }
 }
}
</code></pre>

<p><strong>Brewery.java</strong></p>

<pre><code>package com.beerme.test;

public class Brewery {

 public Brewery() {
  super();
 }

 protected void breweryMethod() {
 }
}
</code></pre>

<p><strong>BrewerySubClass.java</strong></p>

<pre><code>package com.beerme.test;

public class BrewerySubClass extends Brewery {
 public BrewerySubClass() {
  super();
 }

 public void androidMethod() {
 }
}
</code></pre>

<p>I'm sure this is a complete-generics-noob question, but I'm stuck. Thanks for any tips!</p>
