LUCENE-2000: clone() now returns covariant types where possible.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1306626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2012-03-28 22:22:25 +00:00
parent ec18632428
commit 05fe168961
73 changed files with 93 additions and 91 deletions

View File

@ -257,6 +257,8 @@ Changes in backwards compatibility policy
you can use SlowCompositeReaderWrapper to make all parallel readers atomic you can use SlowCompositeReaderWrapper to make all parallel readers atomic
and use ParallelAtomicReader. (Uwe Schindler, Mike McCandless, Robert Muir) and use ParallelAtomicReader. (Uwe Schindler, Mike McCandless, Robert Muir)
* LUCENE-2000: clone() now returns covariant types where possible. (ryan)
Changes in Runtime Behavior Changes in Runtime Behavior
* LUCENE-2846: omitNorms now behaves like omitTermFrequencyAndPositions, if you * LUCENE-2846: omitNorms now behaves like omitTermFrequencyAndPositions, if you

View File

@ -424,7 +424,7 @@ public class NativeUnixDirectory extends FSDirectory {
} }
@Override @Override
public Object clone() { public NativeUnixIndexInput clone() {
try { try {
return new NativeUnixIndexInput(this); return new NativeUnixIndexInput(this);
} catch (IOException ioe) { } catch (IOException ioe) {

View File

@ -120,7 +120,7 @@ public class WindowsDirectory extends FSDirectory {
} }
@Override @Override
public Object clone() { public WindowsIndexInput clone() {
WindowsIndexInput clone = (WindowsIndexInput)super.clone(); WindowsIndexInput clone = (WindowsIndexInput)super.clone();
clone.isClone = true; clone.isClone = true;
return clone; return clone;

View File

@ -366,7 +366,7 @@ public class Token extends CharTermAttributeImpl
} }
@Override @Override
public Object clone() { public Token clone() {
Token t = (Token)super.clone(); Token t = (Token)super.clone();
// Do a deep clone // Do a deep clone
if (payload != null) { if (payload != null) {

View File

@ -208,7 +208,7 @@ public class CharTermAttributeImpl extends AttributeImpl implements CharTermAttr
} }
@Override @Override
public Object clone() { public CharTermAttributeImpl clone() {
CharTermAttributeImpl t = (CharTermAttributeImpl)super.clone(); CharTermAttributeImpl t = (CharTermAttributeImpl)super.clone();
// Do a deep clone // Do a deep clone
t.termBuffer = new char[this.termLength]; t.termBuffer = new char[this.termLength];

View File

@ -58,7 +58,7 @@ public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttrib
} }
@Override @Override
public Object 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) payload.clone();

View File

@ -95,7 +95,7 @@ public class BlockTermsReader extends FieldsProducer {
} }
@Override @Override
public Object clone() { public FieldAndTerm clone() {
return new FieldAndTerm(this); return new FieldAndTerm(this);
} }

View File

@ -181,7 +181,7 @@ public abstract class FixedIntBlockIndexInput extends IntIndexInput {
} }
@Override @Override
public Object clone() { public Index clone() {
Index other = new Index(); Index other = new Index();
other.fp = fp; other.fp = fp;
other.upto = upto; other.upto = upto;

View File

@ -207,7 +207,7 @@ public abstract class VariableIntBlockIndexInput extends IntIndexInput {
} }
@Override @Override
public Object clone() { public Index clone() {
Index other = new Index(); Index other = new Index();
other.fp = fp; other.fp = fp;
other.upto = upto; other.upto = upto;

View File

@ -100,7 +100,7 @@ final class SegmentTermEnum implements Cloneable {
} }
@Override @Override
protected Object clone() { protected SegmentTermEnum clone() {
SegmentTermEnum clone = null; SegmentTermEnum clone = null;
try { try {
clone = (SegmentTermEnum) super.clone(); clone = (SegmentTermEnum) super.clone();

View File

@ -111,7 +111,7 @@ final class TermBuffer implements Cloneable {
} }
@Override @Override
protected Object clone() { protected TermBuffer clone() {
TermBuffer clone = null; TermBuffer clone = null;
try { try {
clone = (TermBuffer)super.clone(); clone = (TermBuffer)super.clone();

View File

@ -82,7 +82,7 @@ final class TermInfosReader {
} }
@Override @Override
public Object clone() { public CloneableTerm clone() {
return new CloneableTerm(term); return new CloneableTerm(term);
} }
} }

View File

@ -105,7 +105,7 @@ public class Lucene40PostingsReader extends PostingsReaderBase {
byte[] bytes; byte[] bytes;
@Override @Override
public Object clone() { public StandardTermState clone() {
StandardTermState other = new StandardTermState(); StandardTermState other = new StandardTermState();
other.copyFrom(this); other.copyFrom(this);
return other; return other;

View File

@ -73,7 +73,7 @@ public class PulsingPostingsReader extends PostingsReaderBase {
private byte[] inlinedBytes; private byte[] inlinedBytes;
@Override @Override
public Object clone() { public PulsingTermState clone() {
PulsingTermState clone; PulsingTermState clone;
clone = (PulsingTermState) super.clone(); clone = (PulsingTermState) super.clone();
if (postingsSize != -1) { if (postingsSize != -1) {

View File

@ -47,7 +47,7 @@ public abstract class IntIndexInput implements Closeable {
public abstract void set(Index other); public abstract void set(Index other);
@Override @Override
public abstract Object clone(); public abstract Index clone();
} }
public abstract static class Reader { public abstract static class Reader {

View File

@ -161,7 +161,7 @@ public class SepPostingsReader extends PostingsReaderBase {
ByteArrayDataInput bytesReader; ByteArrayDataInput bytesReader;
@Override @Override
public Object clone() { public SepTermState clone() {
SepTermState other = new SepTermState(); SepTermState other = new SepTermState();
other.copyFrom(this); other.copyFrom(this);
return other; return other;

View File

@ -87,7 +87,7 @@ public final class FieldInfo {
} }
@Override @Override
public Object clone() { public FieldInfo clone() {
return new FieldInfo(name, isIndexed, number, storeTermVector, return new FieldInfo(name, isIndexed, number, storeTermVector,
omitNorms, storePayloads, indexOptions, docValueType, normType); omitNorms, storePayloads, indexOptions, docValueType, normType);
} }

View File

@ -163,7 +163,7 @@ public final class FieldInfos implements Iterable<FieldInfo> {
* Returns a deep clone of this FieldInfos instance. * Returns a deep clone of this FieldInfos instance.
*/ */
@Override @Override
synchronized public Object clone() { synchronized public FieldInfos clone() {
FieldInfos fis = new FieldInfos(globalFieldNumbers); FieldInfos fis = new FieldInfos(globalFieldNumbers);
fis.hasFreq = hasFreq; fis.hasFreq = hasFreq;
fis.hasProx = hasProx; fis.hasProx = hasProx;

View File

@ -185,11 +185,11 @@ public final class IndexWriterConfig implements Cloneable {
} }
@Override @Override
public Object clone() { public IndexWriterConfig clone() {
// Shallow clone is the only thing that's possible, since parameters like // Shallow clone is the only thing that's possible, since parameters like
// analyzer, index commit etc. do not implement Cloneable. // analyzer, index commit etc. do not implement Cloneable.
try { try {
return super.clone(); return (IndexWriterConfig)super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// should not happen // should not happen
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -155,7 +155,7 @@ public class Payload implements Cloneable {
* byte array. * byte array.
*/ */
@Override @Override
public Object clone() { public Payload clone() {
try { try {
// Start with a shallow copy of data // Start with a shallow copy of data
Payload clone = (Payload) super.clone(); Payload clone = (Payload) super.clone();

View File

@ -252,7 +252,7 @@ public final class SegmentInfo implements Cloneable {
} }
@Override @Override
public Object 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) fieldInfos.clone());
si.docStoreOffset = docStoreOffset; si.docStoreOffset = docStoreOffset;

View File

@ -374,7 +374,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfo> {
*/ */
@Override @Override
public Object clone() { public SegmentInfos clone() {
try { try {
final SegmentInfos sis = (SegmentInfos) super.clone(); final SegmentInfos sis = (SegmentInfos) super.clone();
// deep clone, first recreate all collections: // deep clone, first recreate all collections:

View File

@ -36,9 +36,9 @@ public abstract class TermState implements Cloneable {
public abstract void copyFrom(TermState other); public abstract void copyFrom(TermState other);
@Override @Override
public Object clone() { public TermState clone() {
try { try {
return super.clone(); return (TermState)super.clone();
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
// should not happen // should not happen
throw new RuntimeException(cnse); throw new RuntimeException(cnse);

View File

@ -454,7 +454,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
// The BooleanQuery clone is lazily initialized so only initialize // The BooleanQuery clone is lazily initialized so only initialize
// it if a rewritten clause differs from the original clause (and hasn't been // it if a rewritten clause differs from the original clause (and hasn't been
// initialized already). If nothing differs, the clone isn't needlessly created // initialized already). If nothing differs, the clone isn't needlessly created
clone = (BooleanQuery)this.clone(); clone = this.clone();
} }
clone.clauses.set(i, new BooleanClause(query, c.getOccur())); clone.clauses.set(i, new BooleanClause(query, c.getOccur()));
} }
@ -474,7 +474,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
} }
@Override @SuppressWarnings("unchecked") @Override @SuppressWarnings("unchecked")
public Object clone() { public BooleanQuery clone() {
BooleanQuery clone = (BooleanQuery)super.clone(); BooleanQuery clone = (BooleanQuery)super.clone();
clone.clauses = (ArrayList<BooleanClause>) this.clauses.clone(); clone.clauses = (ArrayList<BooleanClause>) this.clauses.clone();
return clone; return clone;

View File

@ -200,7 +200,7 @@ public class DisjunctionMaxQuery extends Query implements Iterable<Query> {
Query clause = disjuncts.get(i); Query clause = disjuncts.get(i);
Query rewrite = clause.rewrite(reader); Query rewrite = clause.rewrite(reader);
if (rewrite != clause) { if (rewrite != clause) {
if (clone == null) clone = (DisjunctionMaxQuery)this.clone(); if (clone == null) clone = this.clone();
clone.disjuncts.set(i, rewrite); clone.disjuncts.set(i, rewrite);
} }
} }
@ -211,7 +211,7 @@ public class DisjunctionMaxQuery extends Query implements Iterable<Query> {
/** Create a shallow copy of us -- used in rewriting if necessary /** Create a shallow copy of us -- used in rewriting if necessary
* @return a copy of us (but reuse, don't copy, our subqueries) */ * @return a copy of us (but reuse, don't copy, our subqueries) */
@Override @SuppressWarnings("unchecked") @Override @SuppressWarnings("unchecked")
public Object clone() { public DisjunctionMaxQuery clone() {
DisjunctionMaxQuery clone = (DisjunctionMaxQuery)super.clone(); DisjunctionMaxQuery clone = (DisjunctionMaxQuery)super.clone();
clone.disjuncts = (ArrayList<Query>) this.disjuncts.clone(); clone.disjuncts = (ArrayList<Query>) this.disjuncts.clone();
return clone; return clone;

View File

@ -97,9 +97,9 @@ public abstract class Query implements Cloneable {
/** Returns a clone of this query. */ /** Returns a clone of this query. */
@Override @Override
public Object clone() { public Query clone() {
try { try {
return super.clone(); return (Query)super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException("Clone not supported: " + e.getMessage()); throw new RuntimeException("Clone not supported: " + e.getMessage());
} }

View File

@ -76,7 +76,7 @@ public class PayloadNearQuery extends SpanNearQuery {
} }
@Override @Override
public Object clone() { public PayloadNearQuery clone() {
int sz = clauses.size(); int sz = clauses.size();
SpanQuery[] newClauses = new SpanQuery[sz]; SpanQuery[] newClauses = new SpanQuery[sz];

View File

@ -61,7 +61,7 @@ public class SpanFirstQuery extends SpanPositionRangeQuery {
} }
@Override @Override
public Object clone() { public SpanFirstQuery clone() {
SpanFirstQuery spanFirstQuery = new SpanFirstQuery((SpanQuery) match.clone(), end); SpanFirstQuery spanFirstQuery = new SpanFirstQuery((SpanQuery) match.clone(), end);
spanFirstQuery.setBoost(getBoost()); spanFirstQuery.setBoost(getBoost());
return spanFirstQuery; return spanFirstQuery;

View File

@ -88,7 +88,7 @@ public class SpanNearPayloadCheckQuery extends SpanPositionCheckQuery {
} }
@Override @Override
public Object clone() { public SpanNearPayloadCheckQuery clone() {
SpanNearPayloadCheckQuery result = new SpanNearPayloadCheckQuery((SpanNearQuery) match.clone(), payloadToMatch); SpanNearPayloadCheckQuery result = new SpanNearPayloadCheckQuery((SpanNearQuery) match.clone(), payloadToMatch);
result.setBoost(getBoost()); result.setBoost(getBoost());
return result; return result;

View File

@ -140,7 +140,7 @@ public class SpanNearQuery extends SpanQuery implements Cloneable {
SpanQuery query = (SpanQuery) c.rewrite(reader); SpanQuery query = (SpanQuery) c.rewrite(reader);
if (query != c) { // clause rewrote: must clone if (query != c) { // clause rewrote: must clone
if (clone == null) if (clone == null)
clone = (SpanNearQuery) this.clone(); clone = this.clone();
clone.clauses.set(i,query); clone.clauses.set(i,query);
} }
} }
@ -152,7 +152,7 @@ public class SpanNearQuery extends SpanQuery implements Cloneable {
} }
@Override @Override
public Object clone() { public SpanNearQuery clone() {
int sz = clauses.size(); int sz = clauses.size();
SpanQuery[] newClauses = new SpanQuery[sz]; SpanQuery[] newClauses = new SpanQuery[sz];

View File

@ -71,7 +71,7 @@ public class SpanNotQuery extends SpanQuery implements Cloneable {
} }
@Override @Override
public Object clone() { public SpanNotQuery clone() {
SpanNotQuery spanNotQuery = new SpanNotQuery((SpanQuery)include.clone(),(SpanQuery) exclude.clone()); SpanNotQuery spanNotQuery = new SpanNotQuery((SpanQuery)include.clone(),(SpanQuery) exclude.clone());
spanNotQuery.setBoost(getBoost()); spanNotQuery.setBoost(getBoost());
return spanNotQuery; return spanNotQuery;
@ -175,12 +175,12 @@ public class SpanNotQuery extends SpanQuery implements Cloneable {
SpanQuery rewrittenInclude = (SpanQuery) include.rewrite(reader); SpanQuery rewrittenInclude = (SpanQuery) include.rewrite(reader);
if (rewrittenInclude != include) { if (rewrittenInclude != include) {
clone = (SpanNotQuery) this.clone(); clone = this.clone();
clone.include = rewrittenInclude; clone.include = rewrittenInclude;
} }
SpanQuery rewrittenExclude = (SpanQuery) exclude.rewrite(reader); SpanQuery rewrittenExclude = (SpanQuery) exclude.rewrite(reader);
if (rewrittenExclude != exclude) { if (rewrittenExclude != exclude) {
if (clone == null) clone = (SpanNotQuery) this.clone(); if (clone == null) clone = this.clone();
clone.exclude = rewrittenExclude; clone.exclude = rewrittenExclude;
} }

View File

@ -76,7 +76,7 @@ public class SpanOrQuery extends SpanQuery implements Cloneable {
} }
@Override @Override
public Object clone() { public SpanOrQuery clone() {
int sz = clauses.size(); int sz = clauses.size();
SpanQuery[] newClauses = new SpanQuery[sz]; SpanQuery[] newClauses = new SpanQuery[sz];
@ -96,7 +96,7 @@ public class SpanOrQuery extends SpanQuery implements Cloneable {
SpanQuery query = (SpanQuery) c.rewrite(reader); SpanQuery query = (SpanQuery) c.rewrite(reader);
if (query != c) { // clause rewrote: must clone if (query != c) { // clause rewrote: must clone
if (clone == null) if (clone == null)
clone = (SpanOrQuery) this.clone(); clone = this.clone();
clone.clauses.set(i,query); clone.clauses.set(i,query);
} }
} }

View File

@ -90,7 +90,7 @@ public class SpanPayloadCheckQuery extends SpanPositionCheckQuery{
} }
@Override @Override
public Object clone() { public SpanPayloadCheckQuery clone() {
SpanPayloadCheckQuery result = new SpanPayloadCheckQuery((SpanQuery) match.clone(), payloadToMatch); SpanPayloadCheckQuery result = new SpanPayloadCheckQuery((SpanQuery) match.clone(), payloadToMatch);
result.setBoost(getBoost()); result.setBoost(getBoost());
return result; return result;

View File

@ -77,7 +77,7 @@ public class SpanPositionRangeQuery extends SpanPositionCheckQuery {
} }
@Override @Override
public Object clone() { public SpanPositionRangeQuery clone() {
SpanPositionRangeQuery result = new SpanPositionRangeQuery((SpanQuery) match.clone(), start, end); SpanPositionRangeQuery result = new SpanPositionRangeQuery((SpanQuery) match.clone(), start, end);
result.setBoost(getBoost()); result.setBoost(getBoost());
return result; return result;

View File

@ -306,7 +306,7 @@ public abstract class BufferedIndexInput extends IndexInput {
protected abstract void seekInternal(long pos) throws IOException; protected abstract void seekInternal(long pos) throws IOException;
@Override @Override
public Object clone() { public BufferedIndexInput clone() {
BufferedIndexInput clone = (BufferedIndexInput)super.clone(); BufferedIndexInput clone = (BufferedIndexInput)super.clone();
clone.buffer = null; clone.buffer = null;

View File

@ -184,7 +184,7 @@ public abstract class DataInput implements Cloneable {
* were cloned from. * were cloned from.
*/ */
@Override @Override
public Object clone() { public DataInput clone() {
DataInput clone = null; DataInput clone = null;
try { try {
clone = (DataInput)super.clone(); clone = (DataInput)super.clone();

View File

@ -284,7 +284,7 @@ public abstract class Directory implements Closeable {
} }
@Override @Override
public Object clone() { public SlicedIndexInput clone() {
SlicedIndexInput clone = (SlicedIndexInput)super.clone(); SlicedIndexInput clone = (SlicedIndexInput)super.clone();
clone.base = (IndexInput)base.clone(); clone.base = (IndexInput)base.clone();
clone.fileOffset = fileOffset; clone.fileOffset = fileOffset;

View File

@ -412,7 +412,7 @@ public class MMapDirectory extends FSDirectory {
} }
@Override @Override
public Object clone() { public MMapIndexInput clone() {
if (buffers == null) { if (buffers == null) {
throw new AlreadyClosedException("MMapIndexInput already closed: " + this); throw new AlreadyClosedException("MMapIndexInput already closed: " + this);
} }

View File

@ -193,7 +193,7 @@ public class SimpleFSDirectory extends FSDirectory {
} }
@Override @Override
public Object clone() { public SimpleFSIndexInput clone() {
SimpleFSIndexInput clone = (SimpleFSIndexInput)super.clone(); SimpleFSIndexInput clone = (SimpleFSIndexInput)super.clone();
clone.isClone = true; clone.isClone = true;
return clone; return clone;

View File

@ -123,10 +123,10 @@ public abstract class AttributeImpl implements Cloneable, Attribute {
* need to clone any members deeply, * need to clone any members deeply,
*/ */
@Override @Override
public Object clone() { public AttributeImpl clone() {
Object clone = null; AttributeImpl clone = null;
try { try {
clone = super.clone(); clone = (AttributeImpl)super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); // shouldn't happen throw new RuntimeException(e); // shouldn't happen
} }

View File

@ -101,12 +101,12 @@ public class AttributeSource {
State next; State next;
@Override @Override
public Object clone() { public State clone() {
State clone = new State(); State clone = new State();
clone.attribute = (AttributeImpl) attribute.clone(); clone.attribute = attribute.clone();
if (next != null) { if (next != null) {
clone.next = (State) next.clone(); clone.next = next.clone();
} }
return clone; return clone;

View File

@ -47,7 +47,7 @@ final public class DoubleBarrelLRUCache<K extends DoubleBarrelLRUCache.Cloneable
/** Object providing clone(); the key class must subclass this. */ /** Object providing clone(); the key class must subclass this. */
public static abstract class CloneableKey { public static abstract class CloneableKey {
@Override @Override
abstract public Object clone(); abstract public CloneableKey clone();
} }
private final Map<K,V> cache1; private final Map<K,V> cache1;

View File

@ -389,7 +389,7 @@ public final class FixedBitSet extends DocIdSet implements Bits {
} }
@Override @Override
public Object clone() { public FixedBitSet clone() {
return new FixedBitSet(this); return new FixedBitSet(this);
} }

View File

@ -731,7 +731,7 @@ public class OpenBitSet extends DocIdSet implements Bits, Cloneable {
} }
@Override @Override
public Object clone() { public OpenBitSet clone() {
try { try {
OpenBitSet obs = (OpenBitSet)super.clone(); OpenBitSet obs = (OpenBitSet)super.clone();
obs.bits = obs.bits.clone(); // hopefully an array clone is as fast(er) than arraycopy obs.bits = obs.bits.clone(); // hopefully an array clone is as fast(er) than arraycopy

View File

@ -415,7 +415,7 @@ public final class PagedBytes {
} }
@Override @Override
public Object clone() { public PagedBytesDataInput clone() {
PagedBytesDataInput clone = getDataInput(); PagedBytesDataInput clone = getDataInput();
clone.setPosition(getPosition()); clone.setPosition(getPosition());
return clone; return clone;

View File

@ -117,7 +117,7 @@ public class Test2BTerms extends LuceneTestCase {
} }
@Override @Override
public Object clone() { public MyTermAttributeImpl clone() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }

View File

@ -183,7 +183,7 @@ public class TestFieldsReader extends LuceneTestCase {
delegate.close(); delegate.close();
} }
@Override @Override
public Object clone() { public FaultyIndexInput clone() {
return new FaultyIndexInput((IndexInput) delegate.clone()); return new FaultyIndexInput((IndexInput) delegate.clone());
} }
} }

View File

@ -225,7 +225,7 @@ public class TestLazyProxSkipping extends LuceneTestCase {
} }
@Override @Override
public Object clone() { public SeeksCountingStream clone() {
return new SeeksCountingStream((IndexInput) this.input.clone()); return new SeeksCountingStream((IndexInput) this.input.clone());
} }

View File

@ -190,7 +190,7 @@ public class TestMultiLevelSkipList extends LuceneTestCase {
} }
@Override @Override
public Object clone() { public CountingStream clone() {
return new CountingStream((IndexInput) this.input.clone()); return new CountingStream((IndexInput) this.input.clone());
} }

View File

@ -156,7 +156,7 @@ public class TestDoubleBarrelLRUCache extends LuceneTestCase {
} }
@Override @Override
public Object clone() { public CloneableObject clone() {
return new CloneableObject(value); return new CloneableObject(value);
} }
} }
@ -179,7 +179,7 @@ public class TestDoubleBarrelLRUCache extends LuceneTestCase {
} }
@Override @Override
public Object clone() { public CloneableInteger clone() {
return new CloneableInteger(value); return new CloneableInteger(value);
} }
} }

View File

@ -99,7 +99,7 @@ public class MockSingleIntIndexInput extends IntIndexInput {
} }
@Override @Override
public Object clone() { public Index clone() {
Index other = new Index(); Index other = new Index();
other.fp = fp; other.fp = fp;
return other; return other;

View File

@ -65,7 +65,7 @@ public class MockIndexInputWrapper extends IndexInput {
} }
@Override @Override
public Object clone() { public MockIndexInputWrapper clone() {
ensureOpen(); ensureOpen();
dir.inputCloneCount.incrementAndGet(); dir.inputCloneCount.incrementAndGet();
IndexInput iiclone = (IndexInput) delegate.clone(); IndexInput iiclone = (IndexInput) delegate.clone();

View File

@ -80,7 +80,7 @@ public class CharVector implements Cloneable {
} }
@Override @Override
public Object clone() { public CharVector clone() {
CharVector cv = new CharVector(array.clone(), blockSize); CharVector cv = new CharVector(array.clone(), blockSize);
cv.n = this.n; cv.n = this.n;
return cv; return cv;

View File

@ -348,7 +348,7 @@ public class TernaryTree implements Cloneable {
} }
@Override @Override
public Object clone() { public TernaryTree clone() {
TernaryTree t = new TernaryTree(); TernaryTree t = new TernaryTree();
t.lo = this.lo.clone(); t.lo = this.lo.clone();
t.hi = this.hi.clone(); t.hi = this.hi.clone();
@ -484,7 +484,7 @@ public class TernaryTree implements Cloneable {
} }
@Override @Override
public Object clone() { public Item clone() {
return new Item(parent, child); return new Item(parent, child);
} }

View File

@ -113,9 +113,9 @@ public abstract class CharArrayIterator implements CharacterIterator {
} }
@Override @Override
public Object clone() { public CharArrayIterator clone() {
try { try {
return super.clone(); return (CharArrayIterator)super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// CharacterIterator does not allow you to throw CloneNotSupported // CharacterIterator does not allow you to throw CloneNotSupported
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -109,7 +109,7 @@ final class CharArrayIterator implements CharacterIterator {
} }
@Override @Override
public Object clone() { public CharArrayIterator clone() {
CharArrayIterator clone = new CharArrayIterator(); CharArrayIterator clone = new CharArrayIterator();
clone.setText(array, start, length); clone.setText(array, start, length);
clone.index = index; clone.index = index;

View File

@ -211,7 +211,7 @@ public class LaoBreakIterator extends BreakIterator {
* @return The clone. * @return The clone.
*/ */
@Override @Override
public Object clone() { public LaoBreakIterator clone() {
LaoBreakIterator other = (LaoBreakIterator) super.clone(); LaoBreakIterator other = (LaoBreakIterator) super.clone();
other.rules = (RuleBasedBreakIterator) rules.clone(); other.rules = (RuleBasedBreakIterator) rules.clone();
other.verify = (RuleBasedBreakIterator) verify.clone(); other.verify = (RuleBasedBreakIterator) verify.clone();

View File

@ -83,7 +83,7 @@ public class MorphosyntacticTagAttributeImpl extends AttributeImpl
((MorphosyntacticTagAttribute) target).setTag(this.tag); ((MorphosyntacticTagAttribute) target).setTag(this.tag);
} }
public Object clone() { public MorphosyntacticTagAttributeImpl clone() {
MorphosyntacticTagAttributeImpl cloned = new MorphosyntacticTagAttributeImpl(); MorphosyntacticTagAttributeImpl cloned = new MorphosyntacticTagAttributeImpl();
cloned.tag = (tag == null ? null : tag.toString()); cloned.tag = (tag == null ? null : tag.toString());
return cloned; return cloned;

View File

@ -208,7 +208,7 @@ public class TaskStats implements Cloneable {
* @see java.lang.Object#clone() * @see java.lang.Object#clone()
*/ */
@Override @Override
public Object clone() throws CloneNotSupportedException { public TaskStats clone() throws CloneNotSupportedException {
TaskStats c = (TaskStats) super.clone(); TaskStats c = (TaskStats) super.clone();
if (c.countsByTime != null) { if (c.countsByTime != null) {
c.countsByTime = c.countsByTime.clone(); c.countsByTime = c.countsByTime.clone();

View File

@ -111,10 +111,10 @@ public abstract class PerfTask implements Cloneable {
} }
@Override @Override
protected Object clone() throws CloneNotSupportedException { protected PerfTask clone() throws CloneNotSupportedException {
// tasks having non primitive data structures should override this. // tasks having non primitive data structures should override this.
// otherwise parallel running of a task sequence might not run correctly. // otherwise parallel running of a task sequence might not run correctly.
return super.clone(); return (PerfTask)super.clone();
} }
public void close() throws Exception { public void close() throws Exception {

View File

@ -508,7 +508,7 @@ public class TaskSequence extends PerfTask {
* @see java.lang.Object#clone() * @see java.lang.Object#clone()
*/ */
@Override @Override
protected Object clone() throws CloneNotSupportedException { protected TaskSequence clone() throws CloneNotSupportedException {
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++) {

View File

@ -121,7 +121,7 @@ public final class CategoryAttributeImpl extends AttributeImpl implements
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public CategoryAttribute 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) categoryPath.clone();

View File

@ -114,9 +114,9 @@ public abstract class FacetRequest implements Cloneable {
} }
@Override @Override
public Object clone() throws CloneNotSupportedException { public FacetRequest clone() throws CloneNotSupportedException {
// Overridden to make it public // Overridden to make it public
return super.clone(); return (FacetRequest)super.clone();
} }
public void setNumLabel(int numLabel) { public void setNumLabel(int numLabel) {

View File

@ -622,7 +622,7 @@ public class CategoryPath implements Serializable, Cloneable, Comparable<Categor
} }
@Override @Override
public Object clone() { public CategoryPath clone() {
return new CategoryPath(this); return new CategoryPath(this);
} }

View File

@ -107,7 +107,7 @@ public class SlowRAMDirectory extends RAMDirectory {
ii.readBytes(b, offset, len); ii.readBytes(b, offset, len);
} }
@Override public Object clone() { return ii.clone(); } @Override public IndexInput clone() { return (IndexInput)ii.clone(); }
@Override public void close() throws IOException { ii.close(); } @Override public void close() throws IOException { ii.close(); }
@Override public boolean equals(Object o) { return ii.equals(o); } @Override public boolean equals(Object o) { return ii.equals(o); }
@Override public long getFilePointer() { return ii.getFilePointer(); } @Override public long getFilePointer() { return ii.getFilePointer(); }

View File

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

View File

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

View File

@ -114,7 +114,7 @@ public class CustomScoreQuery extends Query {
/*(non-Javadoc) @see org.apache.lucene.search.Query#clone() */ /*(non-Javadoc) @see org.apache.lucene.search.Query#clone() */
@Override @Override
public Object clone() { public CustomScoreQuery clone() {
CustomScoreQuery clone = (CustomScoreQuery)super.clone(); CustomScoreQuery clone = (CustomScoreQuery)super.clone();
clone.subQuery = (Query) subQuery.clone(); clone.subQuery = (Query) subQuery.clone();
clone.scoringQueries = new Query[scoringQueries.length]; clone.scoringQueries = new Query[scoringQueries.length];

View File

@ -131,7 +131,7 @@ public abstract class QueryNodeImpl implements QueryNode, Cloneable {
} }
@Override @Override
public Object clone() throws CloneNotSupportedException { public QueryNode clone() throws CloneNotSupportedException {
return cloneTree(); return cloneTree();
} }

View File

@ -74,7 +74,7 @@ abstract class RewriteQuery<SQ extends SrndQuery> extends Query {
/** @throws UnsupportedOperationException */ /** @throws UnsupportedOperationException */
@Override @Override
public Object clone() { public RewriteQuery clone() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }

View File

@ -62,9 +62,9 @@ public abstract class SrndQuery implements Cloneable {
public boolean isFieldsSubQueryAcceptable() {return true;} public boolean isFieldsSubQueryAcceptable() {return true;}
@Override @Override
public Object clone() { public SrndQuery clone() {
try { try {
return super.clone(); return (SrndQuery)super.clone();
} catch (CloneNotSupportedException cns) { } catch (CloneNotSupportedException cns) {
throw new Error(cns); throw new Error(cns);
} }

View File

@ -401,7 +401,7 @@ public class DateField extends PrimitiveFieldType {
} }
@Override @Override
public Object clone() { public DateFormat clone() {
ISO8601CanonicalDateFormat c ISO8601CanonicalDateFormat c
= (ISO8601CanonicalDateFormat) super.clone(); = (ISO8601CanonicalDateFormat) super.clone();
c.millisParser = NumberFormat.getIntegerInstance(CANONICAL_LOCALE); c.millisParser = NumberFormat.getIntegerInstance(CANONICAL_LOCALE);

View File

@ -69,7 +69,7 @@ public class WrappedQuery extends ExtendedQueryBase {
} }
@Override @Override
public Object clone() { public WrappedQuery clone() {
WrappedQuery newQ = (WrappedQuery)super.clone(); WrappedQuery newQ = (WrappedQuery)super.clone();
newQ.q = (Query) q.clone(); newQ.q = (Query) q.clone();
return newQ; return newQ;