LUCENE-4055: remove fieldinfos.clone()

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4055@1339807 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-05-17 19:16:27 +00:00
parent e099cb8164
commit 373dc4a2df
4 changed files with 1 additions and 36 deletions

View File

@ -25,14 +25,8 @@ import org.apache.lucene.index.FieldInfo.IndexOptions;
* Collection of {@link FieldInfo}s (accessible by number or by name).
* @lucene.experimental
*/
public abstract class FieldInfos implements Cloneable,Iterable<FieldInfo> {
public abstract class FieldInfos implements Iterable<FieldInfo> {
/**
* Returns a deep clone of this FieldInfos instance.
*/
@Override
public abstract FieldInfos clone();
/**
* Return the fieldinfo object referenced by the field name
* @return the FieldInfo object or null when the given fieldName

View File

@ -133,19 +133,6 @@ final class MutableFieldInfos extends FieldInfos {
+ " already taken";
return fieldNumber;
}
/**
* Returns a deep clone of this FieldInfos instance.
*/
@Override
synchronized public MutableFieldInfos clone() {
MutableFieldInfos fis = new MutableFieldInfos(globalFieldNumbers);
for (FieldInfo fi : this) {
FieldInfo clone = fi.clone();
fis.putInternal(clone);
}
return fis;
}
/**
* Assumes the fields are not storing term vectors.

View File

@ -112,16 +112,4 @@ public final class ReadOnlyFieldInfos extends FieldInfos {
public FieldInfo fieldInfo(int fieldNumber) {
return (fieldNumber >= 0) ? byNumber.get(fieldNumber) : null;
}
// nocommit: probably unnecessary
@Override
public ReadOnlyFieldInfos clone() {
FieldInfo infos[] = new FieldInfo[size()];
int upto = 0;
for (FieldInfo info : this) {
infos[upto++] = info.clone();
}
return new ReadOnlyFieldInfos(infos);
}
}

View File

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