clear up some easy warnings

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1003849 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-10-02 18:20:54 +00:00
parent 9c716e796b
commit 68bcf1f4b9
12 changed files with 58 additions and 11 deletions

View File

@ -185,6 +185,7 @@ public class IndexWriter implements Closeable {
* @see #setDefaultWriteLockTimeout
* @deprecated use {@link IndexWriterConfig#WRITE_LOCK_TIMEOUT} instead
*/
@Deprecated
public static long WRITE_LOCK_TIMEOUT = IndexWriterConfig.WRITE_LOCK_TIMEOUT;
private long writeLockTimeout;
@ -198,6 +199,7 @@ public class IndexWriter implements Closeable {
* Value to denote a flush trigger is disabled
* @deprecated use {@link IndexWriterConfig#DISABLE_AUTO_FLUSH} instead
*/
@Deprecated
public final static int DISABLE_AUTO_FLUSH = IndexWriterConfig.DISABLE_AUTO_FLUSH;
/**
@ -205,6 +207,7 @@ public class IndexWriter implements Closeable {
* by default). Change using {@link #setMaxBufferedDocs(int)}.
* @deprecated use {@link IndexWriterConfig#DEFAULT_MAX_BUFFERED_DOCS} instead.
*/
@Deprecated
public final static int DEFAULT_MAX_BUFFERED_DOCS = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS;
/**
@ -212,6 +215,7 @@ public class IndexWriter implements Closeable {
* docs consume 16 MB RAM). Change using {@link #setRAMBufferSizeMB}.
* @deprecated use {@link IndexWriterConfig#DEFAULT_RAM_BUFFER_SIZE_MB} instead.
*/
@Deprecated
public final static double DEFAULT_RAM_BUFFER_SIZE_MB = IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB;
/**
@ -219,6 +223,7 @@ public class IndexWriter implements Closeable {
* by default). Change using {@link #setMaxBufferedDeleteTerms(int)}.
* @deprecated use {@link IndexWriterConfig#DEFAULT_MAX_BUFFERED_DELETE_TERMS} instead
*/
@Deprecated
public final static int DEFAULT_MAX_BUFFERED_DELETE_TERMS = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS;
/**
@ -226,12 +231,14 @@ public class IndexWriter implements Closeable {
*
* @deprecated see {@link IndexWriterConfig}
*/
@Deprecated
public final static int DEFAULT_MAX_FIELD_LENGTH = 10000;
/**
* Default value is 128. Change using {@link #setTermIndexInterval(int)}.
* @deprecated use {@link IndexWriterConfig#DEFAULT_TERM_INDEX_INTERVAL} instead.
*/
@Deprecated
public final static int DEFAULT_TERM_INDEX_INTERVAL = IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL;
/**
@ -753,6 +760,7 @@ public class IndexWriter implements Closeable {
* @deprecated use {@link LogMergePolicy#getUseCompoundDocStore()} and
* {@link LogMergePolicy#getUseCompoundFile()} directly.
*/
@Deprecated
public boolean getUseCompoundFile() {
return getLogMergePolicy().getUseCompoundFile();
}
@ -774,6 +782,7 @@ public class IndexWriter implements Closeable {
* Note that this method set the given value on both, therefore
* you should consider doing the same.
*/
@Deprecated
public void setUseCompoundFile(boolean value) {
getLogMergePolicy().setUseCompoundFile(value);
getLogMergePolicy().setUseCompoundDocStore(value);
@ -784,6 +793,7 @@ public class IndexWriter implements Closeable {
* @see Similarity#setDefault(Similarity)
* @deprecated use {@link IndexWriterConfig#setSimilarity(Similarity)} instead
*/
@Deprecated
public void setSimilarity(Similarity similarity) {
ensureOpen();
this.similarity = similarity;
@ -798,6 +808,7 @@ public class IndexWriter implements Closeable {
* <p>This defaults to the current value of {@link Similarity#getDefault()}.
* @deprecated use {@link IndexWriterConfig#getSimilarity()} instead
*/
@Deprecated
public Similarity getSimilarity() {
ensureOpen();
return similarity;
@ -825,6 +836,7 @@ public class IndexWriter implements Closeable {
* @see #DEFAULT_TERM_INDEX_INTERVAL
* @deprecated use {@link IndexWriterConfig#setTermIndexInterval(int)}
*/
@Deprecated
public void setTermIndexInterval(int interval) {
ensureOpen();
this.termIndexInterval = interval;
@ -838,6 +850,7 @@ public class IndexWriter implements Closeable {
* @see #setTermIndexInterval(int)
* @deprecated use {@link IndexWriterConfig#getTermIndexInterval()}
*/
@Deprecated
public int getTermIndexInterval() {
// We pass false because this method is called by SegmentMerger while we are in the process of closing
ensureOpen(false);
@ -867,6 +880,7 @@ public class IndexWriter implements Closeable {
* IO error
* @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
*/
@Deprecated
public IndexWriter(Directory d, Analyzer a, boolean create, MaxFieldLength mfl)
throws CorruptIndexException, LockObtainFailedException, IOException {
this(d, new IndexWriterConfig(Version.LUCENE_31, a).setOpenMode(
@ -893,6 +907,7 @@ public class IndexWriter implements Closeable {
* IO error
* @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
*/
@Deprecated
public IndexWriter(Directory d, Analyzer a, MaxFieldLength mfl)
throws CorruptIndexException, LockObtainFailedException, IOException {
this(d, new IndexWriterConfig(Version.LUCENE_31, a)
@ -918,6 +933,7 @@ public class IndexWriter implements Closeable {
* IO error
* @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
*/
@Deprecated
public IndexWriter(Directory d, Analyzer a, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl)
throws CorruptIndexException, LockObtainFailedException, IOException {
this(d, new IndexWriterConfig(Version.LUCENE_31, a).setMaxFieldLength(
@ -949,6 +965,7 @@ public class IndexWriter implements Closeable {
* IO error
* @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
*/
@Deprecated
public IndexWriter(Directory d, Analyzer a, boolean create, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl)
throws CorruptIndexException, LockObtainFailedException, IOException {
this(d, new IndexWriterConfig(Version.LUCENE_31, a).setOpenMode(
@ -989,6 +1006,7 @@ public class IndexWriter implements Closeable {
* IO error
* @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
*/
@Deprecated
public IndexWriter(Directory d, Analyzer a, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl, IndexCommit commit)
throws CorruptIndexException, LockObtainFailedException, IOException {
this(d, new IndexWriterConfig(Version.LUCENE_31, a)
@ -1176,6 +1194,7 @@ public class IndexWriter implements Closeable {
*
* @deprecated use {@link IndexWriterConfig#setMergePolicy(MergePolicy)} instead.
*/
@Deprecated
public void setMergePolicy(MergePolicy mp) {
ensureOpen();
if (mp == null)
@ -1199,6 +1218,7 @@ public class IndexWriter implements Closeable {
*
* @deprecated use {@link IndexWriterConfig#getMergePolicy()} instead
*/
@Deprecated
public MergePolicy getMergePolicy() {
ensureOpen();
return mergePolicy;
@ -1208,6 +1228,7 @@ public class IndexWriter implements Closeable {
* Expert: set the merge scheduler used by this writer.
* @deprecated use {@link IndexWriterConfig#setMergeScheduler(MergeScheduler)} instead
*/
@Deprecated
synchronized public void setMergeScheduler(MergeScheduler mergeScheduler) throws CorruptIndexException, IOException {
ensureOpen();
if (mergeScheduler == null)
@ -1231,6 +1252,7 @@ public class IndexWriter implements Closeable {
* @see #setMergeScheduler(MergeScheduler)
* @deprecated use {@link IndexWriterConfig#getMergeScheduler()} instead
*/
@Deprecated
public MergeScheduler getMergeScheduler() {
ensureOpen();
return mergeScheduler;
@ -1257,6 +1279,7 @@ public class IndexWriter implements Closeable {
* LogByteSizeMergePolicy#setMaxMergeMB}.</p>
* @deprecated use {@link LogMergePolicy#setMaxMergeDocs(int)} directly.
*/
@Deprecated
public void setMaxMergeDocs(int maxMergeDocs) {
getLogMergePolicy().setMaxMergeDocs(maxMergeDocs);
}
@ -1273,6 +1296,7 @@ public class IndexWriter implements Closeable {
* @see #setMaxMergeDocs
* @deprecated use {@link LogMergePolicy#getMaxMergeDocs()} directly.
*/
@Deprecated
public int getMaxMergeDocs() {
return getLogMergePolicy().getMaxMergeDocs();
}
@ -1292,6 +1316,7 @@ public class IndexWriter implements Closeable {
* will be indexed for a field.
* @deprecated use {@link IndexWriterConfig#setMaxFieldLength(int)} instead
*/
@Deprecated
public void setMaxFieldLength(int maxFieldLength) {
ensureOpen();
this.maxFieldLength = maxFieldLength;
@ -1309,6 +1334,7 @@ public class IndexWriter implements Closeable {
* @see #setMaxFieldLength
* @deprecated use {@link IndexWriterConfig#getMaxFieldLength()} instead
*/
@Deprecated
public int getMaxFieldLength() {
ensureOpen();
return maxFieldLength;
@ -1334,6 +1360,7 @@ public class IndexWriter implements Closeable {
* @see #setRAMBufferSizeMB
* @deprecated use {@link IndexWriterConfig#setMaxBufferedDocs(int)} instead.
*/
@Deprecated
public void setMaxBufferedDocs(int maxBufferedDocs) {
ensureOpen();
if (maxBufferedDocs != DISABLE_AUTO_FLUSH && maxBufferedDocs < 2)
@ -1378,6 +1405,7 @@ public class IndexWriter implements Closeable {
* @see #setMaxBufferedDocs
* @deprecated use {@link IndexWriterConfig#getMaxBufferedDocs()} instead.
*/
@Deprecated
public int getMaxBufferedDocs() {
ensureOpen();
return docWriter.getMaxBufferedDocs();
@ -1422,6 +1450,7 @@ public class IndexWriter implements Closeable {
* when maxBufferedDocs is already disabled
* @deprecated use {@link IndexWriterConfig#setRAMBufferSizeMB(double)} instead.
*/
@Deprecated
public void setRAMBufferSizeMB(double mb) {
if (mb > 2048.0) {
throw new IllegalArgumentException("ramBufferSize " + mb + " is too large; should be comfortably less than 2048");
@ -1444,6 +1473,7 @@ public class IndexWriter implements Closeable {
* Returns the value set by {@link #setRAMBufferSizeMB} if enabled.
* @deprecated use {@link IndexWriterConfig#getRAMBufferSizeMB()} instead.
*/
@Deprecated
public double getRAMBufferSizeMB() {
return docWriter.getRAMBufferSizeMB();
}
@ -1461,6 +1491,7 @@ public class IndexWriter implements Closeable {
* @see #setRAMBufferSizeMB
* @deprecated use {@link IndexWriterConfig#setMaxBufferedDeleteTerms(int)} instead.
*/
@Deprecated
public void setMaxBufferedDeleteTerms(int maxBufferedDeleteTerms) {
ensureOpen();
if (maxBufferedDeleteTerms != DISABLE_AUTO_FLUSH
@ -1481,6 +1512,7 @@ public class IndexWriter implements Closeable {
* @see #setMaxBufferedDeleteTerms
* @deprecated use {@link IndexWriterConfig#getMaxBufferedDeleteTerms()} instead
*/
@Deprecated
public int getMaxBufferedDeleteTerms() {
ensureOpen();
return docWriter.getMaxBufferedDeleteTerms();
@ -1502,6 +1534,7 @@ public class IndexWriter implements Closeable {
* <p>This must never be less than 2. The default value is 10.
* @deprecated use {@link LogMergePolicy#setMergeFactor(int)} directly.
*/
@Deprecated
public void setMergeFactor(int mergeFactor) {
getLogMergePolicy().setMergeFactor(mergeFactor);
}
@ -1519,6 +1552,7 @@ public class IndexWriter implements Closeable {
* @see #setMergeFactor
* @deprecated use {@link LogMergePolicy#getMergeFactor()} directly.
*/
@Deprecated
public int getMergeFactor() {
return getLogMergePolicy().getMergeFactor();
}
@ -1579,6 +1613,7 @@ public class IndexWriter implements Closeable {
* @see #setDefaultWriteLockTimeout to change the default value for all instances of IndexWriter.
* @deprecated use {@link IndexWriterConfig#setWriteLockTimeout(long)} instead
*/
@Deprecated
public void setWriteLockTimeout(long writeLockTimeout) {
ensureOpen();
this.writeLockTimeout = writeLockTimeout;
@ -1592,6 +1627,7 @@ public class IndexWriter implements Closeable {
* @see #setWriteLockTimeout
* @deprecated use {@link IndexWriterConfig#getWriteLockTimeout()}
*/
@Deprecated
public long getWriteLockTimeout() {
ensureOpen();
return writeLockTimeout;
@ -1602,6 +1638,7 @@ public class IndexWriter implements Closeable {
* milliseconds).
* @deprecated use {@link IndexWriterConfig#setDefaultWriteLockTimeout(long)} instead
*/
@Deprecated
public static void setDefaultWriteLockTimeout(long writeLockTimeout) {
IndexWriterConfig.setDefaultWriteLockTimeout(writeLockTimeout);
}
@ -1612,6 +1649,7 @@ public class IndexWriter implements Closeable {
* @see #setDefaultWriteLockTimeout
* @deprecated use {@link IndexWriterConfig#getDefaultWriteLockTimeout()} instead
*/
@Deprecated
public static long getDefaultWriteLockTimeout() {
return IndexWriterConfig.getDefaultWriteLockTimeout();
}
@ -4425,6 +4463,7 @@ public class IndexWriter implements Closeable {
* {@link IndexWriterConfig#UNLIMITED_FIELD_LENGTH} or your own
* value.
*/
@Deprecated
public static final class MaxFieldLength {
private int limit;
@ -4497,6 +4536,7 @@ public class IndexWriter implements Closeable {
* {@link IndexWriterConfig#setMergedSegmentWarmer}
* instead.
*/
@Deprecated
public void setMergedSegmentWarmer(IndexReaderWarmer warmer) {
mergedSegmentWarmer = warmer;
// Required so config.getMergedSegmentWarmer returns the right value. But
@ -4509,6 +4549,7 @@ public class IndexWriter implements Closeable {
*
* @deprecated use {@link IndexWriterConfig#getMergedSegmentWarmer()} instead.
*/
@Deprecated
public IndexReaderWarmer getMergedSegmentWarmer() {
return mergedSegmentWarmer;
}

View File

@ -155,8 +155,8 @@ public class ParallelReader extends IndexReader {
@Override
public String next() throws IOException {
if (keys.hasNext()) {
currentField = (String) keys.next();
currentReader = (IndexReader) fieldToReader.get(currentField);
currentField = keys.next();
currentReader = fieldToReader.get(currentField);
} else {
currentField = null;
currentReader = null;
@ -452,7 +452,7 @@ public class ParallelReader extends IndexReader {
@Override
public int docFreq(String field, BytesRef term) throws IOException {
ensureOpen();
IndexReader reader = ((IndexReader)fieldToReader.get(field));
IndexReader reader = fieldToReader.get(field);
return reader == null? 0 : reader.docFreq(field, term);
}

View File

@ -85,7 +85,7 @@ public abstract class Terms {
}
protected TermsEnum getThreadTermsEnum() throws IOException {
TermsEnum termsEnum = (TermsEnum) threadEnums.get();
TermsEnum termsEnum = threadEnums.get();
if (termsEnum == null) {
termsEnum = iterator();
threadEnums.set(termsEnum);

View File

@ -79,7 +79,7 @@ public abstract class CodecProvider {
}
public synchronized Codec lookup(String name) {
final Codec codec = (Codec) codecs.get(name);
final Codec codec = codecs.get(name);
if (codec == null)
throw new IllegalArgumentException("required codec '" + name + "' not found");
return codec;

View File

@ -65,7 +65,7 @@ public class PulsingPostingsReaderImpl extends PostingsReaderBase {
public Object clone() {
PulsingTermState clone;
clone = (PulsingTermState) super.clone();
clone.docs = (Document[]) docs.clone();
clone.docs = docs.clone();
for(int i=0;i<clone.docs.length;i++) {
final Document doc = clone.docs[i];
if (doc != null) {

View File

@ -262,7 +262,7 @@ public class MultiPhraseQuery extends Query {
fieldExpl.setDescription("fieldWeight("+getQuery()+" in "+doc+
"), product of:");
Scorer scorer = (Scorer) scorer(reader, true, false);
Scorer scorer = scorer(reader, true, false);
if (scorer == null) {
return new Explanation(0.0f, "no matching docs");
}
@ -430,7 +430,7 @@ class UnionDocsAndPositionsEnum extends DocsAndPositionsEnum {
Iterator<DocsAndPositionsEnum> i = docsEnums.iterator();
while (i.hasNext()) {
DocsAndPositionsEnum postings = (DocsAndPositionsEnum) i.next();
DocsAndPositionsEnum postings = i.next();
if (postings.nextDoc() != DocsAndPositionsEnum.NO_MORE_DOCS) {
add(postings);
}

View File

@ -267,7 +267,7 @@ public class PhraseQuery extends Query {
fieldExpl.setDescription("fieldWeight("+field+":"+query+" in "+doc+
"), product of:");
Scorer scorer = (Scorer) scorer(reader, true, false);
Scorer scorer = scorer(reader, true, false);
if (scorer == null) {
return new Explanation(0.0f, "no matching docs");
}

View File

@ -140,6 +140,7 @@ implements Serializable {
*
* @deprecated use EntryCreator version
*/
@Deprecated
public SortField (String field, FieldCache.Parser parser) {
this(field, parser, false);
}
@ -157,6 +158,7 @@ implements Serializable {
*
* @deprecated use EntryCreator version
*/
@Deprecated
public SortField (String field, FieldCache.Parser parser, boolean reverse) {
if (field == null) {
throw new IllegalArgumentException("field can only be null when type is SCORE or DOC");
@ -315,6 +317,7 @@ implements Serializable {
* @return An instance of a {@link FieldCache} parser, or <code>null</code>.
* @deprecated use getEntryCreator()
*/
@Deprecated
public FieldCache.Parser getParser() {
return (creator==null) ? null : creator.getParser();
}

View File

@ -252,6 +252,7 @@ public abstract class Directory implements Closeable {
* }
* </pre>
*/
@Deprecated
public static void copy(Directory src, Directory dest, boolean closeDirSrc) throws IOException {
for (String file : src.listAll()) {
src.copy(dest, file, file);

View File

@ -1186,6 +1186,7 @@ public class TestIndexWriter extends LuceneTestCase {
* removed because changing ram buffer settings during a write
* session won't be possible.
*/
@Deprecated
public void testChangingRAMBuffer() throws IOException {
MockDirectoryWrapper dir = newDirectory();
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
@ -1244,6 +1245,7 @@ public class TestIndexWriter extends LuceneTestCase {
* @deprecated after setters on IW go away, this test can be deleted because
* changing those settings on IW won't be possible.
*/
@Deprecated
public void testChangingRAMBuffer2() throws IOException {
MockDirectoryWrapper dir = newDirectory();
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(

View File

@ -256,7 +256,7 @@ public class TestIndexWriterConfig extends LuceneTestCase {
* @deprecated should be removed once all the deprecated setters are removed
* from IndexWriter.
*/
@Test
@Test @Deprecated
public void testIndexWriterSetters() throws Exception {
// This test intentionally tests deprecated methods. The purpose is to pass
// whatever the user set on IW to IWC, so that if the user calls

View File

@ -71,7 +71,7 @@ public class TestPayloadNearQuery extends LuceneTestCase {
public PayloadFilter(TokenStream input, String fieldName) {
super(input);
this.fieldName = fieldName;
payAtt = (PayloadAttribute) addAttribute(PayloadAttribute.class);
payAtt = addAttribute(PayloadAttribute.class);
}
@Override