[
https://issues.apache.org/jira/browse/LUCENE-2953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003873#comment-13003873
]
Dawid Weiss commented on LUCENE-2953:
-------------------------------------
> The problem with then always casting from Object to T is thousands of
> unchecked warnings in PriorityQueue.
You could erase the type in internal methods of PriorityQueue and use Object
instead of T then.
> So my proposal is to internally use the T[] as a private field and simply use
> another Object[] thats protected (pointing to the same array).
Or a protected getter method that would do the cast (why bother with having two
fields):
{noformat}
protected Object[] getStorageArray() { return (Object[]) heap; }
{noformat}
If Yonik wants access to that array I'm sure he copies it to a local var. prior
to doing any intensive loops...
> PriorityQueue is inheriently broken if subclass attempts to use "heap"
> w/generic T bound to anything other then "Object"
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: LUCENE-2953
> URL: https://issues.apache.org/jira/browse/LUCENE-2953
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Hoss Man
> Attachments: BenchmarkArrayAccess.java, LUCENE-2953.patch
>
>
> as discovered in SOLR-2410 the fact that the protected "heap" variable in
> PriorityQueue is initialized using an Object[] makes it impossible for
> subclasses of PriorityQueue to exist and access the "heap" array unless they
> bind the generic to Object.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]