GithubHelp home page GithubHelp logo

commons-compress-asm-error's Introduction

commons-compress-asm-error

Update: Repro for commons-compress 1.22 failing with fix COMPRESS-582

(Note: This is a modified repro contributed by @bmarcaur.)

https://issues.apache.org/jira/browse/COMPRESS-582

I added an OSS jar docx4j-JAXB-ReferenceImpl-11.2.9.jar (a jar that we use internally). Attempting to pack this jar yields the following stacktrace:

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)
at org.apache.commons.compress.harmony.pack200.Pack200PackerAdapter.pack(Pack200PackerAdapter.java:58)
at org.apache.commons.compress.compressors.pack200.Pack200CompressorOutputStream.finish(Pack200CompressorOutputStream.java:136)
at org.apache.commons.compress.compressors.pack200.Pack200CompressorOutputStream.close(Pack200CompressorOutputStream.java:118)

Digging in slightly, we notice that in the fix linked in the ticket the ASM_API is being explicitly set to 4. Fortunately, this field is non-final so it allowed me to test a "fix" using the broken setup within this repo. Setting Segment.ASM_API = Opcodes.ASM7 causes the previously failing test to pass. Given that the linked ticket intentionally took an ASM 7.X+ dependency, I think we could potentially change that ASM_API to ASM7, but this is also my first time in the codebase.

Repro for commons-compress 1.21 failing with asm 4.0+

(This was fixed by the 1.22 release for the example given, but see the above issue that still affects jars using certain Java 11 language features.)

Trying to use the Pack200CompressorOutputStream with asm 4.0+ on the classpath results in the error: java.lang.IncompatibleClassChangeError: class org.apache.commons.compress.harmony.pack200.Segment can not implement org.objectweb.asm.ClassVisitor, because it is not an interface (org.objectweb.asm.ClassVisitor is in unnamed module of loader 'app')

Running ./gradlew test runs two tests reproducing the issue. The doSomePacking() test works successfully when commons-compress 1.20 is used instead of 1.21.

Per https://asm.ow2.io/versions.html, the ClassVisitor in ASM became an abstract class in 4.0 RC2 (in 2011) "in order to ensure backward binary compatibility in future ASM versions".

This was fixed by apache/commons-compress#216, which should be part of the 1.22 release. See also the ticket: https://issues.apache.org/jira/projects/COMPRESS/issues/COMPRESS-582

commons-compress-asm-error's People

Contributors

alexlandau avatar bmarcaur avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.