You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2011/03/09 10:34:54 UTC
svn commit: r1079711 - in /lucene/dev/branches/branch_3x: ./ lucene/
lucene/CHANGES.txt
lucene/src/java/org/apache/lucene/util/PriorityQueue.java solr/
solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java
Author: uschindler
Date: Wed Mar 9 09:34:54 2011
New Revision: 1079711
URL: http://svn.apache.org/viewvc?rev=1079711&view=rev
Log:
LUCENE-2953: PriorityQueue's internal heap was made private final
Modified:
lucene/dev/branches/branch_3x/ (props changed)
lucene/dev/branches/branch_3x/lucene/ (props changed)
lucene/dev/branches/branch_3x/lucene/CHANGES.txt
lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/PriorityQueue.java
lucene/dev/branches/branch_3x/solr/ (props changed)
lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java
Modified: lucene/dev/branches/branch_3x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/CHANGES.txt?rev=1079711&r1=1079710&r2=1079711&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/CHANGES.txt Wed Mar 9 09:34:54 2011
@@ -2,7 +2,12 @@ Lucene Change Log
======================= Lucene 3.x (not yet released) =======================
-(No changes)
+Changes in backwards compatibility policy
+
+* LUCENE-2953: PriorityQueue's internal heap was made private, as subclassing
+ with generics can lead to ClassCastException. For advanced use (e.g. in Solr)
+ a method getHeapArray() was added to retrieve the internal heap array as a
+ non-generic Object[]. (Uwe Schindler, Yonik Seeley)
======================= Lucene 3.1 (not yet released) =======================
Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/PriorityQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/PriorityQueue.java?rev=1079711&r1=1079710&r2=1079711&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/PriorityQueue.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/PriorityQueue.java Wed Mar 9 09:34:54 2011
@@ -29,7 +29,7 @@ package org.apache.lucene.util;
public abstract class PriorityQueue<T> {
private int size;
private int maxSize;
- protected T[] heap;
+ private T[] heap;
/** Determines the ordering of objects in this priority queue. Subclasses
* must define this one method.
@@ -247,4 +247,11 @@ public abstract class PriorityQueue<T> {
}
heap[i] = node; // install saved node
}
+
+ /** This method returns the internal heap array as Object[].
+ * @lucene.internal
+ */
+ protected final Object[] getHeapArray() {
+ return (Object[]) heap;
+ }
}
Modified: lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java?rev=1079711&r1=1079710&r2=1079711&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common/util/ConcurrentLRUCache.java Wed Mar 9 09:34:54 2011
@@ -352,8 +352,11 @@ public class ConcurrentLRUCache<K,V> {
private static class PQueue extends PriorityQueue {
int myMaxSize;
+ final Object[] heap;
+
PQueue(int maxSz) {
super.initialize(maxSz);
+ heap = getHeapArray();
myMaxSize = maxSz;
}