LUCENE-2000: remove redundant casts

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1307012 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2012-03-29 17:34:34 +00:00
parent e49b69d459
commit 49f43806a8
56 changed files with 108 additions and 110 deletions

View File

@ -39,7 +39,7 @@
<classpathentry kind="src" path="modules/analysis/uima/src/test"/> <classpathentry kind="src" path="modules/analysis/uima/src/test"/>
<classpathentry kind="src" path="modules/benchmark/src/java"/> <classpathentry kind="src" path="modules/benchmark/src/java"/>
<classpathentry kind="src" path="modules/benchmark/src/test"/> <classpathentry kind="src" path="modules/benchmark/src/test"/>
<classpathentry excluding="src" including="conf/**" kind="src" path="modules/benchmark"/> <classpathentry kind="src" path="modules/benchmark/conf"/>
<classpathentry kind="src" path="modules/facet/src/java"/> <classpathentry kind="src" path="modules/facet/src/java"/>
<classpathentry kind="src" path="modules/facet/src/examples"/> <classpathentry kind="src" path="modules/facet/src/examples"/>
<classpathentry kind="src" path="modules/facet/src/test"/> <classpathentry kind="src" path="modules/facet/src/test"/>
@ -169,8 +169,8 @@
<classpathentry kind="lib" path="solr/contrib/uima/lib/uimaj-core-2.3.1.jar"/> <classpathentry kind="lib" path="solr/contrib/uima/lib/uimaj-core-2.3.1.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/velocity-1.6.4.jar"/> <classpathentry kind="lib" path="solr/contrib/velocity/lib/velocity-1.6.4.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/velocity-tools-2.0.jar"/> <classpathentry kind="lib" path="solr/contrib/velocity/lib/velocity-tools-2.0.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-beanutils-1.7.0.jar"/> <classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-beanutils-1.7.0.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-collections-3.2.1.jar"/> <classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -370,7 +370,7 @@ public class Token extends CharTermAttributeImpl
Token t = (Token)super.clone(); Token t = (Token)super.clone();
// Do a deep clone // Do a deep clone
if (payload != null) { if (payload != null) {
t.payload = (Payload) payload.clone(); t.payload = payload.clone();
} }
return t; return t;
} }
@ -386,7 +386,7 @@ public class Token extends CharTermAttributeImpl
t.flags = flags; t.flags = flags;
t.type = type; t.type = type;
if (payload != null) if (payload != null)
t.payload = (Payload) payload.clone(); t.payload = payload.clone();
return t; return t;
} }
@ -577,13 +577,13 @@ public class Token extends CharTermAttributeImpl
to.reinit(this); to.reinit(this);
// reinit shares the payload, so clone it: // reinit shares the payload, so clone it:
if (payload !=null) { if (payload !=null) {
to.payload = (Payload) payload.clone(); to.payload = payload.clone();
} }
} else { } else {
super.copyTo(target); super.copyTo(target);
((OffsetAttribute) target).setOffset(startOffset, endOffset); ((OffsetAttribute) target).setOffset(startOffset, endOffset);
((PositionIncrementAttribute) target).setPositionIncrement(positionIncrement); ((PositionIncrementAttribute) target).setPositionIncrement(positionIncrement);
((PayloadAttribute) target).setPayload((payload == null) ? null : (Payload) payload.clone()); ((PayloadAttribute) target).setPayload((payload == null) ? null : payload.clone());
((FlagsAttribute) target).setFlags(flags); ((FlagsAttribute) target).setFlags(flags);
((TypeAttribute) target).setType(type); ((TypeAttribute) target).setType(type);
} }

View File

@ -61,7 +61,7 @@ public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttrib
public PayloadAttributeImpl clone() { public PayloadAttributeImpl clone() {
PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone(); PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone();
if (payload != null) { if (payload != null) {
clone.payload = (Payload) payload.clone(); clone.payload = payload.clone();
} }
return clone; return clone;
} }
@ -92,7 +92,7 @@ public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttrib
@Override @Override
public void copyTo(AttributeImpl target) { public void copyTo(AttributeImpl target) {
PayloadAttribute t = (PayloadAttribute) target; PayloadAttribute t = (PayloadAttribute) target;
t.setPayload((payload == null) ? null : (Payload) payload.clone()); t.setPayload((payload == null) ? null : payload.clone());
} }

View File

