Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350611 - [1.7] Inconsistent error msg and error location for illegal diamond
Summary: [1.7] Inconsistent error msg and error location for illegal diamond
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.7.1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-28 13:11 EDT by Deepak Azad CLA
Modified: 2011-08-05 02:54 EDT (History)
2 users (show)

See Also:


Attachments
Proposed patch (5.33 KB, patch)
2011-07-05 05:26 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2011-06-28 13:11:42 EDT
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) {}	
}

---------------------------------------------------------------
Comment 1 Srikanth Sankaran CLA 2011-06-28 13:43:49 EDT
(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.
Comment 2 Markus Keller CLA 2011-06-28 13:59:37 EDT
(In reply to comment #1)
Sounds good to me.
Comment 3 Srikanth Sankaran CLA 2011-06-28 14:04:13 EDT
Ayush, please follow up. TIA.
Comment 4 Deepak Azad CLA 2011-06-28 14:06:37 EDT
(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.
Comment 5 Srikanth Sankaran CLA 2011-07-05 05:14:02 EDT
As Ayush is busy with other issues, I'll take this one.
Comment 6 Srikanth Sankaran CLA 2011-07-05 05:26:56 EDT
Created attachment 199102 [details]
Proposed patch

This patch changes the message to the agreed upon one.
Comment 7 Srikanth Sankaran CLA 2011-07-05 07:05:24 EDT
Released in BETA_JAVA7 branch.
Comment 8 Deepak Azad CLA 2011-07-19 07:56:55 EDT
Verified with v20110714-1300.