mirror of https://github.com/apache/lucene.git
Prevent stupid unchecked warning in Java 7's javac. This is a bug in javac, but we also don't need the SuppressWarnings on the whole ctor.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1576521 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
40fd13c0ad
commit
bfe18a4936
|
@ -29,7 +29,7 @@ package org.apache.lucene.util;
|
|||
* @lucene.internal
|
||||
*/
|
||||
public abstract class PriorityQueue<T> {
|
||||
private int size;
|
||||
private int size = 0;
|
||||
private final int maxSize;
|
||||
private final T[] heap;
|
||||
|
||||
|
@ -37,10 +37,8 @@ public abstract class PriorityQueue<T> {
|
|||
this(maxSize, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public PriorityQueue(int maxSize, boolean prepopulate) {
|
||||
size = 0;
|
||||
int heapSize;
|
||||
final int heapSize;
|
||||
if (0 == maxSize) {
|
||||
// We allocate 1 extra to avoid if statement in top()
|
||||
heapSize = 2;
|
||||
|
@ -62,7 +60,9 @@ public abstract class PriorityQueue<T> {
|
|||
heapSize = maxSize + 1;
|
||||
}
|
||||
}
|
||||
heap = (T[]) new Object[heapSize]; // T is unbounded type, so this unchecked cast works always
|
||||
// T is unbounded type, so this unchecked cast works always:
|
||||
@SuppressWarnings("unchecked") final T[] h = (T[]) new Object[heapSize];
|
||||
this.heap = h;
|
||||
this.maxSize = maxSize;
|
||||
|
||||
if (prepopulate) {
|
||||
|
|
Loading…
Reference in New Issue