title: Bug in eclipse compiler or in javac ("type parameters of T cannot be determined")
body: <p>The following code</p>
  
  <pre><code>public class GenericsTest2 {
  
      public static void main(String[] args) throws Exception {
          Integer i = readObject(args[0]);
          System.out.println(i);
      }
  
      public static &lt;T&gt; T readObject(String file) throws Exception {
          return readObject(new ObjectInputStream(new FileInputStream(file)));
          // closing the stream in finally removed to get a small example
      }
  
      @SuppressWarnings("unchecked")
      public static &lt;T&gt; T readObject(ObjectInputStream stream) throws Exception {
          return (T)stream.readObject();
      }
  }
  </code></pre>
  
  <p>compiles in eclipse, but not with javac (type parameters of T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object). </p>
  
  <p>When I change readObject(String file) to </p>
  
  <pre><code>    @SuppressWarnings("unchecked")
      public static &lt;T&gt; T readObject(String file) throws Exception {
          return (T)readObject(new ObjectInputStream(new FileInputStream(file)));
      }
  </code></pre>
  
  <p>it compiles in eclipse and with javac. Who is correct, the eclipse compiler or javac?</p>