This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 01b11245eefbb3b17132f3b11915e0b01a415da0 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Feb 27 12:41:15 2024 -0500 Use final Use compact array notation --- .../org/apache/commons/compress/archivers/sevenz/AES256Options.java | 2 +- src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java | 2 +- src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java | 2 +- .../java/org/apache/commons/compress/harmony/pack200/ClassBands.java | 2 +- .../java/org/apache/commons/compress/harmony/pack200/CodecEncoding.java | 2 +- .../org/apache/commons/compress/harmony/unpack200/SegmentHeader.java | 2 +- .../commons/compress/archivers/zip/ZipArchiveInputStreamTest.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256Options.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256Options.java index b14d7b768..ffccc98d8 100644 --- a/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256Options.java +++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/AES256Options.java @@ -33,7 +33,7 @@ import javax.crypto.spec.SecretKeySpec; */ final class AES256Options { - private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + private static final byte[] EMPTY_BYTE_ARRAY = {}; static final String ALGORITHM = "AES"; diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java b/src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java index 93daa36aa..61b97505d 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/Archive.java @@ -135,7 +135,7 @@ public class Archive { } } - private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + private static final byte[] EMPTY_BYTE_ARRAY = {}; private final JarInputStream jarInputStream; private final OutputStream outputStream; diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java b/src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java index bf04c344e..55a113d3b 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java @@ -178,7 +178,7 @@ public abstract class BandSet { } - private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + private static final byte[] EMPTY_BYTE_ARRAY = {}; // Minimum size of band for each effort level where we consider alternative codecs // Note: these values have been tuned - please test carefully if changing them diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/ClassBands.java b/src/main/java/org/apache/commons/compress/harmony/pack200/ClassBands.java index 8cf3576f1..cd0610895 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/ClassBands.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/ClassBands.java @@ -72,7 +72,7 @@ public class ClassBands extends BandSet { } } - private static final long[] EMPTY_LONG_ARRAY = new long[0]; + private static final long[] EMPTY_LONG_ARRAY = {}; protected static int countArgs(final String descriptor) { final int bra = descriptor.indexOf('('); diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/CodecEncoding.java b/src/main/java/org/apache/commons/compress/harmony/pack200/CodecEncoding.java index 236a1041b..5cf4b6622 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/CodecEncoding.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/CodecEncoding.java @@ -28,7 +28,7 @@ import java.util.Map; */ public class CodecEncoding { - private static final int[] EMPTY_INT_ARRAY = new int[0]; + private static final int[] EMPTY_INT_ARRAY = {}; /** * The canonical encodings are defined to allow a single byte to represent one of the standard encodings. The following values are defined in the Pack200 diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentHeader.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentHeader.java index a83057518..be4f185c2 100644 --- a/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentHeader.java +++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentHeader.java @@ -30,7 +30,7 @@ import org.apache.commons.compress.utils.IOUtils; */ public class SegmentHeader { - private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + private static final byte[] EMPTY_BYTE_ARRAY = {}; /** * The magic header for a Pack200 Segment is 0xCAFED00D. I wonder where they get their inspiration from ... diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java index 6e345ea92..fd20f789c 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java @@ -171,7 +171,7 @@ public class ZipArchiveInputStreamTest extends AbstractTest { @Test public void testGetFirstEntryEmptyZip() throws IOException { try (ZipArchiveInputStream zin = new ZipArchiveInputStream(new ByteArrayInputStream(ByteUtils.EMPTY_BYTE_ARRAY))) { - ZipArchiveEntry entry = zin.getNextEntry(); + final ZipArchiveEntry entry = zin.getNextEntry(); assertNull(entry); } }