Skip to content

Apache Lucene open-source search software

LUCENE-9907: Remove unused method PackedInts.Mutable#save

Ignacio Verab0662c807cb4
diff --git a/gradle/generation/moman/gen_Packed64SingleBlock.py b/gradle/generation/moman/gen_Packed64SingleBlock.py
index 65f38fda7c5..a9a53cf109b 100644
--- a/gradle/generation/moman/gen_Packed64SingleBlock.py
+++ b/gradle/generation/moman/gen_Packed64SingleBlock.py
@@ -215,12 +215,6 @@ abstract class Packed64SingleBlock extends PackedInts.MutableImpl {
}
}
- @Override
- @SuppressWarnings("deprecation")
- protected PackedInts.Format getFormat() {
- return PackedInts.Format.PACKED_SINGLE_BLOCK;
- }
-
@Override
public String toString() {
return getClass().getSimpleName() + "(bitsPerValue=" + bitsPerValue
diff --git a/lucene/core/src/generated/checksums/utilGenPacked.json b/lucene/core/src/generated/checksums/utilGenPacked.json
index 89fd56932c1..3e666db30a1 100644
--- a/lucene/core/src/generated/checksums/utilGenPacked.json
+++ b/lucene/core/src/generated/checksums/utilGenPacked.json
@@ -26,6 +26,6 @@
"lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked8.java": "bc5124047b26fc0be147db5bc855be038d306f65",
"lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPacked9.java": "1121f69ea6d830ab6f4bd2f51d017b792c17d1b1",
"lucene/core/src/java/org/apache/lucene/util/packed/BulkOperationPackedSingleBlock.java": "36984601502fcc812eb9d9a845fa10774e575653",
- "lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java": "18c97614f29045519a8d440a35c685c50a5e9a34",
+ "lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java": "2703943d7980188a3da355490e7b72918910b369",
"property:source": "https://github.com/jpbarrette/moman/archive/497c90e34e412b6494db6dabf0d95db8034bd325.zip"
}
\ No newline at end of file
diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/GrowableWriter.java b/lucene/core/src/java/org/apache/lucene/util/packed/GrowableWriter.java
index b005f423b33..8488577c84a 100644
--- a/lucene/core/src/java/org/apache/lucene/util/packed/GrowableWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/util/packed/GrowableWriter.java
@@ -16,8 +16,6 @@
*/
package org.apache.lucene.util.packed;
-import java.io.IOException;
-import org.apache.lucene.store.DataOutput;
import org.apache.lucene.util.RamUsageEstimator;
/**
@@ -135,9 +133,4 @@ public class GrowableWriter extends PackedInts.Mutable {
+ Float.BYTES)
+ current.ramBytesUsed();
}
-
- @Override
- public void save(DataOutput out) throws IOException {
- current.save(out);
- }
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java b/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
index 6fd48cf0dc5..c92b1d181a5 100644
--- a/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
+++ b/lucene/core/src/java/org/apache/lucene/util/packed/Packed64SingleBlock.java
@@ -197,12 +197,6 @@ abstract class Packed64SingleBlock extends PackedInts.MutableImpl {
}
}
- @Override
- @SuppressWarnings("deprecation")
- protected PackedInts.Format getFormat() {
- return PackedInts.Format.PACKED_SINGLE_BLOCK;
- }
-
@Override
public String toString() {
return getClass().getSimpleName()
diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java b/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
index f02deb2c947..91e8ad1357a 100644
--- a/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
+++ b/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
@@ -502,25 +502,6 @@ public class PackedInts {
public void clear() {
fill(0, size(), 0);
}
-
- /**
- * Save this mutable into <code>out</code>. This method does not write any metadata to the
- * stream, meaning that it is your responsibility to store it somewhere else in order to be able
- * to recover data from the stream later on.
- */
- public void save(DataOutput out) throws IOException {
- Writer writer =
- getWriterNoHeader(out, getFormat(), size(), getBitsPerValue(), DEFAULT_BUFFER_SIZE);
- for (int i = 0; i < size(); ++i) {
- writer.add(get(i));
- }
- writer.finish();
- }
-
- /** The underlying format. */
- Format getFormat() {
- return Format.PACKED;
- }
}
/**
diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/gen_Packed64SingleBlock.py b/lucene/core/src/java/org/apache/lucene/util/packed/gen_Packed64SingleBlock.py
index 65f38fda7c5..a9a53cf109b 100644
--- a/lucene/core/src/java/org/apache/lucene/util/packed/gen_Packed64SingleBlock.py
+++ b/lucene/core/src/java/org/apache/lucene/util/packed/gen_Packed64SingleBlock.py
@@ -215,12 +215,6 @@ abstract class Packed64SingleBlock extends PackedInts.MutableImpl {
}
}
- @Override
- @SuppressWarnings("deprecation")
- protected PackedInts.Format getFormat() {
- return PackedInts.Format.PACKED_SINGLE_BLOCK;
- }
-
@Override
public String toString() {
return getClass().getSimpleName() + "(bitsPerValue=" + bitsPerValue
diff --git a/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java b/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
index e16288daee9..2a52ec2fcd9 100644
--- a/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
+++ b/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Random;
import org.apache.lucene.store.ByteArrayDataInput;
-import org.apache.lucene.store.ByteBuffersDirectory;
import org.apache.lucene.store.DataInput;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
@@ -865,48 +864,6 @@ public class TestPackedInts extends LuceneTestCase {
}
}
- public void testSave() throws IOException {
- final int valueCount = TestUtil.nextInt(random(), 1, 2048);
- for (int bpv = 1; bpv <= 64; ++bpv) {
- final int maxValue = (int) Math.min(PackedInts.maxValue(31), PackedInts.maxValue(bpv));
- final Directory directory = new ByteBuffersDirectory();
- List<PackedInts.Mutable> packedInts = createPackedInts(valueCount, bpv);
- for (PackedInts.Mutable mutable : packedInts) {
- for (int i = 0; i < mutable.size(); ++i) {
- mutable.set(i, random().nextInt(maxValue));
- }
-
- IndexOutput out = directory.createOutput("packed-ints.bin", IOContext.DEFAULT);
- mutable.save(out);
- out.close();
-
- IndexInput in = directory.openInput("packed-ints.bin", IOContext.DEFAULT);
- PackedInts.Reader reader =
- PackedInts.getReaderNoHeader(
- in,
- mutable.getFormat(),
- PackedInts.VERSION_CURRENT,
- mutable.size(),
- mutable.getBitsPerValue());
- assertEquals(valueCount, reader.size());
- if (mutable instanceof Packed64SingleBlock) {
- // make sure that we used the right format so that the reader has
- // the same performance characteristics as the mutable that has been
- // serialized
- assertTrue(reader instanceof Packed64SingleBlock);
- } else {
- assertFalse(reader instanceof Packed64SingleBlock);
- }
- for (int i = 0; i < valueCount; ++i) {
- assertEquals(mutable.get(i), reader.get(i));
- }
- in.close();
- directory.deleteFile("packed-ints.bin");
- }
- directory.close();
- }
- }
-
public void testEncodeDecode() {
for (PackedInts.Format format : PackedInts.Format.values()) {
for (int bpv = 1; bpv <= 64; ++bpv) {