lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (LUCENE-2953) PriorityQueue is inheriently broken if subclass attempts to use "heap" w/generic T bound to anything other then "Object"
Date Tue, 08 Mar 2011 09:59:59 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-2953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003882#comment-13003882
] 

Uwe Schindler edited comment on LUCENE-2953 at 3/8/11 9:58 AM:
---------------------------------------------------------------

bq. I remember using pq at some point for other things and hating that initialize method,
so I'm all for it.

The inititalize method was only there for one single reason in Lucene (a hack): The getSentinelObject()
method was used in HitQueue like that: it should return null for some special corner case.
To enable this special case, a boolean field was used. But the ctor had to populate that field
before the prepoulating in super() was done, and thats impossible. I changed that by adding
a boolean ctor to the PQ base class to enable/disable pre-populating like HitQueue did before.

      was (Author: thetaphi):
    bq. I remember using pq at some point for other things and hating that initialize method,
so I'm all for it.

The inititalize method was only there for one single reason in Lucene (a hack). The getSentinelObject()
method was used in HitQueue in a very special way: it should return null for some special
case. To enable this special case, a boolean field was used. But the ctor had to populate
that field before the prepoulating was done, and thats impossible. I changed that by adding
a boolean ctor to the PQ base class to enable/disable pre-populating like HitQueue did before.
  
> 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, 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message