@ -729,7 +729,7 @@ public class BlockTermsReader extends FieldsProducer {
public TermState termState() throws IOException { public TermState termState() throws IOException {
//System.out.println("BTR.termState this=" + this); //System.out.println("BTR.termState this=" + this);
decodeMetaData(); decodeMetaData();
TermState ts = (TermState) state.clone(); TermState ts = state.clone();
//System.out.println(" return ts=" + ts); //System.out.println(" return ts=" + ts);
return ts; return ts;
} }

View File

@ -803,7 +803,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
@Override @Override
public TermState termState() throws IOException { public TermState termState() throws IOException {
currentFrame.decodeMetaData(); currentFrame.decodeMetaData();
return (TermState) currentFrame.termState.clone(); return currentFrame.termState.clone();
} }
private Frame getFrame(int ord) throws IOException { private Frame getFrame(int ord) throws IOException {
@ -2166,7 +2166,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
public TermState termState() throws IOException { public TermState termState() throws IOException {
assert !eof; assert !eof;
currentFrame.decodeMetaData(); currentFrame.decodeMetaData();
TermState ts = (TermState) currentFrame.state.clone(); TermState ts = currentFrame.state.clone();
//if (DEBUG) System.out.println("BTTR.termState seg=" + segment + " state=" + ts); //if (DEBUG) System.out.println("BTTR.termState seg=" + segment + " state=" + ts);
return ts; return ts;
} }

View File

@ -109,8 +109,8 @@ final class SegmentTermEnum implements Cloneable {
clone.input = (IndexInput) input.clone(); clone.input = (IndexInput) input.clone();
clone.termInfo = new TermInfo(termInfo); clone.termInfo = new TermInfo(termInfo);
clone.termBuffer = (TermBuffer)termBuffer.clone(); clone.termBuffer = termBuffer.clone();
clone.prevBuffer = (TermBuffer)prevBuffer.clone(); clone.prevBuffer = prevBuffer.clone();
clone.scanBuffer = new TermBuffer(); clone.scanBuffer = new TermBuffer();
return clone; return clone;

View File

@ -340,12 +340,12 @@ final class TermInfosReader {
/** Returns an enumeration of all the Terms and TermInfos in the set. */ /** Returns an enumeration of all the Terms and TermInfos in the set. */
public SegmentTermEnum terms() { public SegmentTermEnum terms() {
return (SegmentTermEnum)origEnum.clone(); return origEnum.clone();
} }
/** Returns an enumeration of terms starting at or after the named term. */ /** Returns an enumeration of terms starting at or after the named term. */
public SegmentTermEnum terms(Term term) throws IOException { public SegmentTermEnum terms(Term term) throws IOException {
get(term, true); get(term, true);
return (SegmentTermEnum)getThreadResources().termEnum.clone(); return getThreadResources().termEnum.clone();
} }
} }

View File

@ -116,7 +116,7 @@ class TermInfosReaderIndex {
} }
void seekEnum(SegmentTermEnum enumerator, int indexOffset) throws IOException { void seekEnum(SegmentTermEnum enumerator, int indexOffset) throws IOException {
PagedBytesDataInput input = (PagedBytesDataInput) dataInput.clone(); PagedBytesDataInput input = dataInput.clone();
input.setPosition(indexToDataOffset.get(indexOffset)); input.setPosition(indexToDataOffset.get(indexOffset));
@ -152,7 +152,7 @@ class TermInfosReaderIndex {
int getIndexOffset(Term term) throws IOException { int getIndexOffset(Term term) throws IOException {
int lo = 0; int lo = 0;
int hi = indexSize - 1; int hi = indexSize - 1;
PagedBytesDataInput input = (PagedBytesDataInput) dataInput.clone(); PagedBytesDataInput input = dataInput.clone();
BytesRef scratch = new BytesRef(); BytesRef scratch = new BytesRef();
while (hi >= lo) { while (hi >= lo) {
int mid = (lo + hi) >>> 1; int mid = (lo + hi) >>> 1;
@ -176,7 +176,7 @@ class TermInfosReaderIndex {
* @throws IOException * @throws IOException
*/ */
Term getTerm(int termIndex) throws IOException { Term getTerm(int termIndex) throws IOException {
PagedBytesDataInput input = (PagedBytesDataInput) dataInput.clone(); PagedBytesDataInput input = dataInput.clone();
input.setPosition(indexToDataOffset.get(termIndex)); input.setPosition(indexToDataOffset.get(termIndex));
// read the term // read the term
@ -206,7 +206,7 @@ class TermInfosReaderIndex {
* @throws IOException * @throws IOException
*/ */
int compareTo(Term term, int termIndex) throws IOException { int compareTo(Term term, int termIndex) throws IOException {
return compareTo(term, termIndex, (PagedBytesDataInput) dataInput.clone(), new BytesRef()); return compareTo(term, termIndex, dataInput.clone(), new BytesRef());
} }
/** /**

View File

@ -172,13 +172,13 @@ public class SepPostingsReader extends PostingsReaderBase {
super.copyFrom(_other); super.copyFrom(_other);
SepTermState other = (SepTermState) _other; SepTermState other = (SepTermState) _other;
if (docIndex == null) { if (docIndex == null) {
docIndex = (IntIndexInput.Index) other.docIndex.clone(); docIndex = other.docIndex.clone();
} else { } else {
docIndex.set(other.docIndex); docIndex.set(other.docIndex);
} }
if (other.freqIndex != null) { if (other.freqIndex != null) {
if (freqIndex == null) { if (freqIndex == null) {
freqIndex = (IntIndexInput.Index) other.freqIndex.clone(); freqIndex = other.freqIndex.clone();
} else { } else {
freqIndex.set(other.freqIndex); freqIndex.set(other.freqIndex);
} }
@ -187,7 +187,7 @@ public class SepPostingsReader extends PostingsReaderBase {
} }
if (other.posIndex != null) { if (other.posIndex != null) {
if (posIndex == null) { if (posIndex == null) {
posIndex = (IntIndexInput.Index) other.posIndex.clone(); posIndex = other.posIndex.clone();
} else { } else {
posIndex.set(other.posIndex); posIndex.set(other.posIndex);
} }

View File

@ -475,7 +475,7 @@ public class CheckIndex {
} }
result.newSegments = (SegmentInfos) sis.clone(); result.newSegments = sis.clone();
result.newSegments.clear(); result.newSegments.clear();
result.maxSegmentName = -1; result.maxSegmentName = -1;
@ -642,7 +642,7 @@ public class CheckIndex {
} }
// Keeper // Keeper
result.newSegments.add((SegmentInfo) info.clone()); result.newSegments.add(info.clone());
} }
if (0 == result.numBadSegments) { if (0 == result.numBadSegments) {

View File

@ -169,7 +169,7 @@ public final class FieldInfos implements Iterable<FieldInfo> {
fis.hasProx = hasProx; fis.hasProx = hasProx;
fis.hasVectors = hasVectors; fis.hasVectors = hasVectors;
for (FieldInfo fi : this) { for (FieldInfo fi : this) {
FieldInfo clone = (FieldInfo) (fi).clone(); FieldInfo clone = fi.clone();
fis.putInternal(clone); fis.putInternal(clone);
} }
return fis; return fis;
@ -444,7 +444,7 @@ public final class FieldInfos implements Iterable<FieldInfo> {
} }
final FieldInfos roFis = new FieldInfos((FieldNumberBiMap)null); final FieldInfos roFis = new FieldInfos((FieldNumberBiMap)null);
for (FieldInfo fieldInfo : this) { for (FieldInfo fieldInfo : this) {
FieldInfo clone = (FieldInfo) (fieldInfo).clone(); FieldInfo clone = fieldInfo.clone();
roFis.putInternal(clone); roFis.putInternal(clone);
roFis.hasVectors |= clone.storeTermVector; roFis.hasVectors |= clone.storeTermVector;
roFis.hasProx |= clone.isIndexed && clone.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; roFis.hasProx |= clone.isIndexed && clone.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;

View File

@ -145,7 +145,7 @@ public final class IndexUpgrader {
} }
} }
final IndexWriterConfig c = (IndexWriterConfig) iwc.clone(); final IndexWriterConfig c = iwc.clone();
c.setMergePolicy(new UpgradeIndexMergePolicy(c.getMergePolicy())); c.setMergePolicy(new UpgradeIndexMergePolicy(c.getMergePolicy()));
c.setIndexDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy()); c.setIndexDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());

View File

@ -585,7 +585,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
*/ */
public IndexWriter(Directory d, IndexWriterConfig conf) public IndexWriter(Directory d, IndexWriterConfig conf)
throws CorruptIndexException, LockObtainFailedException, IOException { throws CorruptIndexException, LockObtainFailedException, IOException {
config = (IndexWriterConfig) conf.clone(); config = conf.clone();
directory = d; directory = d;
analyzer = conf.getAnalyzer(); analyzer = conf.getAnalyzer();
infoStream = conf.getInfoStream(); infoStream = conf.getInfoStream();
@ -2431,7 +2431,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
// no partial changes (eg a delete w/o // no partial changes (eg a delete w/o
// corresponding add from an updateDocument) can // corresponding add from an updateDocument) can
// sneak into the commit point: // sneak into the commit point:
toCommit = (SegmentInfos) segmentInfos.clone(); toCommit = segmentInfos.clone();
pendingCommitChangeCount = changeCount; pendingCommitChangeCount = changeCount;

View File

@ -273,7 +273,7 @@ class ReadersAndLiveDocs {
assert liveDocs.length() == info.docCount; assert liveDocs.length() == info.docCount;
// Save in case we need to rollback on failure: // Save in case we need to rollback on failure:
final SegmentInfo sav = (SegmentInfo) info.clone(); final SegmentInfo sav = info.clone();
info.advanceDelGen(); info.advanceDelGen();
info.setDelCount(info.getDelCount() + pendingDeleteCount); info.setDelCount(info.getDelCount() + pendingDeleteCount);

View File

@ -142,7 +142,7 @@ public final class SegmentInfo implements Cloneable {
docStoreIsCompoundFile = src.docStoreIsCompoundFile; docStoreIsCompoundFile = src.docStoreIsCompoundFile;
hasVectors = src.hasVectors; hasVectors = src.hasVectors;
hasProx = src.hasProx; hasProx = src.hasProx;
fieldInfos = src.fieldInfos == null ? null : (FieldInfos) src.fieldInfos.clone(); fieldInfos = src.fieldInfos == null ? null : src.fieldInfos.clone();
if (src.normGen == null) { if (src.normGen == null) {
normGen = null; normGen = null;
} else { } else {
@ -254,7 +254,7 @@ public final class SegmentInfo implements Cloneable {
@Override @Override
public SegmentInfo clone() { public SegmentInfo clone() {
final SegmentInfo si = new SegmentInfo(name, docCount, dir, isCompoundFile, codec, final SegmentInfo si = new SegmentInfo(name, docCount, dir, isCompoundFile, codec,
fieldInfos == null ? null : (FieldInfos) fieldInfos.clone()); fieldInfos == null ? null : fieldInfos.clone());
si.docStoreOffset = docStoreOffset; si.docStoreOffset = docStoreOffset;
si.docStoreSegment = docStoreSegment; si.docStoreSegment = docStoreSegment;
si.docStoreIsCompoundFile = docStoreIsCompoundFile; si.docStoreIsCompoundFile = docStoreIsCompoundFile;

View File

@ -385,7 +385,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfo> {
for(final SegmentInfo info : this) { for(final SegmentInfo info : this) {
assert info.getCodec() != null; assert info.getCodec() != null;
// dont directly access segments, use add method!!! // dont directly access segments, use add method!!!
sis.add((SegmentInfo) info.clone()); sis.add(info.clone());
} }
sis.userData = new HashMap<String,String>(userData); sis.userData = new HashMap<String,String>(userData);
return sis; return sis;
@ -957,7 +957,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfo> {
final List<SegmentInfo> list = new ArrayList<SegmentInfo>(size()); final List<SegmentInfo> list = new ArrayList<SegmentInfo>(size());
for(final SegmentInfo info : this) { for(final SegmentInfo info : this) {
assert info.getCodec() != null; assert info.getCodec() != null;
list.add((SegmentInfo) info.clone()); list.add(info.clone());
} }
return list; return list;
} else { } else {

View File

@ -83,7 +83,7 @@ final class StandardDirectoryReader extends DirectoryReader {
List<SegmentReader> readers = new ArrayList<SegmentReader>(); List<SegmentReader> readers = new ArrayList<SegmentReader>();
final Directory dir = writer.getDirectory(); final Directory dir = writer.getDirectory();
final SegmentInfos segmentInfos = (SegmentInfos) infos.clone(); final SegmentInfos segmentInfos = infos.clone();
int infosUpto = 0; int infosUpto = 0;
for (int i=0;i<numSegments;i++) { for (int i=0;i<numSegments;i++) {
IOException prior = null; IOException prior = null;

View File

@ -433,7 +433,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
if (getBoost() != 1.0f) { // incorporate boost if (getBoost() != 1.0f) { // incorporate boost
if (query == c.getQuery()) { // if rewrite was no-op if (query == c.getQuery()) { // if rewrite was no-op
query = (Query)query.clone(); // then clone before boost query = query.clone(); // then clone before boost
} }
// Since the BooleanQuery only has 1 clause, the BooleanQuery will be // Since the BooleanQuery only has 1 clause, the BooleanQuery will be
// written out. Therefore the rewritten Query's boost must incorporate both // written out. Therefore the rewritten Query's boost must incorporate both

View File

@ -190,7 +190,7 @@ public class DisjunctionMaxQuery extends Query implements Iterable<Query> {
Query singleton = disjuncts.get(0); Query singleton = disjuncts.get(0);
Query result = singleton.rewrite(reader); Query result = singleton.rewrite(reader);
if (getBoost() != 1.0f) { if (getBoost() != 1.0f) {
if (result == singleton) result = (Query)result.clone(); if (result == singleton) result = result.clone();
result.setBoost(getBoost() * result.getBoost()); result.setBoost(getBoost() * result.getBoost());
} }
return result; return result;

View File

@ -334,7 +334,7 @@ public class AttributeSource {
*/ */
public final State captureState() { public final State captureState() {
final State state = this.getCurrentState(); final State state = this.getCurrentState();
return (state == null) ? null : (State) state.clone(); return (state == null) ? null : state.clone();
} }
/** /**
@ -466,7 +466,7 @@ public class AttributeSource {
if (hasAttributes()) { if (hasAttributes()) {
// first clone the impls // first clone the impls
for (State state = getCurrentState(); state != null; state = state.next) { for (State state = getCurrentState(); state != null; state = state.next) {
clone.attributeImpls.put(state.attribute.getClass(), (AttributeImpl) state.attribute.clone()); clone.attributeImpls.put(state.attribute.getClass(), state.attribute.clone());
} }
// now the interfaces // now the interfaces

View File

@ -255,7 +255,7 @@ public class TestCodecs extends LuceneTestCase {
final FieldData[] fields = new FieldData[] {field}; final FieldData[] fields = new FieldData[] {field};
final Directory dir = newDirectory(); final Directory dir = newDirectory();
FieldInfos clonedFieldInfos = (FieldInfos) fieldInfos.clone(); FieldInfos clonedFieldInfos = fieldInfos.clone();
this.write(fieldInfos, dir, fields, true); this.write(fieldInfos, dir, fields, true);
Codec codec = Codec.getDefault(); Codec codec = Codec.getDefault();
final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, codec, clonedFieldInfos); final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, codec, clonedFieldInfos);
@ -311,7 +311,7 @@ public class TestCodecs extends LuceneTestCase {
System.out.println("TEST: now write postings"); System.out.println("TEST: now write postings");
} }
FieldInfos clonedFieldInfos = (FieldInfos) fieldInfos.clone(); FieldInfos clonedFieldInfos = fieldInfos.clone();
this.write(fieldInfos, dir, fields, false); this.write(fieldInfos, dir, fields, false);
Codec codec = Codec.getDefault(); Codec codec = Codec.getDefault();
final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, codec, clonedFieldInfos); final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, codec, clonedFieldInfos);

View File

@ -102,7 +102,7 @@ public class TestFieldInfos extends LuceneTestCase {
FieldInfos fieldInfos = createAndWriteFieldInfos(dir, name); FieldInfos fieldInfos = createAndWriteFieldInfos(dir, name);
FieldInfos readOnly = readFieldInfos(dir, name); FieldInfos readOnly = readFieldInfos(dir, name);
assertReadOnly(readOnly, fieldInfos); assertReadOnly(readOnly, fieldInfos);
FieldInfos readOnlyClone = (FieldInfos)readOnly.clone(); FieldInfos readOnlyClone = readOnly.clone();
assertNotSame(readOnly, readOnlyClone); assertNotSame(readOnly, readOnlyClone);
// clone is also read only - no global field map // clone is also read only - no global field map
assertReadOnly(readOnlyClone, fieldInfos); assertReadOnly(readOnlyClone, fieldInfos);

View File

@ -156,7 +156,7 @@ public class TestIndexWriterConfig extends LuceneTestCase {
@Test @Test
public void testClone() throws Exception { public void testClone() throws Exception {
IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)); IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random));
IndexWriterConfig clone = (IndexWriterConfig) conf.clone(); IndexWriterConfig clone = conf.clone();
// Clone is shallow since not all parameters are cloneable. // Clone is shallow since not all parameters are cloneable.
assertTrue(conf.getIndexDeletionPolicy() == clone.getIndexDeletionPolicy()); assertTrue(conf.getIndexDeletionPolicy() == clone.getIndexDeletionPolicy());

View File

@ -94,7 +94,7 @@ public class TestBooleanQuery extends LuceneTestCase {
assertEquals(score*.5F, score2, 1e-6); assertEquals(score*.5F, score2, 1e-6);
// LUCENE-2617: make sure that a clause not in the index still contributes to the score via coord factor // LUCENE-2617: make sure that a clause not in the index still contributes to the score via coord factor
BooleanQuery qq = (BooleanQuery)q.clone(); BooleanQuery qq = q.clone();
PhraseQuery phrase = new PhraseQuery(); PhraseQuery phrase = new PhraseQuery();
phrase.add(new Term("field", "not_in_index")); phrase.add(new Term("field", "not_in_index"));
phrase.add(new Term("field", "another_not_in_index")); phrase.add(new Term("field", "another_not_in_index"));

View File

@ -139,14 +139,14 @@ public class TestFixedBitSet extends LuceneTestCase {
fromIndex = random.nextInt(sz/2); fromIndex = random.nextInt(sz/2);
toIndex = fromIndex + random.nextInt(sz - fromIndex); toIndex = fromIndex + random.nextInt(sz - fromIndex);
BitSet aa = (BitSet)a.clone(); aa.flip(fromIndex,toIndex); BitSet aa = (BitSet)a.clone(); aa.flip(fromIndex,toIndex);
FixedBitSet bb = (FixedBitSet)b.clone(); bb.flip(fromIndex,toIndex); FixedBitSet bb = b.clone(); bb.flip(fromIndex,toIndex);
doIterate(aa,bb, mode); // a problem here is from flip or doIterate doIterate(aa,bb, mode); // a problem here is from flip or doIterate
fromIndex = random.nextInt(sz/2); fromIndex = random.nextInt(sz/2);
toIndex = fromIndex + random.nextInt(sz - fromIndex); toIndex = fromIndex + random.nextInt(sz - fromIndex);
aa = (BitSet)a.clone(); aa.clear(fromIndex,toIndex); aa = (BitSet)a.clone(); aa.clear(fromIndex,toIndex);
bb = (FixedBitSet)b.clone(); bb.clear(fromIndex,toIndex); bb = b.clone(); bb.clear(fromIndex,toIndex);
doNextSetBit(aa,bb); // a problem here is from clear() or nextSetBit doNextSetBit(aa,bb); // a problem here is from clear() or nextSetBit
@ -155,7 +155,7 @@ public class TestFixedBitSet extends LuceneTestCase {
fromIndex = random.nextInt(sz/2); fromIndex = random.nextInt(sz/2);
toIndex = fromIndex + random.nextInt(sz - fromIndex); toIndex = fromIndex + random.nextInt(sz - fromIndex);
aa = (BitSet)a.clone(); aa.set(fromIndex,toIndex); aa = (BitSet)a.clone(); aa.set(fromIndex,toIndex);
bb = (FixedBitSet)b.clone(); bb.set(fromIndex,toIndex); bb = b.clone(); bb.set(fromIndex,toIndex);
doNextSetBit(aa,bb); // a problem here is from set() or nextSetBit doNextSetBit(aa,bb); // a problem here is from set() or nextSetBit
@ -168,9 +168,9 @@ public class TestFixedBitSet extends LuceneTestCase {
BitSet a_or = (BitSet)a.clone(); a_or.or(a0); BitSet a_or = (BitSet)a.clone(); a_or.or(a0);
BitSet a_andn = (BitSet)a.clone(); a_andn.andNot(a0); BitSet a_andn = (BitSet)a.clone(); a_andn.andNot(a0);
FixedBitSet b_and = (FixedBitSet)b.clone(); assertEquals(b,b_and); b_and.and(b0); FixedBitSet b_and = b.clone(); assertEquals(b,b_and); b_and.and(b0);
FixedBitSet b_or = (FixedBitSet)b.clone(); b_or.or(b0); FixedBitSet b_or = b.clone(); b_or.or(b0);
FixedBitSet b_andn = (FixedBitSet)b.clone(); b_andn.andNot(b0); FixedBitSet b_andn = b.clone(); b_andn.andNot(b0);
assertEquals(a0.cardinality(), b0.cardinality()); assertEquals(a0.cardinality(), b0.cardinality());
assertEquals(a_or.cardinality(), b_or.cardinality()); assertEquals(a_or.cardinality(), b_or.cardinality());

View File

@ -354,7 +354,7 @@ public class TernaryTree implements Cloneable {
t.hi = this.hi.clone(); t.hi = this.hi.clone();
t.eq = this.eq.clone(); t.eq = this.eq.clone();
t.sc = this.sc.clone(); t.sc = this.sc.clone();
t.kv = (CharVector) this.kv.clone(); t.kv = this.kv.clone();
t.root = this.root; t.root = this.root;
t.freenode = this.freenode; t.freenode = this.freenode;
t.length = this.length; t.length = this.length;
@ -556,11 +556,11 @@ public class TernaryTree implements Cloneable {
case 1: case 1:
if (sc[i.parent] != 0) { if (sc[i.parent] != 0) {
res = eq[i.parent]; res = eq[i.parent];
ns.push((Item) i.clone()); ns.push(i.clone());
ks.append(sc[i.parent]); ks.append(sc[i.parent]);
} else { } else {
i.child++; i.child++;
ns.push((Item) i.clone()); ns.push(i.clone());
res = hi[i.parent]; res = hi[i.parent];
} }
climb = false; climb = false;
@ -568,7 +568,7 @@ public class TernaryTree implements Cloneable {
case 2: case 2:
res = hi[i.parent]; res = hi[i.parent];
ns.push((Item) i.clone()); ns.push(i.clone());
if (ks.length() > 0) { if (ks.length() > 0) {
ks.setLength(ks.length() - 1); // pop ks.setLength(ks.length() - 1); // pop
} }

View File

@ -95,7 +95,7 @@ public class PrefixAwareTokenFilter extends TokenStream {
// Make it a deep copy // Make it a deep copy
Payload p = previousPrefixToken.getPayload(); Payload p = previousPrefixToken.getPayload();
if (p != null) { if (p != null) {
previousPrefixToken.setPayload((Payload) p.clone()); previousPrefixToken.setPayload(p.clone());
} }
setCurrentToken(nextToken); setCurrentToken(nextToken);
return true; return true;

View File

@ -39,7 +39,7 @@ public final class SingleTokenTokenStream extends TokenStream {
super(Token.TOKEN_ATTRIBUTE_FACTORY); super(Token.TOKEN_ATTRIBUTE_FACTORY);
assert token != null; assert token != null;
this.singleToken = (Token) token.clone(); this.singleToken = token.clone();
tokenAtt = (AttributeImpl) addAttribute(CharTermAttribute.class); tokenAtt = (AttributeImpl) addAttribute(CharTermAttribute.class);
assert (tokenAtt instanceof Token); assert (tokenAtt instanceof Token);
@ -63,10 +63,10 @@ public final class SingleTokenTokenStream extends TokenStream {
} }
public Token getToken() { public Token getToken() {
return (Token) singleToken.clone(); return singleToken.clone();
} }
public void setToken(Token token) { public void setToken(Token token) {
this.singleToken = (Token) token.clone(); this.singleToken = token.clone();
} }
} }

View File

@ -148,7 +148,7 @@ public class TestCharArrayIterator extends LuceneTestCase {
char text[] = "testing".toCharArray(); char text[] = "testing".toCharArray();
ci.setText(text, 0, text.length); ci.setText(text, 0, text.length);
ci.next(); ci.next();
CharArrayIterator ci2 = (CharArrayIterator) ci.clone(); CharArrayIterator ci2 = ci.clone();
assertEquals(ci.getIndex(), ci2.getIndex()); assertEquals(ci.getIndex(), ci2.getIndex());
assertEquals(ci.next(), ci2.next()); assertEquals(ci.next(), ci2.next());
assertEquals(ci.last(), ci2.last()); assertEquals(ci.last(), ci2.last());

View File

@ -216,11 +216,11 @@ public class LaoBreakIterator extends BreakIterator {
other.rules = (RuleBasedBreakIterator) rules.clone(); other.rules = (RuleBasedBreakIterator) rules.clone();
other.verify = (RuleBasedBreakIterator) verify.clone(); other.verify = (RuleBasedBreakIterator) verify.clone();
if (text != null) if (text != null)
other.text = (CharArrayIterator) text.clone(); other.text = text.clone();
if (working != null) if (working != null)
other.working = (CharArrayIterator) working.clone(); other.working = working.clone();
if (verifyText != null) if (verifyText != null)
other.verifyText = (CharArrayIterator) verifyText.clone(); other.verifyText = verifyText.clone();
return other; return other;
} }
} }

View File

@ -99,7 +99,7 @@ public class TestCharArrayIterator extends LuceneTestCase {
CharArrayIterator ci = new CharArrayIterator(); CharArrayIterator ci = new CharArrayIterator();
ci.setText(text, 0, text.length); ci.setText(text, 0, text.length);
ci.next(); ci.next();
CharArrayIterator ci2 = (CharArrayIterator) ci.clone(); CharArrayIterator ci2 = ci.clone();
assertEquals(ci.getIndex(), ci2.getIndex()); assertEquals(ci.getIndex(), ci2.getIndex());
assertEquals(ci.next(), ci2.next()); assertEquals(ci.next(), ci2.next());
assertEquals(ci.last(), ci2.last()); assertEquals(ci.last(), ci2.last());

View File

@ -464,7 +464,7 @@ private int jjMoveNfa_0(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -569,7 +569,7 @@ private int jjMoveNfa_5(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -670,7 +670,7 @@ private int jjMoveNfa_7(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -766,7 +766,7 @@ private int jjMoveNfa_4(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -892,7 +892,7 @@ private int jjMoveNfa_3(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -1061,7 +1061,7 @@ private int jjMoveNfa_6(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -1205,7 +1205,7 @@ private int jjMoveNfa_1(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -1361,7 +1361,7 @@ private int jjMoveNfa_2(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;

View File

@ -63,7 +63,7 @@ public class RepSumByNameRoundTask extends ReportTask {
TaskStats stat2 = p2.get(rname); TaskStats stat2 = p2.get(rname);
if (stat2 == null) { if (stat2 == null) {
try { try {
stat2 = (TaskStats) stat1.clone(); stat2 = stat1.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -62,7 +62,7 @@ public class RepSumByNameTask extends ReportTask {
TaskStats stat2 = p2.get(name); TaskStats stat2 = p2.get(name);
if (stat2 == null) { if (stat2 == null) {
try { try {
stat2 = (TaskStats) stat1.clone(); stat2 = stat1.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -59,7 +59,7 @@ public class RepSumByPrefRoundTask extends RepSumByPrefTask {
TaskStats stat2 = p2.get(rname); TaskStats stat2 = p2.get(rname);
if (stat2 == null) { if (stat2 == null) {
try { try {
stat2 = (TaskStats) stat1.clone(); stat2 = stat1.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -60,7 +60,7 @@ public class RepSumByPrefTask extends ReportTask {
TaskStats stat2 = p2.get(name); TaskStats stat2 = p2.get(name);
if (stat2 == null) { if (stat2 == null) {
try { try {
stat2 = (TaskStats) stat1.clone(); stat2 = stat1.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -347,7 +347,7 @@ public class TaskSequence extends PerfTask {
int index = 0; int index = 0;
for (int k=0; k<repetitions; k++) { for (int k=0; k<repetitions; k++) {
for (int i = 0; i < tasksArray.length; i++) { for (int i = 0; i < tasksArray.length; i++) {
final PerfTask task = (PerfTask) tasksArray[i].clone(); final PerfTask task = tasksArray[i].clone();
t[index++] = new ParallelTask(task); t[index++] = new ParallelTask(task);
} }
} }
@ -512,7 +512,7 @@ public class TaskSequence extends PerfTask {
TaskSequence res = (TaskSequence) super.clone(); TaskSequence res = (TaskSequence) super.clone();
res.tasks = new ArrayList<PerfTask>(); res.tasks = new ArrayList<PerfTask>();
for (int i = 0; i < tasks.size(); i++) { for (int i = 0; i < tasks.size(); i++) {
res.tasks.add((PerfTask)tasks.get(i).clone()); res.tasks.add(tasks.get(i).clone());
} }
return res; return res;
} }

View File

@ -124,7 +124,7 @@ public final class CategoryAttributeImpl extends AttributeImpl implements
public CategoryAttributeImpl clone() { public CategoryAttributeImpl clone() {
CategoryAttributeImpl ca = (CategoryAttributeImpl) super.clone(); CategoryAttributeImpl ca = (CategoryAttributeImpl) super.clone();
if (categoryPath != null) { if (categoryPath != null) {
ca.categoryPath = (CategoryPath) categoryPath.clone(); ca.categoryPath = categoryPath.clone();
} }
if (properties != null && !properties.isEmpty()) { if (properties != null && !properties.isEmpty()) {
ca.properties = (HashMap<Class<? extends CategoryProperty>, CategoryProperty>) properties ca.properties = (HashMap<Class<? extends CategoryProperty>, CategoryProperty>) properties

View File

@ -248,9 +248,9 @@ public abstract class FacetRequest implements Cloneable {
public FacetResultsHandler createFacetResultsHandler(TaxonomyReader taxonomyReader) { public FacetResultsHandler createFacetResultsHandler(TaxonomyReader taxonomyReader) {
try { try {
if (resultMode == ResultMode.PER_NODE_IN_TREE) { if (resultMode == ResultMode.PER_NODE_IN_TREE) {
return new TopKInEachNodeHandler(taxonomyReader, (FacetRequest) clone()); return new TopKInEachNodeHandler(taxonomyReader, clone());
} }
return new TopKFacetResultsHandler(taxonomyReader, (FacetRequest) clone()); return new TopKFacetResultsHandler(taxonomyReader, clone());
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// Shouldn't happen since we implement Cloneable. If it does happen, it is // Shouldn't happen since we implement Cloneable. If it does happen, it is
// probably because the class was changed to not implement Cloneable // probably because the class was changed to not implement Cloneable

View File

@ -56,7 +56,7 @@ public class ScoredDocIdsUtils {
final OpenBitSet complement; final OpenBitSet complement;
if (docIdSet instanceof OpenBitSet) { if (docIdSet instanceof OpenBitSet) {
// That is the most common case, if ScoredDocIdsCollector was used. // That is the most common case, if ScoredDocIdsCollector was used.
complement = (OpenBitSet) ((OpenBitSet) docIdSet).clone(); complement = ((OpenBitSet) docIdSet).clone();
} else { } else {
complement = new OpenBitSetDISI(docIdSet.iterator(), maxDoc); complement = new OpenBitSetDISI(docIdSet.iterator(), maxDoc);
} }

View File

@ -88,7 +88,7 @@ public class FacetRequestTest extends LuceneTestCase {
@Test @Test
public void testClone() throws Exception { public void testClone() throws Exception {
FacetRequest fr = new CountFacetRequest(new CategoryPath("a"), 10); FacetRequest fr = new CountFacetRequest(new CategoryPath("a"), 10);
FacetRequest clone = (FacetRequest) fr.clone(); FacetRequest clone = fr.clone();
fr.setDepth(10); fr.setDepth(10);
assertEquals("depth should not have been affected in the clone", FacetRequest.DEFAULT_DEPTH, clone.getDepth()); assertEquals("depth should not have been affected in the clone", FacetRequest.DEFAULT_DEPTH, clone.getDepth());
} }

View File

@ -336,7 +336,7 @@ public class ToChildBlockJoinQuery extends Query {
@Override @Override
public ToChildBlockJoinQuery clone() { public ToChildBlockJoinQuery clone() {
return new ToChildBlockJoinQuery((Query) origParentQuery.clone(), return new ToChildBlockJoinQuery(origParentQuery.clone(),
parentsFilter, parentsFilter,
doScores); doScores);
} }

View File

@ -451,7 +451,7 @@ public class ToParentBlockJoinQuery extends Query {
@Override @Override
public ToParentBlockJoinQuery clone() { public ToParentBlockJoinQuery clone() {
return new ToParentBlockJoinQuery((Query) origChildQuery.clone(), return new ToParentBlockJoinQuery(origChildQuery.clone(),
parentsFilter, parentsFilter,
scoreMode); scoreMode);
} }

View File

@ -44,7 +44,7 @@ public class BoostingQuery extends Query {
public BoostingQuery(Query match, Query context, float boost) { public BoostingQuery(Query match, Query context, float boost) {
this.match = match; this.match = match;
this.context = (Query) context.clone(); // clone before boost this.context = context.clone(); // clone before boost
this.boost = boost; this.boost = boost;
this.context.setBoost(0.0f); // ignore context-only matches this.context.setBoost(0.0f); // ignore context-only matches
} }

View File

@ -88,14 +88,14 @@ public class CustomScoreQuery extends Query {
final Query sq = subQuery.rewrite(reader); final Query sq = subQuery.rewrite(reader);
if (sq != subQuery) { if (sq != subQuery) {
clone = (CustomScoreQuery) clone(); clone = clone();
clone.subQuery = sq; clone.subQuery = sq;
} }
for(int i = 0; i < scoringQueries.length; i++) { for(int i = 0; i < scoringQueries.length; i++) {
final Query v = scoringQueries[i].rewrite(reader); final Query v = scoringQueries[i].rewrite(reader);
if (v != scoringQueries[i]) { if (v != scoringQueries[i]) {
if (clone == null) clone = (CustomScoreQuery) clone(); if (clone == null) clone = clone();
clone.scoringQueries[i] = v; clone.scoringQueries[i] = v;
} }
} }
@ -116,10 +116,10 @@ public class CustomScoreQuery extends Query {
@Override @Override
public CustomScoreQuery clone() { public CustomScoreQuery clone() {
CustomScoreQuery clone = (CustomScoreQuery)super.clone(); CustomScoreQuery clone = (CustomScoreQuery)super.clone();
clone.subQuery = (Query) subQuery.clone(); clone.subQuery = subQuery.clone();
clone.scoringQueries = new Query[scoringQueries.length]; clone.scoringQueries = new Query[scoringQueries.length];
for(int i = 0; i < scoringQueries.length; i++) { for(int i = 0; i < scoringQueries.length; i++) {
clone.scoringQueries[i] = (Query) scoringQueries[i].clone(); clone.scoringQueries[i] = scoringQueries[i].clone();
} }
return clone; return clone;
} }

View File

@ -438,7 +438,7 @@ private int jjMoveNfa_2(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -604,7 +604,7 @@ private int jjMoveNfa_0(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -777,7 +777,7 @@ private int jjMoveNfa_1(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;

View File

@ -374,7 +374,7 @@ private int jjMoveNfa_2(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -494,7 +494,7 @@ private int jjMoveNfa_0(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -667,7 +667,7 @@ private int jjMoveNfa_1(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;

View File

@ -37,12 +37,11 @@ public class OpenRangeQueryNodeProcessor extends QueryNodeProcessorImpl {
if (node instanceof TermRangeQueryNode) { if (node instanceof TermRangeQueryNode) {
TermRangeQueryNode rangeNode = (TermRangeQueryNode) node; TermRangeQueryNode rangeNode = (TermRangeQueryNode) node;
FieldQueryNode lowerNode = (FieldQueryNode) rangeNode.getLowerBound(); FieldQueryNode lowerNode = rangeNode.getLowerBound();
FieldQueryNode upperNode = (FieldQueryNode) rangeNode.getUpperBound(); FieldQueryNode upperNode = rangeNode.getUpperBound();
CharSequence lowerText = lowerNode.getText(); CharSequence lowerText = lowerNode.getText();
CharSequence upperText = upperNode.getText(); CharSequence upperText = upperNode.getText();
if (OPEN_RANGE_TOKEN.equals(upperNode.getTextAsString()) if (OPEN_RANGE_TOKEN.equals(upperNode.getTextAsString())
&& (!(upperText instanceof UnescapedCharSequence) || !((UnescapedCharSequence) upperText) && (!(upperText instanceof UnescapedCharSequence) || !((UnescapedCharSequence) upperText)
.wasEscaped(0))) { .wasEscaped(0))) {
@ -57,7 +56,6 @@ public class OpenRangeQueryNodeProcessor extends QueryNodeProcessorImpl {
lowerNode.setText(lowerText); lowerNode.setText(lowerText);
upperNode.setText(upperText); upperNode.setText(upperText);
} }
return node; return node;

View File

@ -348,7 +348,7 @@ private int jjMoveNfa_1(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;
@ -468,7 +468,7 @@ private int jjMoveNfa_0(int startState, int curPos)
} }
else else
{ {
int hiByte = (int)(curChar >> 8); int hiByte = (curChar >> 8);
int i1 = hiByte >> 6; int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077); long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6; int i2 = (curChar & 0xff) >> 6;

View File

@ -54,7 +54,7 @@ public class FieldsQuery extends SrndQuery { /* mostly untested */
Iterator<String> fni = getFieldNames().listIterator(); Iterator<String> fni = getFieldNames().listIterator();
SrndQuery qc; SrndQuery qc;
while (fni.hasNext()) { while (fni.hasNext()) {
qc = (SrndQuery) q.clone(); qc = q.clone();
queries.add( new FieldsQuery( qc, fni.next(), fieldOp)); queries.add( new FieldsQuery( qc, fni.next(), fieldOp));
} }
OrQuery oq = new OrQuery(queries, OrQuery oq = new OrQuery(queries,

View File

@ -58,7 +58,7 @@ public class CommonGramsFilterFactory extends BaseTokenFilterFactory implements
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} else { } else {
commonWords = (CharArraySet) StopAnalyzer.ENGLISH_STOP_WORDS_SET; commonWords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
} }
} }

View File

@ -65,7 +65,7 @@ public class CommonGramsQueryFilterFactory extends BaseTokenFilterFactory
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} else { } else {
commonWords = (CharArraySet) StopAnalyzer.ENGLISH_STOP_WORDS_SET; commonWords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
} }
} }

View File

@ -60,7 +60,7 @@ public final class MaxFieldValueUpdateProcessorFactory extends FieldValueSubsetU
Collection result = values; Collection result = values;
try { try {
result = Collections.singletonList result = Collections.singletonList
(Collections.max((Collection)values)); (Collections.max(values));
} catch (ClassCastException e) { } catch (ClassCastException e) {
throw new SolrException throw new SolrException
(BAD_REQUEST, (BAD_REQUEST,

View File

@ -60,7 +60,7 @@ public final class MinFieldValueUpdateProcessorFactory extends FieldValueSubsetU
Collection result = values; Collection result = values;
try { try {
result = Collections.singletonList result = Collections.singletonList
(Collections.min((Collection)values)); (Collections.min(values));
} catch (ClassCastException e) { } catch (ClassCastException e) {
throw new SolrException throw new SolrException
(BAD_REQUEST, (BAD_REQUEST,

View File

@ -321,7 +321,7 @@ public class ConcurrentLRUCache<K,V> {
// this loop so far. // this loop so far.
queue.myMaxSize = sz - lowerWaterMark - numRemoved; queue.myMaxSize = sz - lowerWaterMark - numRemoved;
while (queue.size() > queue.myMaxSize && queue.size() > 0) { while (queue.size() > queue.myMaxSize && queue.size() > 0) {
CacheEntry otherEntry = (CacheEntry) queue.pop(); CacheEntry otherEntry = queue.pop();
newOldestEntry = Math.min(otherEntry.lastAccessedCopy, newOldestEntry); newOldestEntry = Math.min(otherEntry.lastAccessedCopy, newOldestEntry);
} }
if (queue.myMaxSize <= 0) break; if (queue.myMaxSize <= 0) break;

View File

@ -207,10 +207,10 @@ public class DateFieldTest extends LuceneTestCase {
public void testCreateField() { public void testCreateField() {
int props = FieldProperties.INDEXED ^ FieldProperties.STORED; int props = FieldProperties.INDEXED ^ FieldProperties.STORED;
SchemaField sf = new SchemaField( "test", f, props, null ); SchemaField sf = new SchemaField( "test", f, props, null );
IndexableField out = (Field)f.createField(sf, "1995-12-31T23:59:59Z", 1.0f ); IndexableField out = f.createField(sf, "1995-12-31T23:59:59Z", 1.0f );
assertEquals(820454399000l, f.toObject( out ).getTime() ); assertEquals(820454399000l, f.toObject( out ).getTime() );
out = (Field)f.createField(sf, new Date(820454399000l), 1.0f ); out = f.createField(sf, new Date(820454399000l), 1.0f );
assertEquals(820454399000l, f.toObject( out ).getTime() ); assertEquals(820454399000l, f.toObject( out ).getTime() );
} }
} }