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 57340b34fe144bf225658fe9ba0d1df668148b7b Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri Sep 30 11:20:18 2022 -0400 Use generics --- .../java/org/apache/commons/compress/harmony/pack200/Archive.java | 8 ++++---- .../org/apache/commons/compress/harmony/pack200/PackingUtils.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) 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 3e799c82..963e01a6 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 @@ -117,14 +117,14 @@ public class Archive { packingFileList = PackingUtils.getPackingFileListFromJar(jarFile, options.isKeepFileOrder()); } - final List segmentUnitList = splitIntoSegments(packingFileList); + final List<SegmentUnit> segmentUnitList = splitIntoSegments(packingFileList); int previousByteAmount = 0; int packedByteAmount = 0; final int segmentSize = segmentUnitList.size(); SegmentUnit segmentUnit; for (int index = 0; index < segmentSize; index++) { - segmentUnit = (SegmentUnit) segmentUnitList.get(index); + segmentUnit = segmentUnitList.get(index); new Segment().pack(segmentUnit, outputStream, options); previousByteAmount += segmentUnit.getByteAmount(); packedByteAmount += segmentUnit.getPackedByteAmount(); @@ -136,8 +136,8 @@ public class Archive { outputStream.close(); } - private List splitIntoSegments(final List packingFileList) { - final List segmentUnitList = new ArrayList(); + private List<SegmentUnit> splitIntoSegments(final List packingFileList) { + final List<SegmentUnit> segmentUnitList = new ArrayList<>(); List classes = new ArrayList(); List files = new ArrayList(); final long segmentLimit = options.getSegmentLimit(); diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingUtils.java b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingUtils.java index e9ad068c..402719d8 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingUtils.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingUtils.java @@ -141,7 +141,7 @@ public class PackingUtils { jarOutputStream.close(); } - public static List getPackingFileListFromJar(final JarInputStream jarInputStream, final boolean keepFileOrder) + public static List<PackingFile> getPackingFileListFromJar(final JarInputStream jarInputStream, final boolean keepFileOrder) throws IOException { final List<PackingFile> packingFileList = new ArrayList<>(); @@ -168,14 +168,14 @@ public class PackingUtils { return packingFileList; } - public static List getPackingFileListFromJar(final JarFile jarFile, final boolean keepFileOrder) + public static List<PackingFile> getPackingFileListFromJar(final JarFile jarFile, final boolean keepFileOrder) throws IOException { final List<PackingFile> packingFileList = new ArrayList<>(); - final Enumeration jarEntries = jarFile.entries(); + final Enumeration<JarEntry> jarEntries = jarFile.entries(); JarEntry jarEntry; byte[] bytes; while (jarEntries.hasMoreElements()) { - jarEntry = (JarEntry) jarEntries.nextElement(); + jarEntry = jarEntries.nextElement(); bytes = readJarEntry(jarEntry, new BufferedInputStream(jarFile.getInputStream(jarEntry))); packingFileList.add(new PackingFile(bytes, jarEntry)); }