Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] JFace Generics

On 08/29/2013 10:37 PM, John Arthorne wrote:
> From: Mickael Istria <mistria@xxxxxxxxxx>
> I may have missed something, but wouldn't the following
> implementation be a valid solution?
>
> public E[] getElements(I inputElement) {
>    return inputElement.toArray(new E[inputElement.size()]);
> }


You can't instantiate arrays of generic type. I think we're digging into too low level detail for this list. I have entered this bug for the particular issue of generic array return types in JFace:
But consumers won't use a generic type, they'll use the concrete type for their implementation. So consumers won't see a new warning.


--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

Back to the top