Apache Lucene open-source search software
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.
Uwe Schindlerbfe18a4936d7
diff --git a/lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java b/lucene/core/src/java/org/apache/lucene/util/PriorityQueue.javaindex 8e4cc78b960..52bc8351274 100644--- a/lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java+++ b/lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java@@ -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) {