Community
Participate
Working Groups
BETA_JAVA7 public class DiamondTest<T> { public <U> DiamondTest(T t) { } public static void main ( String[] args ) { DiamondTest<String> d = new <Integer> DiamondTest<>(); } } On the error at <Integer> above, there can be a quick fix which inserts <String> in place of <>. (Sorry if i'm filing a dup.)
The RHS also needs an actual method argument (e.g. ""). Then the best fix would be to turn it into new DiamondTest<>(""); not new <Integer>DiamondTest<String>(""); I don't think we should spend time on this, since explicit constructor type arguments are rare in practice. In the given example, the compiler would first have to be fixed to compute the right type binding for the ClassInstanceCreation.