Brandon Marc-Aurele created COMPRESS-634:
--------------------------------------------

             Summary: Pack200 Fails to Pack Jars with Module Declarations
                 Key: COMPRESS-634
                 URL: https://issues.apache.org/jira/browse/COMPRESS-634
             Project: Commons Compress
          Issue Type: Bug
          Components: Compressors
    Affects Versions: 1.21
            Reporter: Brandon Marc-Aurele


Using commons-compress version 1.21+ (move to native pack algorithm) fails to 
pack jars with module declarations. It fails with the following 
error/stacktrace:
{code:java}
java.lang.UnsupportedOperationException: Module requires ASM6
    at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:153)
    at org.objectweb.asm.ClassReader.readModuleAttributes(ClassReader.java:781)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:580)
    at 
org.apache.commons.compress.harmony.pack200.Segment.processClasses(Segment.java:160)
    at 
org.apache.commons.compress.harmony.pack200.Segment.pack(Segment.java:110)
    at 
org.apache.commons.compress.harmony.pack200.Archive.doNormalPack(Archive.java:128)
    at 
org.apache.commons.compress.harmony.pack200.Archive.pack(Archive.java:98) {code}
[Here|https://github.com/bmarcaur/commons-compress/commit/ff9af724d668c67b2746775711cdaed123bd42bb]
 is a minimal repro commit. I used the {{HelloWorld.java}} and added an empty 
module like:
{code:java}
module reproModule {} {code}
These are the contents of {{{}hw-module.jar{}}}.

I ran in to this issue trying to move a large internal repo from 1.20 to 1.22 
following our back and forth on COMPRESS-582.

Just as a matter of exploration I also attempted to change the ASM level 
[within 
commons-compress|https://github.com/bmarcaur/commons-compress/commit/f782c0160e10e67d6c294f69a57e06c549c8c0ef],
 but doing so caused a number of tests to fail locally due to the jars not 
being identical after a packing round trip. I am not sure the SOP for updating 
the comparison Jars or if this is indicative of an issue with the change.

To prove that increasing the ASM level allows us to pack jars with modules [I 
extended our previous repro with a new test exemplifying a 
_very_|https://github.com/AlexLandau/commons-compress-asm-error/blob/develop/src/test/java/com/github/alexlandau/commonscompressrepro/ReprosTest.java#L29]
 [ hacky 
"fix".|https://github.com/AlexLandau/commons-compress-asm-error/blob/develop/src/test/java/com/github/alexlandau/commonscompressrepro/ReprosTest.java#L29]

Let me know if there is any other context I can provide. Thank you!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to