From f7f324a3e610021ba373e74c95beb285188ec772 Mon Sep 17 00:00:00 2001 From: clickin Date: Wed, 21 Oct 2026 11:21:09 +0900 Subject: [PATCH] [COMPRESS-634] Preserve module descriptors when packing modular JARs Pack200 cannot represent module attributes, and passing a module-info class to the ASM visitor fails with "Module requires ASM6". Treat class files with ACC_MODULE as pass files so their bytes are stored unchanged, as Segment already does for a class with an attribute whose action is "pass". PackingOptions.isPassFile() returned after checking the first directory entry, so a configured pass directory hid any pass file added after it. Keep checking the remaining entries. Generated-by: OpenAI GPT-6 Astra Assisted-By: Claude Opus 5.5 --- .../compress/harmony/pack200/Archive.java | 13 +++- .../harmony/pack200/PackingOptions.java | 4 +- .../compress/harmony/pack200/ArchiveTest.java | 72 +++++++++++++++++++ 3 files changed, 85 insertions(+), 4 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 b86dde52059..33adc4bda9e 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 @@ -29,6 +29,8 @@ import java.util.zip.GZIPOutputStream; import java.util.zip.ZipEntry; +import org.objectweb.asm.Opcodes; + /** * Main entry point to pack200 and represents a packed archive. An archive is constructed with either a {@link JarInputStream} and an output stream or a * {@link JarFile} as input and an OutputStream. Options can be set, then {@link #pack()} is called, to pack the Jar file into a pack200 archive. @@ -211,9 +213,14 @@ private boolean addJarEntry(final PackingFile packingFile, final List