Skip to content

Commit

Permalink
Package-private and private classes can be final
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Feb 5, 2025
1 parent 1461db5 commit 5c82205
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix Javadoc and names in the org.apache.commons.compress.compressors.lzw package to specify kibibyte scale in memory limits.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix Javadoc and names in the org.apache.commons.compress.compressors.z package to specify kibibyte scale in memory limits.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Refactor LZ77Compressor block classes to reduce duplication.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Package-private and private classes can be final.</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add GzipParameters.getModificationInstant().</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add GzipParameters.setModificationInstant(Instant).</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public abstract class ArchiveInputStream<E extends ArchiveEntry> extends FilterI
/**
* An iterator over a collection of a specific {@link ArchiveEntry} type.
*/
class ArchiveEntryIOIterator implements IOIterator<E> {
final class ArchiveEntryIOIterator implements IOIterator<E> {

private E next;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public static Set<PERMISSION> find(final int code) {
/**
* Archive entry as stored on tape. There is one TSH for (at most) every 512k in the file.
*/
static class TapeSegmentHeader {
static final class TapeSegmentHeader {
private DumpArchiveConstants.SEGMENT_TYPE type;
private int volume;
private int ino;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
import org.tukaani.xz.X86Options;

final class Coders {
static class BCJDecoder extends AbstractCoder {

static final class BCJDecoder extends AbstractCoder {
private final FilterOptions opts;

BCJDecoder(final FilterOptions opts) {
Expand All @@ -71,7 +72,7 @@ OutputStream encode(final OutputStream out, final Object options) {
}
}

static class BZIP2Decoder extends AbstractCoder {
static final class BZIP2Decoder extends AbstractCoder {
BZIP2Decoder() {
super(Number.class);
}
Expand All @@ -89,7 +90,7 @@ OutputStream encode(final OutputStream out, final Object options) throws IOExcep
}
}

static class CopyDecoder extends AbstractCoder {
static final class CopyDecoder extends AbstractCoder {
@Override
InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength, final Coder coder, final byte[] password,
final int maxMemoryLimitKiB) throws IOException {
Expand All @@ -102,7 +103,7 @@ OutputStream encode(final OutputStream out, final Object options) {
}
}

static class Deflate64Decoder extends AbstractCoder {
static final class Deflate64Decoder extends AbstractCoder {
Deflate64Decoder() {
super(Number.class);
}
Expand All @@ -114,8 +115,9 @@ InputStream decode(final String archiveName, final InputStream in, final long un
}
}

static class DeflateDecoder extends AbstractCoder {
static class DeflateDecoderInputStream extends FilterInputStream {
static final class DeflateDecoder extends AbstractCoder {

static final class DeflateDecoderInputStream extends FilterInputStream {

Inflater inflater;

Expand All @@ -135,7 +137,7 @@ public void close() throws IOException {

}

static class DeflateDecoderOutputStream extends OutputStream {
static final class DeflateDecoderOutputStream extends OutputStream {

final DeflaterOutputStream deflaterOutputStream;
Deflater deflater;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* {@link RandomAccessOutputStream} implementation based on a file.
*/
// Keep package-private; consider for Apache Commons IO.
class FileRandomAccessOutputStream extends RandomAccessOutputStream {
final class FileRandomAccessOutputStream extends RandomAccessOutputStream {

private final FileChannel channel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* {@link RandomAccessOutputStream} implementation for SeekableByteChannel.
*/
// Keep package-private; consider for Apache Commons IO.
class SeekableChannelRandomAccessOutputStream extends RandomAccessOutputStream {
final class SeekableChannelRandomAccessOutputStream extends RandomAccessOutputStream {

private final SeekableByteChannel channel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class ZipFile implements Closeable {
* Lock-free implementation of BoundedInputStream. The implementation uses positioned reads on the underlying archive file channel and therefore performs
* significantly faster in concurrent environment.
*/
private static class BoundedFileChannelInputStream extends BoundedArchiveInputStream {
private static final class BoundedFileChannelInputStream extends BoundedArchiveInputStream {
private final FileChannel archive;

BoundedFileChannelInputStream(final long start, final long remaining, final FileChannel archive) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* IO utilities for Zip operations.
*/
// Keep package-private; consider for Apache Commons IO.
class ZipIoUtil {
final class ZipIoUtil {

/**
* Writes full buffer to channel.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public class Archive {

static class PackingFile {
static final class PackingFile {

private final String name;
private byte[] contents;
Expand Down Expand Up @@ -89,7 +89,7 @@ public String toString() {
}
}

static class SegmentUnit {
static final class SegmentUnit {

private final List<Pack200ClassReader> classList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
public class IcBands extends BandSet {

static class IcTuple implements Comparable<IcTuple> {
static final class IcTuple implements Comparable<IcTuple> {

protected CPClass C; // this class
protected int F; // flags
Expand Down

0 comments on commit 5c82205

Please sign in to comment.