You are not using a generic type. I will explain this with a slightly more detailed example:
public class Test<T> { public B method(T t) { B b = new B(t); return (b); } public class B { T value; public B(T value) { this.value = value; } } }
Here you can clearly see that B depends on the general parameter T , not being general. As explained by Andy Thomas , instance B can only be created in coexistence with the instance Test . Therefore, B is (indirectly) general. In this example:
Test<Integer> t = null; Test.B b = t.new B();
B does not indicate a common parameter, but T does. That is why you get a warning.
The correct way to write this code is:
Test<Integer> t = null; Test<Integer>.B b = t.new B();
In this case, B completely specified and the types correspond.
source share