| Summary: | [1.7] Inconsistent error msg and error location for illegal diamond | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Deepak Azad <deepakazad> | ||||
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | minor | ||||||
| Priority: | P3 | CC: | markus.kell.r, srikanth_sankaran | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
(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. |
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) {} } ---------------------------------------------------------------