From 05fe1689614a86ee4e0d59367d07240d5719e96b Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Wed, 28 Mar 2012 22:22:25 +0000 Subject: [PATCH] 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 --- lucene/CHANGES.txt | 2 ++ .../java/org/apache/lucene/store/NativeUnixDirectory.java | 2 +- .../src/java/org/apache/lucene/store/WindowsDirectory.java | 2 +- lucene/core/src/java/org/apache/lucene/analysis/Token.java | 2 +- .../analysis/tokenattributes/CharTermAttributeImpl.java | 2 +- .../analysis/tokenattributes/PayloadAttributeImpl.java | 2 +- .../src/java/org/apache/lucene/codecs/BlockTermsReader.java | 2 +- .../lucene/codecs/intblock/FixedIntBlockIndexInput.java | 2 +- .../lucene/codecs/intblock/VariableIntBlockIndexInput.java | 2 +- .../org/apache/lucene/codecs/lucene3x/SegmentTermEnum.java | 2 +- .../java/org/apache/lucene/codecs/lucene3x/TermBuffer.java | 2 +- .../org/apache/lucene/codecs/lucene3x/TermInfosReader.java | 2 +- .../lucene/codecs/lucene40/Lucene40PostingsReader.java | 2 +- .../apache/lucene/codecs/pulsing/PulsingPostingsReader.java | 2 +- .../java/org/apache/lucene/codecs/sep/IntIndexInput.java | 2 +- .../org/apache/lucene/codecs/sep/SepPostingsReader.java | 2 +- lucene/core/src/java/org/apache/lucene/index/FieldInfo.java | 2 +- .../core/src/java/org/apache/lucene/index/FieldInfos.java | 2 +- .../src/java/org/apache/lucene/index/IndexWriterConfig.java | 4 ++-- lucene/core/src/java/org/apache/lucene/index/Payload.java | 2 +- .../core/src/java/org/apache/lucene/index/SegmentInfo.java | 2 +- .../core/src/java/org/apache/lucene/index/SegmentInfos.java | 2 +- lucene/core/src/java/org/apache/lucene/index/TermState.java | 4 ++-- .../src/java/org/apache/lucene/search/BooleanQuery.java | 4 ++-- .../java/org/apache/lucene/search/DisjunctionMaxQuery.java | 4 ++-- lucene/core/src/java/org/apache/lucene/search/Query.java | 4 ++-- .../org/apache/lucene/search/payloads/PayloadNearQuery.java | 2 +- .../java/org/apache/lucene/search/spans/SpanFirstQuery.java | 2 +- .../lucene/search/spans/SpanNearPayloadCheckQuery.java | 2 +- .../java/org/apache/lucene/search/spans/SpanNearQuery.java | 4 ++-- .../java/org/apache/lucene/search/spans/SpanNotQuery.java | 6 +++--- .../java/org/apache/lucene/search/spans/SpanOrQuery.java | 4 ++-- .../apache/lucene/search/spans/SpanPayloadCheckQuery.java | 2 +- .../apache/lucene/search/spans/SpanPositionRangeQuery.java | 2 +- .../java/org/apache/lucene/store/BufferedIndexInput.java | 2 +- lucene/core/src/java/org/apache/lucene/store/DataInput.java | 2 +- lucene/core/src/java/org/apache/lucene/store/Directory.java | 2 +- .../src/java/org/apache/lucene/store/MMapDirectory.java | 2 +- .../src/java/org/apache/lucene/store/SimpleFSDirectory.java | 2 +- .../core/src/java/org/apache/lucene/util/AttributeImpl.java | 6 +++--- .../src/java/org/apache/lucene/util/AttributeSource.java | 6 +++--- .../java/org/apache/lucene/util/DoubleBarrelLRUCache.java | 2 +- .../core/src/java/org/apache/lucene/util/FixedBitSet.java | 2 +- lucene/core/src/java/org/apache/lucene/util/OpenBitSet.java | 2 +- lucene/core/src/java/org/apache/lucene/util/PagedBytes.java | 2 +- .../core/src/test/org/apache/lucene/index/Test2BTerms.java | 2 +- .../src/test/org/apache/lucene/index/TestFieldsReader.java | 2 +- .../test/org/apache/lucene/index/TestLazyProxSkipping.java | 2 +- .../org/apache/lucene/index/TestMultiLevelSkipList.java | 2 +- .../org/apache/lucene/util/TestDoubleBarrelLRUCache.java | 4 ++-- .../lucene/codecs/mocksep/MockSingleIntIndexInput.java | 2 +- .../java/org/apache/lucene/store/MockIndexInputWrapper.java | 2 +- .../lucene/analysis/compound/hyphenation/CharVector.java | 2 +- .../lucene/analysis/compound/hyphenation/TernaryTree.java | 4 ++-- .../org/apache/lucene/analysis/util/CharArrayIterator.java | 4 ++-- .../lucene/analysis/icu/segmentation/CharArrayIterator.java | 2 +- .../lucene/analysis/icu/segmentation/LaoBreakIterator.java | 2 +- .../morfologik/MorphosyntacticTagAttributeImpl.java | 2 +- .../org/apache/lucene/benchmark/byTask/stats/TaskStats.java | 2 +- .../org/apache/lucene/benchmark/byTask/tasks/PerfTask.java | 4 ++-- .../apache/lucene/benchmark/byTask/tasks/TaskSequence.java | 2 +- .../facet/index/attributes/CategoryAttributeImpl.java | 2 +- .../org/apache/lucene/facet/search/params/FacetRequest.java | 4 ++-- .../java/org/apache/lucene/facet/taxonomy/CategoryPath.java | 2 +- .../src/test/org/apache/lucene/util/SlowRAMDirectory.java | 2 +- .../apache/lucene/search/join/ToChildBlockJoinQuery.java | 2 +- .../apache/lucene/search/join/ToParentBlockJoinQuery.java | 2 +- .../java/org/apache/lucene/queries/CustomScoreQuery.java | 2 +- .../queryparser/flexible/core/nodes/QueryNodeImpl.java | 2 +- .../lucene/queryparser/surround/query/RewriteQuery.java | 2 +- .../apache/lucene/queryparser/surround/query/SrndQuery.java | 4 ++-- solr/core/src/java/org/apache/solr/schema/DateField.java | 2 +- solr/core/src/java/org/apache/solr/search/WrappedQuery.java | 2 +- 73 files changed, 93 insertions(+), 91 deletions(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index a3a4d60514e..ea87e02b521 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -257,6 +257,8 @@ Changes in backwards compatibility policy you can use SlowCompositeReaderWrapper to make all parallel readers atomic and use ParallelAtomicReader. (Uwe Schindler, Mike McCandless, Robert Muir) +* LUCENE-2000: clone() now returns covariant types where possible. (ryan) + Changes in Runtime Behavior * LUCENE-2846: omitNorms now behaves like omitTermFrequencyAndPositions, if you diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/store/NativeUnixDirectory.java b/lucene/contrib/misc/src/java/org/apache/lucene/store/NativeUnixDirectory.java index 926a87a0394..dba87965a1d 100644 --- a/lucene/contrib/misc/src/java/org/apache/lucene/store/NativeUnixDirectory.java +++ b/lucene/contrib/misc/src/java/org/apache/lucene/store/NativeUnixDirectory.java @@ -424,7 +424,7 @@ public class NativeUnixDirectory extends FSDirectory { } @Override - public Object clone() { + public NativeUnixIndexInput clone() { try { return new NativeUnixIndexInput(this); } catch (IOException ioe) { diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java b/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java index 36a25f0df2d..2b78ed1a6e7 100644 --- a/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java +++ b/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java @@ -120,7 +120,7 @@ public class WindowsDirectory extends FSDirectory { } @Override - public Object clone() { + public WindowsIndexInput clone() { WindowsIndexInput clone = (WindowsIndexInput)super.clone(); clone.isClone = true; return clone; diff --git a/lucene/core/src/java/org/apache/lucene/analysis/Token.java b/lucene/core/src/java/org/apache/lucene/analysis/Token.java index 80c31ec4189..5daa4b342ef 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/Token.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/Token.java @@ -366,7 +366,7 @@ public class Token extends CharTermAttributeImpl } @Override - public Object clone() { + public Token clone() { Token t = (Token)super.clone(); // Do a deep clone if (payload != null) { diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java index f7bb38e375e..a293f1d3052 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java @@ -208,7 +208,7 @@ public class CharTermAttributeImpl extends AttributeImpl implements CharTermAttr } @Override - public Object clone() { + public CharTermAttributeImpl clone() { CharTermAttributeImpl t = (CharTermAttributeImpl)super.clone(); // Do a deep clone t.termBuffer = new char[this.termLength]; diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java index 22e5903e2af..fd742ae6291 100644 --- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java @@ -58,7 +58,7 @@ public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttrib } @Override - public Object clone() { + public PayloadAttributeImpl clone() { PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone(); if (payload != null) { clone.payload = (Payload) payload.clone(); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/BlockTermsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/BlockTermsReader.java index 72be59cca46..484557e3511 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/BlockTermsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/BlockTermsReader.java @@ -95,7 +95,7 @@ public class BlockTermsReader extends FieldsProducer { } @Override - public Object clone() { + public FieldAndTerm clone() { return new FieldAndTerm(this); } diff --git a/lucene/core/src/java/org/apache/lucene/codecs/intblock/FixedIntBlockIndexInput.java b/lucene/core/src/java/org/apache/lucene/codecs/intblock/FixedIntBlockIndexInput.java index de3c3fc37f0..1760ec59f71 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/intblock/FixedIntBlockIndexInput.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/intblock/FixedIntBlockIndexInput.java @@ -181,7 +181,7 @@ public abstract class FixedIntBlockIndexInput extends IntIndexInput { } @Override - public Object clone() { + public Index clone() { Index other = new Index(); other.fp = fp; other.upto = upto; diff --git a/lucene/core/src/java/org/apache/lucene/codecs/intblock/VariableIntBlockIndexInput.java b/lucene/core/src/java/org/apache/lucene/codecs/intblock/VariableIntBlockIndexInput.java index 28a2e22d5f9..de972a88384 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/intblock/VariableIntBlockIndexInput.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/intblock/VariableIntBlockIndexInput.java @@ -207,7 +207,7 @@ public abstract class VariableIntBlockIndexInput extends IntIndexInput { } @Override - public Object clone() { + public Index clone() { Index other = new Index(); other.fp = fp; other.upto = upto; diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/SegmentTermEnum.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/SegmentTermEnum.java index e8636fd1223..7bd5e1ea3f9 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/SegmentTermEnum.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/SegmentTermEnum.java @@ -100,7 +100,7 @@ final class SegmentTermEnum implements Cloneable { } @Override - protected Object clone() { + protected SegmentTermEnum clone() { SegmentTermEnum clone = null; try { clone = (SegmentTermEnum) super.clone(); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/TermBuffer.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/TermBuffer.java index 1ea4bc55cff..6ce28874b33 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/TermBuffer.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/TermBuffer.java @@ -111,7 +111,7 @@ final class TermBuffer implements Cloneable { } @Override - protected Object clone() { + protected TermBuffer clone() { TermBuffer clone = null; try { clone = (TermBuffer)super.clone(); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/TermInfosReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/TermInfosReader.java index e8623672a42..fd63c7fb290 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/TermInfosReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene3x/TermInfosReader.java @@ -82,7 +82,7 @@ final class TermInfosReader { } @Override - public Object clone() { + public CloneableTerm clone() { return new CloneableTerm(term); } } diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsReader.java index ad054f0578f..2af3226bb2f 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40PostingsReader.java @@ -105,7 +105,7 @@ public class Lucene40PostingsReader extends PostingsReaderBase { byte[] bytes; @Override - public Object clone() { + public StandardTermState clone() { StandardTermState other = new StandardTermState(); other.copyFrom(this); return other; diff --git a/lucene/core/src/java/org/apache/lucene/codecs/pulsing/PulsingPostingsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/pulsing/PulsingPostingsReader.java index 3a9c947f293..49ebb98ef2d 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/pulsing/PulsingPostingsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/pulsing/PulsingPostingsReader.java @@ -73,7 +73,7 @@ public class PulsingPostingsReader extends PostingsReaderBase { private byte[] inlinedBytes; @Override - public Object clone() { + public PulsingTermState clone() { PulsingTermState clone; clone = (PulsingTermState) super.clone(); if (postingsSize != -1) { diff --git a/lucene/core/src/java/org/apache/lucene/codecs/sep/IntIndexInput.java b/lucene/core/src/java/org/apache/lucene/codecs/sep/IntIndexInput.java index 6caa1ccebda..3f417f201b8 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/sep/IntIndexInput.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/sep/IntIndexInput.java @@ -47,7 +47,7 @@ public abstract class IntIndexInput implements Closeable { public abstract void set(Index other); @Override - public abstract Object clone(); + public abstract Index clone(); } public abstract static class Reader { diff --git a/lucene/core/src/java/org/apache/lucene/codecs/sep/SepPostingsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/sep/SepPostingsReader.java index 1259a9117e9..39a8d81bb81 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/sep/SepPostingsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/sep/SepPostingsReader.java @@ -161,7 +161,7 @@ public class SepPostingsReader extends PostingsReaderBase { ByteArrayDataInput bytesReader; @Override - public Object clone() { + public SepTermState clone() { SepTermState other = new SepTermState(); other.copyFrom(this); return other; diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java index 09a74763474..2e4618b8a6d 100644 --- a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java +++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java @@ -87,7 +87,7 @@ public final class FieldInfo { } @Override - public Object clone() { + public FieldInfo clone() { return new FieldInfo(name, isIndexed, number, storeTermVector, omitNorms, storePayloads, indexOptions, docValueType, normType); } diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java index 3bfeea690a4..37268f4218e 100644 --- a/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java +++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java @@ -163,7 +163,7 @@ public final class FieldInfos implements Iterable { * Returns a deep clone of this FieldInfos instance. */ @Override - synchronized public Object clone() { + synchronized public FieldInfos clone() { FieldInfos fis = new FieldInfos(globalFieldNumbers); fis.hasFreq = hasFreq; fis.hasProx = hasProx; diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java index 6adaebe1474..7483926fcde 100644 --- a/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java +++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java @@ -185,11 +185,11 @@ public final class IndexWriterConfig implements Cloneable { } @Override - public Object clone() { + public IndexWriterConfig clone() { // Shallow clone is the only thing that's possible, since parameters like // analyzer, index commit etc. do not implement Cloneable. try { - return super.clone(); + return (IndexWriterConfig)super.clone(); } catch (CloneNotSupportedException e) { // should not happen throw new RuntimeException(e); diff --git a/lucene/core/src/java/org/apache/lucene/index/Payload.java b/lucene/core/src/java/org/apache/lucene/index/Payload.java index 34b91a18630..ec8b8c4ee45 100644 --- a/lucene/core/src/java/org/apache/lucene/index/Payload.java +++ b/lucene/core/src/java/org/apache/lucene/index/Payload.java @@ -155,7 +155,7 @@ public class Payload implements Cloneable { * byte array. */ @Override - public Object clone() { + public Payload clone() { try { // Start with a shallow copy of data Payload clone = (Payload) super.clone(); diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java b/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java index 9acfba2667d..3ab59f98323 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java @@ -252,7 +252,7 @@ public final class SegmentInfo implements Cloneable { } @Override - public Object clone() { + public SegmentInfo clone() { final SegmentInfo si = new SegmentInfo(name, docCount, dir, isCompoundFile, codec, fieldInfos == null ? null : (FieldInfos) fieldInfos.clone()); si.docStoreOffset = docStoreOffset; diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java index 3c89b7ca1c7..53b190d3755 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java @@ -374,7 +374,7 @@ public final class SegmentInfos implements Cloneable, Iterable { */ @Override - public Object clone() { + public SegmentInfos clone() { try { final SegmentInfos sis = (SegmentInfos) super.clone(); // deep clone, first recreate all collections: diff --git a/lucene/core/src/java/org/apache/lucene/index/TermState.java b/lucene/core/src/java/org/apache/lucene/index/TermState.java index a45f17cb73f..9355d67e47e 100644 --- a/lucene/core/src/java/org/apache/lucene/index/TermState.java +++ b/lucene/core/src/java/org/apache/lucene/index/TermState.java @@ -36,9 +36,9 @@ public abstract class TermState implements Cloneable { public abstract void copyFrom(TermState other); @Override - public Object clone() { + public TermState clone() { try { - return super.clone(); + return (TermState)super.clone(); } catch (CloneNotSupportedException cnse) { // should not happen throw new RuntimeException(cnse); diff --git a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java index 531794919c8..b3547ef6cbe 100644 --- a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java @@ -454,7 +454,7 @@ public class BooleanQuery extends Query implements Iterable { // The BooleanQuery clone is lazily initialized so only initialize // 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 - clone = (BooleanQuery)this.clone(); + clone = this.clone(); } clone.clauses.set(i, new BooleanClause(query, c.getOccur())); } @@ -474,7 +474,7 @@ public class BooleanQuery extends Query implements Iterable { } @Override @SuppressWarnings("unchecked") - public Object clone() { + public BooleanQuery clone() { BooleanQuery clone = (BooleanQuery)super.clone(); clone.clauses = (ArrayList) this.clauses.clone(); return clone; diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java index bc02e34261c..16b7b5dd5f4 100644 --- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java @@ -200,7 +200,7 @@ public class DisjunctionMaxQuery extends Query implements Iterable { Query clause = disjuncts.get(i); Query rewrite = clause.rewrite(reader); if (rewrite != clause) { - if (clone == null) clone = (DisjunctionMaxQuery)this.clone(); + if (clone == null) clone = this.clone(); clone.disjuncts.set(i, rewrite); } } @@ -211,7 +211,7 @@ public class DisjunctionMaxQuery extends Query implements Iterable { /** Create a shallow copy of us -- used in rewriting if necessary * @return a copy of us (but reuse, don't copy, our subqueries) */ @Override @SuppressWarnings("unchecked") - public Object clone() { + public DisjunctionMaxQuery clone() { DisjunctionMaxQuery clone = (DisjunctionMaxQuery)super.clone(); clone.disjuncts = (ArrayList) this.disjuncts.clone(); return clone; diff --git a/lucene/core/src/java/org/apache/lucene/search/Query.java b/lucene/core/src/java/org/apache/lucene/search/Query.java index 0bf05ecd705..1494963e4c1 100644 --- a/lucene/core/src/java/org/apache/lucene/search/Query.java +++ b/lucene/core/src/java/org/apache/lucene/search/Query.java @@ -97,9 +97,9 @@ public abstract class Query implements Cloneable { /** Returns a clone of this query. */ @Override - public Object clone() { + public Query clone() { try { - return super.clone(); + return (Query)super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException("Clone not supported: " + e.getMessage()); } diff --git a/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java b/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java index beb1c4ab4c4..f892d5f0cd2 100644 --- a/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java @@ -76,7 +76,7 @@ public class PayloadNearQuery extends SpanNearQuery { } @Override - public Object clone() { + public PayloadNearQuery clone() { int sz = clauses.size(); SpanQuery[] newClauses = new SpanQuery[sz]; diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanFirstQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanFirstQuery.java index b90f08eddad..01e582cb025 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanFirstQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanFirstQuery.java @@ -61,7 +61,7 @@ public class SpanFirstQuery extends SpanPositionRangeQuery { } @Override - public Object clone() { + public SpanFirstQuery clone() { SpanFirstQuery spanFirstQuery = new SpanFirstQuery((SpanQuery) match.clone(), end); spanFirstQuery.setBoost(getBoost()); return spanFirstQuery; diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.java index 2b17f627327..4ec8882f9d3 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.java @@ -88,7 +88,7 @@ public class SpanNearPayloadCheckQuery extends SpanPositionCheckQuery { } @Override - public Object clone() { + public SpanNearPayloadCheckQuery clone() { SpanNearPayloadCheckQuery result = new SpanNearPayloadCheckQuery((SpanNearQuery) match.clone(), payloadToMatch); result.setBoost(getBoost()); return result; diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearQuery.java index 3193706dab7..43d40bafd17 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearQuery.java @@ -140,7 +140,7 @@ public class SpanNearQuery extends SpanQuery implements Cloneable { SpanQuery query = (SpanQuery) c.rewrite(reader); if (query != c) { // clause rewrote: must clone if (clone == null) - clone = (SpanNearQuery) this.clone(); + clone = this.clone(); clone.clauses.set(i,query); } } @@ -152,7 +152,7 @@ public class SpanNearQuery extends SpanQuery implements Cloneable { } @Override - public Object clone() { + public SpanNearQuery clone() { int sz = clauses.size(); SpanQuery[] newClauses = new SpanQuery[sz]; diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanNotQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanNotQuery.java index 3c8e65a7aab..f1396b3f3a3 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanNotQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanNotQuery.java @@ -71,7 +71,7 @@ public class SpanNotQuery extends SpanQuery implements Cloneable { } @Override - public Object clone() { + public SpanNotQuery clone() { SpanNotQuery spanNotQuery = new SpanNotQuery((SpanQuery)include.clone(),(SpanQuery) exclude.clone()); spanNotQuery.setBoost(getBoost()); return spanNotQuery; @@ -175,12 +175,12 @@ public class SpanNotQuery extends SpanQuery implements Cloneable { SpanQuery rewrittenInclude = (SpanQuery) include.rewrite(reader); if (rewrittenInclude != include) { - clone = (SpanNotQuery) this.clone(); + clone = this.clone(); clone.include = rewrittenInclude; } SpanQuery rewrittenExclude = (SpanQuery) exclude.rewrite(reader); if (rewrittenExclude != exclude) { - if (clone == null) clone = (SpanNotQuery) this.clone(); + if (clone == null) clone = this.clone(); clone.exclude = rewrittenExclude; } diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanOrQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanOrQuery.java index 7c679dc3d1b..fc8a130f5d2 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanOrQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanOrQuery.java @@ -76,7 +76,7 @@ public class SpanOrQuery extends SpanQuery implements Cloneable { } @Override - public Object clone() { + public SpanOrQuery clone() { int sz = clauses.size(); SpanQuery[] newClauses = new SpanQuery[sz]; @@ -96,7 +96,7 @@ public class SpanOrQuery extends SpanQuery implements Cloneable { SpanQuery query = (SpanQuery) c.rewrite(reader); if (query != c) { // clause rewrote: must clone if (clone == null) - clone = (SpanOrQuery) this.clone(); + clone = this.clone(); clone.clauses.set(i,query); } } diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanPayloadCheckQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanPayloadCheckQuery.java index 086dad2f929..b7fa763ea37 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanPayloadCheckQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanPayloadCheckQuery.java @@ -90,7 +90,7 @@ public class SpanPayloadCheckQuery extends SpanPositionCheckQuery{ } @Override - public Object clone() { + public SpanPayloadCheckQuery clone() { SpanPayloadCheckQuery result = new SpanPayloadCheckQuery((SpanQuery) match.clone(), payloadToMatch); result.setBoost(getBoost()); return result; diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanPositionRangeQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanPositionRangeQuery.java index 3e023ed3592..ad9e01bf58a 100644 --- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanPositionRangeQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanPositionRangeQuery.java @@ -77,7 +77,7 @@ public class SpanPositionRangeQuery extends SpanPositionCheckQuery { } @Override - public Object clone() { + public SpanPositionRangeQuery clone() { SpanPositionRangeQuery result = new SpanPositionRangeQuery((SpanQuery) match.clone(), start, end); result.setBoost(getBoost()); return result; diff --git a/lucene/core/src/java/org/apache/lucene/store/BufferedIndexInput.java b/lucene/core/src/java/org/apache/lucene/store/BufferedIndexInput.java index f155d6e2d8c..e7fad524594 100644 --- a/lucene/core/src/java/org/apache/lucene/store/BufferedIndexInput.java +++ b/lucene/core/src/java/org/apache/lucene/store/BufferedIndexInput.java @@ -306,7 +306,7 @@ public abstract class BufferedIndexInput extends IndexInput { protected abstract void seekInternal(long pos) throws IOException; @Override - public Object clone() { + public BufferedIndexInput clone() { BufferedIndexInput clone = (BufferedIndexInput)super.clone(); clone.buffer = null; diff --git a/lucene/core/src/java/org/apache/lucene/store/DataInput.java b/lucene/core/src/java/org/apache/lucene/store/DataInput.java index 788f487a5ce..4ee6ddfcd52 100644 --- a/lucene/core/src/java/org/apache/lucene/store/DataInput.java +++ b/lucene/core/src/java/org/apache/lucene/store/DataInput.java @@ -184,7 +184,7 @@ public abstract class DataInput implements Cloneable { * were cloned from. */ @Override - public Object clone() { + public DataInput clone() { DataInput clone = null; try { clone = (DataInput)super.clone(); diff --git a/lucene/core/src/java/org/apache/lucene/store/Directory.java b/lucene/core/src/java/org/apache/lucene/store/Directory.java index 350b0044335..f3668c09eba 100644 --- a/lucene/core/src/java/org/apache/lucene/store/Directory.java +++ b/lucene/core/src/java/org/apache/lucene/store/Directory.java @@ -284,7 +284,7 @@ public abstract class Directory implements Closeable { } @Override - public Object clone() { + public SlicedIndexInput clone() { SlicedIndexInput clone = (SlicedIndexInput)super.clone(); clone.base = (IndexInput)base.clone(); clone.fileOffset = fileOffset; diff --git a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java index e5ff1e0c231..f985b9062f2 100644 --- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java +++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java @@ -412,7 +412,7 @@ public class MMapDirectory extends FSDirectory { } @Override - public Object clone() { + public MMapIndexInput clone() { if (buffers == null) { throw new AlreadyClosedException("MMapIndexInput already closed: " + this); } diff --git a/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java b/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java index f256d29f365..bc58798a0ce 100644 --- a/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java +++ b/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java @@ -193,7 +193,7 @@ public class SimpleFSDirectory extends FSDirectory { } @Override - public Object clone() { + public SimpleFSIndexInput clone() { SimpleFSIndexInput clone = (SimpleFSIndexInput)super.clone(); clone.isClone = true; return clone; diff --git a/lucene/core/src/java/org/apache/lucene/util/AttributeImpl.java b/lucene/core/src/java/org/apache/lucene/util/AttributeImpl.java index 7d713358204..85c66fa8165 100644 --- a/lucene/core/src/java/org/apache/lucene/util/AttributeImpl.java +++ b/lucene/core/src/java/org/apache/lucene/util/AttributeImpl.java @@ -123,10 +123,10 @@ public abstract class AttributeImpl implements Cloneable, Attribute { * need to clone any members deeply, */ @Override - public Object clone() { - Object clone = null; + public AttributeImpl clone() { + AttributeImpl clone = null; try { - clone = super.clone(); + clone = (AttributeImpl)super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); // shouldn't happen } diff --git a/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java b/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java index 805616b21ef..5cb808d4b44 100644 --- a/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java +++ b/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java @@ -101,12 +101,12 @@ public class AttributeSource { State next; @Override - public Object clone() { + public State clone() { State clone = new State(); - clone.attribute = (AttributeImpl) attribute.clone(); + clone.attribute = attribute.clone(); if (next != null) { - clone.next = (State) next.clone(); + clone.next = next.clone(); } return clone; diff --git a/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java b/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java index 5648983cd4d..d1c06f0a089 100644 --- a/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java +++ b/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java @@ -47,7 +47,7 @@ final public class DoubleBarrelLRUCache cache1; diff --git a/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java b/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java index 103da990320..10ee140db63 100644 --- a/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java +++ b/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java @@ -389,7 +389,7 @@ public final class FixedBitSet extends DocIdSet implements Bits { } @Override - public Object clone() { + public FixedBitSet clone() { return new FixedBitSet(this); } diff --git a/lucene/core/src/java/org/apache/lucene/util/OpenBitSet.java b/lucene/core/src/java/org/apache/lucene/util/OpenBitSet.java index ff7acf582c5..dae9bd11548 100644 --- a/lucene/core/src/java/org/apache/lucene/util/OpenBitSet.java +++ b/lucene/core/src/java/org/apache/lucene/util/OpenBitSet.java @@ -731,7 +731,7 @@ public class OpenBitSet extends DocIdSet implements Bits, Cloneable { } @Override - public Object clone() { + public OpenBitSet clone() { try { OpenBitSet obs = (OpenBitSet)super.clone(); obs.bits = obs.bits.clone(); // hopefully an array clone is as fast(er) than arraycopy diff --git a/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java b/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java index 02c0401b7f9..0cd08fef1e8 100644 --- a/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java +++ b/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java @@ -415,7 +415,7 @@ public final class PagedBytes { } @Override - public Object clone() { + public PagedBytesDataInput clone() { PagedBytesDataInput clone = getDataInput(); clone.setPosition(getPosition()); return clone; diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java b/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java index 1af4a013c22..692252a228d 100644 --- a/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java +++ b/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java @@ -117,7 +117,7 @@ public class Test2BTerms extends LuceneTestCase { } @Override - public Object clone() { + public MyTermAttributeImpl clone() { throw new UnsupportedOperationException(); } } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java b/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java index af66f9da928..861da45c525 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java @@ -183,7 +183,7 @@ public class TestFieldsReader extends LuceneTestCase { delegate.close(); } @Override - public Object clone() { + public FaultyIndexInput clone() { return new FaultyIndexInput((IndexInput) delegate.clone()); } } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestLazyProxSkipping.java b/lucene/core/src/test/org/apache/lucene/index/TestLazyProxSkipping.java index fdb47e9b3ef..9928287a1c5 100755 --- a/lucene/core/src/test/org/apache/lucene/index/TestLazyProxSkipping.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestLazyProxSkipping.java @@ -225,7 +225,7 @@ public class TestLazyProxSkipping extends LuceneTestCase { } @Override - public Object clone() { + public SeeksCountingStream clone() { return new SeeksCountingStream((IndexInput) this.input.clone()); } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java b/lucene/core/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java index 82e19f3f287..9d94e37afa7 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java @@ -190,7 +190,7 @@ public class TestMultiLevelSkipList extends LuceneTestCase { } @Override - public Object clone() { + public CountingStream clone() { return new CountingStream((IndexInput) this.input.clone()); } diff --git a/lucene/core/src/test/org/apache/lucene/util/TestDoubleBarrelLRUCache.java b/lucene/core/src/test/org/apache/lucene/util/TestDoubleBarrelLRUCache.java index 952c218de3f..b84ecf55719 100644 --- a/lucene/core/src/test/org/apache/lucene/util/TestDoubleBarrelLRUCache.java +++ b/lucene/core/src/test/org/apache/lucene/util/TestDoubleBarrelLRUCache.java @@ -156,7 +156,7 @@ public class TestDoubleBarrelLRUCache extends LuceneTestCase { } @Override - public Object clone() { + public CloneableObject clone() { return new CloneableObject(value); } } @@ -179,7 +179,7 @@ public class TestDoubleBarrelLRUCache extends LuceneTestCase { } @Override - public Object clone() { + public CloneableInteger clone() { return new CloneableInteger(value); } } diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSingleIntIndexInput.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSingleIntIndexInput.java index 5d9297166d6..d9dfaa284b3 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSingleIntIndexInput.java +++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/mocksep/MockSingleIntIndexInput.java @@ -99,7 +99,7 @@ public class MockSingleIntIndexInput extends IntIndexInput { } @Override - public Object clone() { + public Index clone() { Index other = new Index(); other.fp = fp; return other; diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexInputWrapper.java b/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexInputWrapper.java index 70bcdd4909c..f175330f1e9 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexInputWrapper.java +++ b/lucene/test-framework/src/java/org/apache/lucene/store/MockIndexInputWrapper.java @@ -65,7 +65,7 @@ public class MockIndexInputWrapper extends IndexInput { } @Override - public Object clone() { + public MockIndexInputWrapper clone() { ensureOpen(); dir.inputCloneCount.incrementAndGet(); IndexInput iiclone = (IndexInput) delegate.clone(); diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/CharVector.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/CharVector.java index 15a7aae7d10..fa277550b50 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/CharVector.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/CharVector.java @@ -80,7 +80,7 @@ public class CharVector implements Cloneable { } @Override - public Object clone() { + public CharVector clone() { CharVector cv = new CharVector(array.clone(), blockSize); cv.n = this.n; return cv; diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/TernaryTree.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/TernaryTree.java index 178fcb44eee..ae3bf2723e3 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/TernaryTree.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/TernaryTree.java @@ -348,7 +348,7 @@ public class TernaryTree implements Cloneable { } @Override - public Object clone() { + public TernaryTree clone() { TernaryTree t = new TernaryTree(); t.lo = this.lo.clone(); t.hi = this.hi.clone(); @@ -484,7 +484,7 @@ public class TernaryTree implements Cloneable { } @Override - public Object clone() { + public Item clone() { return new Item(parent, child); } diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/util/CharArrayIterator.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/util/CharArrayIterator.java index d182e16ee97..91a30cf1c69 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/util/CharArrayIterator.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/util/CharArrayIterator.java @@ -113,9 +113,9 @@ public abstract class CharArrayIterator implements CharacterIterator { } @Override - public Object clone() { + public CharArrayIterator clone() { try { - return super.clone(); + return (CharArrayIterator)super.clone(); } catch (CloneNotSupportedException e) { // CharacterIterator does not allow you to throw CloneNotSupported throw new RuntimeException(e); diff --git a/modules/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/CharArrayIterator.java b/modules/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/CharArrayIterator.java index be25dd0eb5c..f50f633dc0c 100644 --- a/modules/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/CharArrayIterator.java +++ b/modules/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/CharArrayIterator.java @@ -109,7 +109,7 @@ final class CharArrayIterator implements CharacterIterator { } @Override - public Object clone() { + public CharArrayIterator clone() { CharArrayIterator clone = new CharArrayIterator(); clone.setText(array, start, length); clone.index = index; diff --git a/modules/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/LaoBreakIterator.java b/modules/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/LaoBreakIterator.java index ffd4c337fd3..bf38bfa40a6 100644 --- a/modules/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/LaoBreakIterator.java +++ b/modules/analysis/icu/src/java/org/apache/lucene/analysis/icu/segmentation/LaoBreakIterator.java @@ -211,7 +211,7 @@ public class LaoBreakIterator extends BreakIterator { * @return The clone. */ @Override - public Object clone() { + public LaoBreakIterator clone() { LaoBreakIterator other = (LaoBreakIterator) super.clone(); other.rules = (RuleBasedBreakIterator) rules.clone(); other.verify = (RuleBasedBreakIterator) verify.clone(); diff --git a/modules/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagAttributeImpl.java b/modules/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagAttributeImpl.java index 11ff3d5fd36..45fce769ae9 100644 --- a/modules/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagAttributeImpl.java +++ b/modules/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagAttributeImpl.java @@ -83,7 +83,7 @@ public class MorphosyntacticTagAttributeImpl extends AttributeImpl ((MorphosyntacticTagAttribute) target).setTag(this.tag); } - public Object clone() { + public MorphosyntacticTagAttributeImpl clone() { MorphosyntacticTagAttributeImpl cloned = new MorphosyntacticTagAttributeImpl(); cloned.tag = (tag == null ? null : tag.toString()); return cloned; diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java index 6924670f905..627fc830a4c 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/stats/TaskStats.java @@ -208,7 +208,7 @@ public class TaskStats implements Cloneable { * @see java.lang.Object#clone() */ @Override - public Object clone() throws CloneNotSupportedException { + public TaskStats clone() throws CloneNotSupportedException { TaskStats c = (TaskStats) super.clone(); if (c.countsByTime != null) { c.countsByTime = c.countsByTime.clone(); diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java index 297c0a2d4c6..c985d6a4960 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/PerfTask.java @@ -111,10 +111,10 @@ public abstract class PerfTask implements Cloneable { } @Override - protected Object clone() throws CloneNotSupportedException { + protected PerfTask clone() throws CloneNotSupportedException { // tasks having non primitive data structures should override this. // otherwise parallel running of a task sequence might not run correctly. - return super.clone(); + return (PerfTask)super.clone(); } public void close() throws Exception { diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java index 6e3b6879a72..36da1b9b66e 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java @@ -508,7 +508,7 @@ public class TaskSequence extends PerfTask { * @see java.lang.Object#clone() */ @Override - protected Object clone() throws CloneNotSupportedException { + protected TaskSequence clone() throws CloneNotSupportedException { TaskSequence res = (TaskSequence) super.clone(); res.tasks = new ArrayList(); for (int i = 0; i < tasks.size(); i++) { diff --git a/modules/facet/src/java/org/apache/lucene/facet/index/attributes/CategoryAttributeImpl.java b/modules/facet/src/java/org/apache/lucene/facet/index/attributes/CategoryAttributeImpl.java index 1bfa4d95b62..0b920ea687e 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/index/attributes/CategoryAttributeImpl.java +++ b/modules/facet/src/java/org/apache/lucene/facet/index/attributes/CategoryAttributeImpl.java @@ -121,7 +121,7 @@ public final class CategoryAttributeImpl extends AttributeImpl implements @SuppressWarnings("unchecked") @Override - public CategoryAttribute clone() { + public CategoryAttributeImpl clone() { CategoryAttributeImpl ca = (CategoryAttributeImpl) super.clone(); if (categoryPath != null) { ca.categoryPath = (CategoryPath) categoryPath.clone(); diff --git a/modules/facet/src/java/org/apache/lucene/facet/search/params/FacetRequest.java b/modules/facet/src/java/org/apache/lucene/facet/search/params/FacetRequest.java index 7366c5c0a95..02a5fc34bd5 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/search/params/FacetRequest.java +++ b/modules/facet/src/java/org/apache/lucene/facet/search/params/FacetRequest.java @@ -114,9 +114,9 @@ public abstract class FacetRequest implements Cloneable { } @Override - public Object clone() throws CloneNotSupportedException { + public FacetRequest clone() throws CloneNotSupportedException { // Overridden to make it public - return super.clone(); + return (FacetRequest)super.clone(); } public void setNumLabel(int numLabel) { diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java index 389cd1f6e30..82206660f6b 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java +++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java @@ -622,7 +622,7 @@ public class CategoryPath implements Serializable, Cloneable, Comparable extends Query { /** @throws UnsupportedOperationException */ @Override - public Object clone() { + public RewriteQuery clone() { throw new UnsupportedOperationException(); } } diff --git a/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndQuery.java b/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndQuery.java index 0082ddf4508..ff02042cb16 100644 --- a/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndQuery.java +++ b/modules/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndQuery.java @@ -62,9 +62,9 @@ public abstract class SrndQuery implements Cloneable { public boolean isFieldsSubQueryAcceptable() {return true;} @Override - public Object clone() { + public SrndQuery clone() { try { - return super.clone(); + return (SrndQuery)super.clone(); } catch (CloneNotSupportedException cns) { throw new Error(cns); } diff --git a/solr/core/src/java/org/apache/solr/schema/DateField.java b/solr/core/src/java/org/apache/solr/schema/DateField.java index 4fd40bc66a1..52fa7883461 100644 --- a/solr/core/src/java/org/apache/solr/schema/DateField.java +++ b/solr/core/src/java/org/apache/solr/schema/DateField.java @@ -401,7 +401,7 @@ public class DateField extends PrimitiveFieldType { } @Override - public Object clone() { + public DateFormat clone() { ISO8601CanonicalDateFormat c = (ISO8601CanonicalDateFormat) super.clone(); c.millisParser = NumberFormat.getIntegerInstance(CANONICAL_LOCALE); diff --git a/solr/core/src/java/org/apache/solr/search/WrappedQuery.java b/solr/core/src/java/org/apache/solr/search/WrappedQuery.java index c21669739b1..ca186d195ff 100644 --- a/solr/core/src/java/org/apache/solr/search/WrappedQuery.java +++ b/solr/core/src/java/org/apache/solr/search/WrappedQuery.java @@ -69,7 +69,7 @@ public class WrappedQuery extends ExtendedQueryBase { } @Override - public Object clone() { + public WrappedQuery clone() { WrappedQuery newQ = (WrappedQuery)super.clone(); newQ.q = (Query) q.clone(); return newQ;