LUCENE-3850: Fix rawtypes warnings for Java 7 compiler (#2)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1297162 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-03-05 18:48:04 +00:00
parent 989530e17e
commit 3d8b22ffd0
48 changed files with 68 additions and 212 deletions

View File

@ -38,6 +38,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
@ -83,7 +84,7 @@ public class FormBasedXmlQueryDemo extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Take all completed form fields and add to a Properties object
Properties completedFormFields = new Properties();
Enumeration pNames = request.getParameterNames();
Enumeration<?> pNames = request.getParameterNames();
while (pNames.hasMoreElements()) {
String propName = (String) pNames.nextElement();
String value = request.getParameter(propName);
@ -147,7 +148,7 @@ public class FormBasedXmlQueryDemo extends HttpServlet {
//open searcher
// this example never closes it reader!
IndexReader reader = IndexReader.open(rd);
IndexReader reader = DirectoryReader.open(rd);
searcher = new IndexSearcher(reader);
}
}

View File

@ -723,7 +723,6 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
@Override
public void run() throws Exception {
numHighlights = 0;
String queryString = FIELD_NAME + ":[kannedy TO kznnedy]";
// Need to explicitly set the QueryParser property to use TermRangeQuery
// rather
@ -1250,8 +1249,6 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
String text = "this is a text with searchterm in it";
SimpleHTMLFormatter fm = new SimpleHTMLFormatter();
TokenStream tokenStream = new MockAnalyzer(random, MockTokenizer.SIMPLE, true, stopWords, true)
.tokenStream("text", new StringReader(text));
Highlighter hg = getHighlighter(query, "text", fm);
hg.setTextFragmenter(new NullFragmenter());
hg.setMaxDocCharsToAnalyze(36);

View File

@ -45,7 +45,6 @@ import org.apache.lucene.index.Fields;
import org.apache.lucene.index.FieldsEnum;
import org.apache.lucene.index.OrdTermState;
import org.apache.lucene.index.StoredFieldVisitor;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermState;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
@ -205,7 +204,7 @@ public class MemoryIndex {
* Arrays.binarySearch() and Arrays.sort()
*/
private static final Comparator<Object> termComparator = new Comparator<Object>() {
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public int compare(Object o1, Object o2) {
if (o1 instanceof Map.Entry<?,?>) o1 = ((Map.Entry<?,?>) o1).getKey();
if (o2 instanceof Map.Entry<?,?>) o2 = ((Map.Entry<?,?>) o2).getKey();
@ -609,9 +608,6 @@ public class MemoryIndex {
/** Boost factor for hits for this field */
private final float boost;
/** Term for this field's fieldName, lazily computed on demand */
public transient Term template;
private final long sumTotalTermFreq;
public Info(HashMap<BytesRef,ArrayIntList> terms, int numTokens, int numOverlapTokens, float boost) {
@ -642,16 +638,6 @@ public class MemoryIndex {
if (sortedTerms == null) sortedTerms = sort(terms);
}
/** note that the frequency can be calculated as numPosition(getPositions(x)) */
public ArrayIntList getPositions(BytesRef term) {
return terms.get(term);
}
/** note that the frequency can be calculated as numPosition(getPositions(x)) */
public ArrayIntList getPositions(int pos) {
return sortedTerms[pos].getValue();
}
public float getBoost() {
return boost;
}
@ -671,10 +657,6 @@ public class MemoryIndex {
private int[] elements;
private int size = 0;
public ArrayIntList() {
this(10);
}
public ArrayIntList(int initialCapacity) {
elements = new int[initialCapacity];
}
@ -701,16 +683,6 @@ public class MemoryIndex {
return size;
}
public int[] toArray(int stride) {
int[] arr = new int[size() / stride];
if (stride == 1) {
System.arraycopy(elements, 0, arr, 0, size); // fast path
} else {
for (int i=0, j=0; j < size; i++, j += stride) arr[i] = elements[j];
}
return arr;
}
private void ensureCapacity(int minCapacity) {
int newCapacity = Math.max(minCapacity, (elements.length * 3) / 2 + 1);
int[] newElements = new int[newCapacity];
@ -1163,16 +1135,7 @@ public class MemoryIndex {
public static final int PTR = Constants.JRE_IS_64BIT ? 8 : 4;
// bytes occupied by primitive data types
public static final int BOOLEAN = 1;
public static final int BYTE = 1;
public static final int CHAR = 2;
public static final int SHORT = 2;
public static final int INT = 4;
public static final int LONG = 8;
public static final int FLOAT = 4;
public static final int DOUBLE = 8;
private static final int LOG_PTR = (int) Math.round(log2(PTR));
/**
@ -1200,28 +1163,15 @@ public class MemoryIndex {
return sizeOfObject(INT + PTR*len);
}
public static int sizeOfCharArray(int len) {
return sizeOfObject(INT + CHAR*len);
}
public static int sizeOfIntArray(int len) {
return sizeOfObject(INT + INT*len);
}
public static int sizeOfString(int len) {
return sizeOfObject(3*INT + PTR) + sizeOfCharArray(len);
}
public static int sizeOfHashMap(int len) {
return sizeOfObject(4*PTR + 4*INT) + sizeOfObjectArray(len)
+ len * sizeOfObject(3*PTR + INT); // entries
}
// note: does not include referenced objects
public static int sizeOfArrayList(int len) {
return sizeOfObject(PTR + 2*INT) + sizeOfObjectArray(len);
}
public static int sizeOfArrayIntList(int len) {
return sizeOfObject(PTR + INT) + sizeOfIntArray(len);
}

View File

@ -34,6 +34,7 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader;
@ -135,7 +136,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
* Run all queries against both the RAMDirectory and MemoryIndex, ensuring they are the same.
*/
public void assertAllQueries(MemoryIndex memory, Directory ramdir, Analyzer analyzer) throws Exception {
IndexReader reader = IndexReader.open(ramdir);
IndexReader reader = DirectoryReader.open(ramdir);
IndexSearcher ram = new IndexSearcher(reader);
IndexSearcher mem = memory.createSearcher();
QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "foo", analyzer);

View File

@ -20,8 +20,6 @@ import java.io.File;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;

View File

@ -90,7 +90,7 @@ public final class SlowCollatedStringComparator extends FieldComparator<String>
}
@Override
public FieldComparator setNextReader(AtomicReaderContext context) throws IOException {
public FieldComparator<String> setNextReader(AtomicReaderContext context) throws IOException {
currentDocTerms = FieldCache.DEFAULT.getTerms(context.reader(), field);
return this;
}

View File

@ -91,7 +91,7 @@ public class TestSlowCollationMethods extends LuceneTestCase {
public void testSort() throws Exception {
SortField sf = new SortField("field", new FieldComparatorSource() {
@Override
public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
public FieldComparator<String> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
return new SlowCollatedStringComparator(numHits, fieldname, collator);
}
});

View File

@ -83,31 +83,4 @@ public class TestSpanRegexQuery extends LuceneTestCase {
reader.close();
directory.close();
}
private void createRAMDirectories() throws CorruptIndexException,
LockObtainFailedException, IOException {
// creating a document to store
Document lDoc = new Document();
FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
customType.setOmitNorms(true);
lDoc.add(newField("field", "a1 b1", customType));
// creating a document to store
Document lDoc2 = new Document();
lDoc2.add(newField("field", "a2 b2", customType));
// creating first index writer
IndexWriter writerA = new IndexWriter(indexStoreA, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.CREATE));
writerA.addDocument(lDoc);
writerA.forceMerge(1);
writerA.close();
// creating second index writer
IndexWriter writerB = new IndexWriter(indexStoreB, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.CREATE));
writerB.addDocument(lDoc2);
writerB.forceMerge(1);
writerB.close();
}
}

View File

@ -17,7 +17,6 @@ package org.apache.lucene.analysis.tokenattributes;
* limitations under the License.
*/
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.util.AttributeImpl;
/** See {@link PositionLengthAttribute}. */

View File

@ -778,9 +778,6 @@ public class BlockTermsReader extends FieldsProducer {
return state.ord;
}
private void doPendingSeek() {
}
/* Does initial decode of next block of terms; this
doesn't actually decode the docFreq, totalTermFreq,
postings details (frq/prx offset, etc.) metadata;

View File

@ -35,7 +35,6 @@ import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.index.TermState;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum.SeekStatus;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.store.ByteArrayDataInput;
import org.apache.lucene.store.Directory;
@ -1947,6 +1946,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
}
}
@SuppressWarnings("unused")
private void printSeekState() throws IOException {
if (currentFrame == staticFrame) {
System.out.println(" no prior seek");

View File

@ -639,7 +639,8 @@ public class BlockTreeTermsWriter extends FieldsConsumer {
}
// for debugging
private String toString(BytesRef b) {
@SuppressWarnings("unused")
private String toString(BytesRef b) {
try {
return b.utf8ToString() + " " + b;
} catch (Throwable t) {

View File

@ -21,8 +21,6 @@ import java.io.Closeable;
import java.io.IOException;
import org.apache.lucene.index.Fields;
import org.apache.lucene.index.FieldsEnum;
import org.apache.lucene.index.Terms;
/** Abstract API that produces terms, doc, freq, prox and
* payloads postings.

View File

@ -227,8 +227,6 @@ public class FixedGapTermsIndexReader extends TermsIndexReaderBase {
private final class FieldIndexData {
final private FieldInfo fieldInfo;
volatile CoreFieldIndex coreIndex;
private final long indexStart;
@ -241,7 +239,6 @@ public class FixedGapTermsIndexReader extends TermsIndexReaderBase {
public FieldIndexData(FieldInfo fieldInfo, int numIndexTerms, long indexStart, long termsStart, long packedIndexStart,
long packedOffsetsStart) throws IOException {
this.fieldInfo = fieldInfo;
this.termsStart = termsStart;
this.indexStart = indexStart;
this.packedIndexStart = packedIndexStart;

View File

@ -53,7 +53,8 @@ public class FixedGapTermsIndexWriter extends TermsIndexWriterBase {
final private int termIndexInterval;
private final List<SimpleFieldWriter> fields = new ArrayList<SimpleFieldWriter>();
private final FieldInfos fieldInfos; // unread
@SuppressWarnings("unused") private final FieldInfos fieldInfos; // unread
public FixedGapTermsIndexWriter(SegmentWriteState state) throws IOException {
final String indexFileName = IndexFileNames.segmentFileName(state.segmentName, state.segmentSuffix, TERMS_INDEX_EXTENSION);

View File

@ -22,7 +22,6 @@ import java.io.IOException;
import java.util.Comparator;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.Fields;

View File

@ -22,7 +22,6 @@ import org.apache.lucene.util.BytesRef;
import java.io.IOException;
import java.io.Closeable;
import java.util.Collection;
// TODO

View File

@ -54,7 +54,8 @@ public class VariableGapTermsIndexWriter extends TermsIndexWriterBase {
final static int VERSION_CURRENT = VERSION_START;
private final List<FSTFieldWriter> fields = new ArrayList<FSTFieldWriter>();
private final FieldInfos fieldInfos; // unread
@SuppressWarnings("unused") private final FieldInfos fieldInfos; // unread
private final IndexTermSelector policy;
/** @lucene.experimental */
@ -214,7 +215,6 @@ public class VariableGapTermsIndexWriter extends TermsIndexWriterBase {
private final long startTermsFilePointer;
final FieldInfo fieldInfo;
int numIndexTerms;
FST<Long> fst;
final long indexStart;

View File

@ -32,7 +32,6 @@ import org.apache.lucene.codecs.lucene40.Lucene40PostingsWriter;
import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.index.SegmentReadState;
import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.store.Directory;
/**
* Appending postings impl

View File

@ -20,7 +20,6 @@ package org.apache.lucene.index;
import java.io.IOException;
import org.apache.lucene.search.SearcherManager; // javadocs
import org.apache.lucene.store.*;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ReaderUtil; // for javadocs

View File

@ -642,13 +642,11 @@ public class DocTermOrds {
* ord; in this case we "wrap" our own terms index
* around it. */
private final class OrdWrappedTermsEnum extends TermsEnum {
private final AtomicReader reader;
private final TermsEnum termsEnum;
private BytesRef term;
private long ord = -indexInterval-1; // force "real" seek
public OrdWrappedTermsEnum(AtomicReader reader) throws IOException {
this.reader = reader;
assert indexedTermsArray != null;
termsEnum = reader.fields().terms(field).iterator(null);
}

View File

@ -19,7 +19,6 @@ package org.apache.lucene.index;
import java.io.File;
import java.io.FilenameFilter;
import java.util.HashSet;
import java.util.regex.Pattern;
/**

View File

@ -18,11 +18,8 @@ package org.apache.lucene.index;
import java.io.IOException;
import org.apache.lucene.codecs.DocValuesConsumer;
import org.apache.lucene.document.DocValuesField;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.DocValues.Type;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.util.BytesRef;
public class NormsConsumerPerField extends InvertedDocEndConsumerPerField implements Comparable<NormsConsumerPerField> {
private final FieldInfo fieldInfo;

View File

@ -19,7 +19,6 @@ package org.apache.lucene.index;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;

View File

@ -1,22 +1,4 @@
package org.apache.lucene.index;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.PrintStream;
import org.apache.lucene.codecs.PerDocConsumer;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;

View File

@ -203,8 +203,6 @@ final class BooleanScorer extends Scorer {
private final int minNrShouldMatch;
private int end;
private Bucket current;
private int doc = -1;
// Any time a prohibited clause matches we set bit 0:
private static final int PROHIBITED_MASK = 1;

View File

@ -25,7 +25,6 @@ import java.util.List;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery.BooleanWeight;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.search.Scorer.ChildScorer;
/* See the description in BooleanScorer.java, comparing
* BooleanScorer & BooleanScorer2 */

View File

@ -414,10 +414,6 @@ class UnionDocsAndPositionsEnum extends DocsAndPositionsEnum {
}
}
final public DocsEnum peek() {
return top();
}
@Override
public final boolean lessThan(DocsAndPositionsEnum a, DocsAndPositionsEnum b) {
return a.docID() < b.docID();

View File

@ -25,7 +25,6 @@ import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Weight;
import org.apache.lucene.search.Explanation;
import org.apache.lucene.search.ComplexExplanation;
import org.apache.lucene.search.payloads.PayloadNearQuery.PayloadNearSpanScorer;
import org.apache.lucene.search.similarities.DefaultSimilarity;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.search.similarities.Similarity.SloppySimScorer;

View File

@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.CompositeReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.FieldCache;

View File

@ -17,8 +17,6 @@ package org.apache.lucene.util;
* limitations under the License.
*/
import java.nio.CharBuffer;
import java.nio.ByteBuffer;
import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute; // javadoc
/**

View File

@ -17,13 +17,10 @@ package org.apache.lucene.util;
* limitations under the License.
*/
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.CompositeReader;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.IndexReader;

View File

@ -17,9 +17,6 @@ package org.apache.lucene;
* limitations under the License.
*/
import java.io.*;
import java.util.*;
import org.apache.lucene.analysis.*;
import org.apache.lucene.codecs.*;
import org.apache.lucene.codecs.lucene40.Lucene40Codec;

View File

@ -3,8 +3,6 @@ package org.apache.lucene.analysis;
import java.io.StringReader;
import java.util.Arrays;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.util._TestUtil;
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.BasicAutomata;

View File

@ -17,8 +17,6 @@ package org.apache.lucene.index;
* limitations under the License.
*/
import java.util.*;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.TextField;

View File

@ -111,30 +111,26 @@ public class TestLongPostings extends LuceneTestCase {
}
final IndexReader r;
if (true) {
final IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))
.setOpenMode(IndexWriterConfig.OpenMode.CREATE)
.setMergePolicy(newLogMergePolicy());
iwc.setRAMBufferSizeMB(16.0 + 16.0 * random.nextDouble());
iwc.setMaxBufferedDocs(-1);
final RandomIndexWriter riw = new RandomIndexWriter(random, dir, iwc);
for(int idx=0;idx<NUM_DOCS;idx++) {
final Document doc = new Document();
String s = isS1.get(idx) ? s1 : s2;
final Field f = newField("field", s, TextField.TYPE_UNSTORED);
final int count = _TestUtil.nextInt(random, 1, 4);
for(int ct=0;ct<count;ct++) {
doc.add(f);
}
riw.addDocument(doc);
}
r = riw.getReader();
riw.close();
} else {
r = IndexReader.open(dir);
}
final IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))
.setOpenMode(IndexWriterConfig.OpenMode.CREATE)
.setMergePolicy(newLogMergePolicy());
iwc.setRAMBufferSizeMB(16.0 + 16.0 * random.nextDouble());
iwc.setMaxBufferedDocs(-1);
final RandomIndexWriter riw = new RandomIndexWriter(random, dir, iwc);
for(int idx=0;idx<NUM_DOCS;idx++) {
final Document doc = new Document();
String s = isS1.get(idx) ? s1 : s2;
final Field f = newField("field", s, TextField.TYPE_UNSTORED);
final int count = _TestUtil.nextInt(random, 1, 4);
for(int ct=0;ct<count;ct++) {
doc.add(f);
}
riw.addDocument(doc);
}
r = riw.getReader();
riw.close();
/*
if (VERBOSE) {

View File

@ -376,7 +376,7 @@ public class CharArrayMap<V> extends AbstractMap<Object,V> {
/** Returns an {@link CharArraySet} view on the map's keys.
* The set will use the same {@code matchVersion} as this map. */
@Override @SuppressWarnings("unchecked")
@Override @SuppressWarnings({"unchecked","rawtypes"})
public final CharArraySet keySet() {
if (keySet == null) {
// prevent adding of entries
@ -508,10 +508,11 @@ public class CharArrayMap<V> extends AbstractMap<Object,V> {
}
@Override
@SuppressWarnings("unchecked")
public boolean contains(Object o) {
if (!(o instanceof Map.Entry))
return false;
final Map.Entry e = (Map.Entry)o;
final Map.Entry<Object,V> e = (Map.Entry<Object,V>)o;
final Object key = e.getKey();
final Object val = e.getValue();
final Object v = get(key);

View File

@ -29,6 +29,7 @@ import java.util.Collection;
*
* @lucene.experimental
*/
@SuppressWarnings({"unchecked","rawtypes"})
public abstract class AbstractAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsCollector.GroupHead> extends Collector {
protected final int[] reversed;

View File

@ -36,7 +36,7 @@ import java.util.*;
abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> extends Collector {
private final Sort groupSort;
private final FieldComparator[] comparators;
private final FieldComparator<?>[] comparators;
private final int[] reversed;
private final int topNGroups;
private final HashMap<GROUP_VALUE_TYPE, CollectedSearchGroup<GROUP_VALUE_TYPE>> groupMap;
@ -136,7 +136,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
@Override
public void setScorer(Scorer scorer) throws IOException {
for (FieldComparator comparator : comparators) {
for (FieldComparator<?> comparator : comparators) {
comparator.setScorer(scorer);
}
}
@ -196,7 +196,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
sg.groupValue = copyDocGroupValue(groupValue, null);
sg.comparatorSlot = groupMap.size();
sg.topDoc = docBase + doc;
for (FieldComparator fc : comparators) {
for (FieldComparator<?> fc : comparators) {
fc.copy(sg.comparatorSlot, doc);
}
groupMap.put(sg.groupValue, sg);
@ -222,7 +222,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
bottomGroup.groupValue = copyDocGroupValue(groupValue, bottomGroup.groupValue);
bottomGroup.topDoc = docBase + doc;
for (FieldComparator fc : comparators) {
for (FieldComparator<?> fc : comparators) {
fc.copy(bottomGroup.comparatorSlot, doc);
}
@ -231,7 +231,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
assert orderedGroups.size() == topNGroups;
final int lastComparatorSlot = orderedGroups.last().comparatorSlot;
for (FieldComparator fc : comparators) {
for (FieldComparator<?> fc : comparators) {
fc.setBottom(lastComparatorSlot);
}
@ -240,7 +240,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
// Update existing group:
for (int compIDX = 0;; compIDX++) {
final FieldComparator fc = comparators[compIDX];
final FieldComparator<?> fc = comparators[compIDX];
fc.copy(spareSlot, doc);
final int c = reversed[compIDX] * fc.compare(group.comparatorSlot, spareSlot);
@ -287,7 +287,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
final CollectedSearchGroup newLast = orderedGroups.last();
// If we changed the value of the last group, or changed which group was last, then update bottom:
if (group == newLast || prevLast != newLast) {
for (FieldComparator fc : comparators) {
for (FieldComparator<?> fc : comparators) {
fc.setBottom(newLast.comparatorSlot);
}
}
@ -298,7 +298,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
final Comparator<CollectedSearchGroup> comparator = new Comparator<CollectedSearchGroup>() {
public int compare(CollectedSearchGroup o1, CollectedSearchGroup o2) {
for (int compIDX = 0;; compIDX++) {
FieldComparator fc = comparators[compIDX];
FieldComparator<?> fc = comparators[compIDX];
final int c = reversed[compIDX] * fc.compare(o1.comparatorSlot, o2.comparatorSlot);
if (c != 0) {
return c;
@ -313,7 +313,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
orderedGroups.addAll(groupMap.values());
assert orderedGroups.size() > 0;
for (FieldComparator fc : comparators) {
for (FieldComparator<?> fc : comparators) {
fc.setBottom(orderedGroups.last().comparatorSlot);
}
}

View File

@ -76,7 +76,7 @@ public class BlockGroupingCollector extends Collector {
// TODO: specialize into 2 classes, static "create" method:
private final boolean needsScores;
private final FieldComparator[] comparators;
private final FieldComparator<?>[] comparators;
private final int[] reversed;
private final int compIDXEnd;
private int bottomSlot;
@ -323,7 +323,7 @@ public class BlockGroupingCollector extends Collector {
// At this point we hold all docs w/ in each group,
// unsorted; we now sort them:
final TopDocsCollector collector;
final TopDocsCollector<?> collector;
if (withinGroupSort == null) {
// Sort by score
if (!needsScores) {
@ -384,7 +384,7 @@ public class BlockGroupingCollector extends Collector {
@Override
public void setScorer(Scorer scorer) throws IOException {
this.scorer = scorer;
for (FieldComparator comparator : comparators) {
for (FieldComparator<?> comparator : comparators) {
comparator.setScorer(scorer);
}
}
@ -425,7 +425,7 @@ public class BlockGroupingCollector extends Collector {
assert !queueFull;
//System.out.println(" init copy to bottomSlot=" + bottomSlot);
for (FieldComparator fc : comparators) {
for (FieldComparator<?> fc : comparators) {
fc.copy(bottomSlot, doc);
fc.setBottom(bottomSlot);
}
@ -450,7 +450,7 @@ public class BlockGroupingCollector extends Collector {
//System.out.println(" best w/in group!");
for (FieldComparator fc : comparators) {
for (FieldComparator<?> fc : comparators) {
fc.copy(bottomSlot, doc);
// Necessary because some comparators cache
// details of bottom slot; this forces them to
@ -480,7 +480,7 @@ public class BlockGroupingCollector extends Collector {
}
}
groupCompetes = true;
for (FieldComparator fc : comparators) {
for (FieldComparator<?> fc : comparators) {
fc.copy(bottomSlot, doc);
// Necessary because some comparators cache
// details of bottom slot; this forces them to

View File

@ -18,7 +18,6 @@ package org.apache.lucene.search.grouping.function;
*/
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.queries.function.FunctionValues;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.search.FieldComparator;
@ -98,7 +97,7 @@ public class FunctionAllGroupHeadsCollector extends AbstractAllGroupHeadsCollect
public void setScorer(Scorer scorer) throws IOException {
this.scorer = scorer;
for (GroupHead groupHead : groups.values()) {
for (FieldComparator comparator : groupHead.comparators) {
for (FieldComparator<?> comparator : groupHead.comparators) {
comparator.setScorer(scorer);
}
}
@ -119,7 +118,7 @@ public class FunctionAllGroupHeadsCollector extends AbstractAllGroupHeadsCollect
class GroupHead extends AbstractAllGroupHeadsCollector.GroupHead<MutableValue> {
final FieldComparator[] comparators;
final FieldComparator<?>[] comparators;
private GroupHead(MutableValue groupValue, Sort sort, int doc) throws IOException {
super(groupValue, doc + readerContext.docBase);
@ -138,7 +137,7 @@ public class FunctionAllGroupHeadsCollector extends AbstractAllGroupHeadsCollect
}
public void updateDocHead(int doc) throws IOException {
for (FieldComparator comparator : comparators) {
for (FieldComparator<?> comparator : comparators) {
comparator.copy(0, doc);
comparator.setBottom(0);
}

View File

@ -18,7 +18,6 @@ package org.apache.lucene.search.grouping.function;
*/
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.queries.function.FunctionValues;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.search.grouping.AbstractAllGroupsCollector;

View File

@ -18,7 +18,6 @@ package org.apache.lucene.search.grouping.function;
*/
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.queries.function.FunctionValues;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.search.Sort;

View File

@ -18,7 +18,6 @@ package org.apache.lucene.search.grouping.function;
*/
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.queries.function.FunctionValues;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.search.Sort;

View File

@ -406,7 +406,7 @@ public class ToParentBlockJoinCollector extends Collector {
// At this point we hold all docs w/ in each group,
// unsorted; we now sort them:
final TopDocsCollector collector;
final TopDocsCollector<?> collector;
if (withinGroupSort == null) {
// Sort by score
if (!trackScores) {

View File

@ -120,7 +120,7 @@ public abstract class ValueSource implements Serializable {
}
@Override
public FieldComparator newComparator(String fieldname, int numHits,
public FieldComparator<Double> newComparator(String fieldname, int numHits,
int sortPos, boolean reversed) throws IOException {
return new ValueSourceComparator(context, numHits);
}

View File

@ -18,7 +18,6 @@ package org.apache.lucene.queryparser.xml.builders;
*/
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.SlowCompositeReaderWrapper;
@ -79,7 +78,7 @@ public class TestNumericRangeFilterBuilder extends LuceneTestCase {
}
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public void testGetFilterInt() throws Exception {
NumericRangeFilterBuilder filterBuilder = new NumericRangeFilterBuilder();
filterBuilder.setStrictMode(true);
@ -99,7 +98,7 @@ public class TestNumericRangeFilterBuilder extends LuceneTestCase {
String xml2 = "<NumericRangeFilter fieldName='AGE' type='int' lowerTerm='-1' upperTerm='10' includeUpper='false'/>";
Document doc2 = getDocumentFromString(xml2);
Filter filter2 = filterBuilder.getFilter(doc2.getDocumentElement());
assertTrue(filter2 instanceof NumericRangeFilter<?>);
assertTrue(filter2 instanceof NumericRangeFilter);
NumericRangeFilter<Integer> numRangeFilter2 = (NumericRangeFilter) filter2;
assertEquals(Integer.valueOf(-1), numRangeFilter2.getMin());
@ -109,7 +108,7 @@ public class TestNumericRangeFilterBuilder extends LuceneTestCase {
assertFalse(numRangeFilter2.includesMax());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public void testGetFilterLong() throws Exception {
NumericRangeFilterBuilder filterBuilder = new NumericRangeFilterBuilder();
filterBuilder.setStrictMode(true);
@ -138,7 +137,7 @@ public class TestNumericRangeFilterBuilder extends LuceneTestCase {
assertFalse(numRangeFilter2.includesMax());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public void testGetFilterDouble() throws Exception {
NumericRangeFilterBuilder filterBuilder = new NumericRangeFilterBuilder();
filterBuilder.setStrictMode(true);
@ -169,7 +168,7 @@ public class TestNumericRangeFilterBuilder extends LuceneTestCase {
assertFalse(numRangeFilter2.includesMax());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public void testGetFilterFloat() throws Exception {
NumericRangeFilterBuilder filterBuilder = new NumericRangeFilterBuilder();
filterBuilder.setStrictMode(true);

View File

@ -46,7 +46,7 @@ public class TestNumericRangeQueryBuilder extends LuceneTestCase {
fail("Expected to throw " + ParserException.class);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public void testGetFilterInt() throws Exception {
NumericRangeQueryBuilder filterBuilder = new NumericRangeQueryBuilder();
@ -75,7 +75,7 @@ public class TestNumericRangeQueryBuilder extends LuceneTestCase {
assertFalse(numRangeFilter2.includesMax());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public void testGetFilterLong() throws Exception {
NumericRangeQueryBuilder filterBuilder = new NumericRangeQueryBuilder();
@ -103,7 +103,7 @@ public class TestNumericRangeQueryBuilder extends LuceneTestCase {
assertFalse(numRangeFilter2.includesMax());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public void testGetFilterDouble() throws Exception {
NumericRangeQueryBuilder filterBuilder = new NumericRangeQueryBuilder();
@ -133,7 +133,7 @@ public class TestNumericRangeQueryBuilder extends LuceneTestCase {
assertFalse(numRangeFilter2.includesMax());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public void testGetFilterFloat() throws Exception {
NumericRangeQueryBuilder filterBuilder = new NumericRangeQueryBuilder();