I have class like following:
public class Tree<T extends Comparable<? super T>> {
  // private data omitted
  private Tree() {} // non parametric private constructor, not exposed
  // static factory method
  public static <T extends Comparable<? super T>> Tree<T> newInstance() { 
    return new Tree<T>(); 
  }
}
Now from another class I try this:
public class TestClass {
  public void test() {
    Tree<Integer> tree = Tree.newInstance(); // fail
  }
}
but when I use public constructor, following code works just fine
public void test() {
  Tree<Integer> tree = new Tree<Integer>(); 
}
What might I have done wrong?
Here is error message:
Incompatibile types:
required: structures.trees.Tree<java.lang.Integer>
found: <T>structures.trees.Tree<T>
Now the weirdness: You can try this for yourself. This code does work with my Eclipse 3.6 Helios, but it doesn't with my NetBeans 6.9.1. I can't believe it's IDE's issue (I am even using same JDK for both) ... An ideas? :O
