Community
Participate
Working Groups
With the following snippet I get this error - '<>' cannot be used in an allocation expression with explicit type arguments. It looks a bit odd that the error says "<> cannot be used" and then highlights "<String>" --------------------------------------------------------------- class E { void foo1() { new <String> D<>(); // error on this line } } class D<T> { D(){} D(T i) {} } ---------------------------------------------------------------
(In reply to comment #0) > With the following snippet I get this error - '<>' cannot be used in an > allocation expression with explicit type arguments. > > It looks a bit odd that the error says "<> cannot be used" and then highlights > "<String>" Would it be better if we flip the message and say "Explicit type arguments cannot be used with <> in an allocation expression" ? (and continue to highlight the explicit type arguments ?) As things stand we don't have the positions for the <> very readily available.
(In reply to comment #1) Sounds good to me.
Ayush, please follow up. TIA.
(In reply to comment #1) > Would it be better if we flip the message and say "Explicit type arguments > cannot be used with <> in an allocation expression" ? (and continue to > highlight the explicit type arguments ?) As things stand we don't have the > positions for the > <> very readily available. Yeah, this is better.
As Ayush is busy with other issues, I'll take this one.
Created attachment 199102 [details] Proposed patch This patch changes the message to the agreed upon one.
Released in BETA_JAVA7 branch.
Verified with v20110714-1300.