Title: Installer contains dependencies unshaded (Java 8)
Type: crash Severity: major
Components: Installer Versions: Jython 2.7
Milestone: Jython 2.7.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: jeff.allen
Priority: high Keywords:

Created on 2019-09-28.09:21:05 by jeff.allen, last changed 2019-11-02.10:15:14 by jeff.allen.

msg12662 (view) Author: Jeff Allen (jeff.allen) Date: 2019-09-28.09:21:05
When built with Java 8, although the developer build checks out ok, the installed version of Jython (in fact, the installation itself) fails with the message:

PS 272a-trial> java -jar kit\jython-installer.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/MapMaker
        at org.python.core.ThreadStateMapping.<clinit>(
        at org.python.core.Py.<clinit>(
        at org.python.core.PySystemState.<clinit>(
        at org.python.util.jython.main(
Caused by: java.lang.ClassNotFoundException:
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
        at java.base/java.lang.ClassLoader.loadClass(
        ... 4 more

Investigation shows that the call is there are described:

PS jython-trunk> javap -c -cp dist/jython.jar org.python.core.ThreadStateMapping
 static {};
      0: new           #40                 // class com/google/common/collect/MapMaker

The cause is in the jarjar task in our Ant build that is responsible for renaming dependencies we bundle in the JAR.

When the target JVM is 1.7, the all is well. (I'm still actually building with Oracle Java version 1.8.0_211, but = "1.7".)

PS jython-trunk> ant -D"" clean installer

(A clean is needed to force recompilation.) In this case, the same investigation shows the call has been renamed correctly:

PS 272a-trial> javap -c -cp inst/jython.jar org.python.core.ThreadStateMapping
  static {};
       0: new           #179                // class org/python/google/common/collect/MapMaker

Actually, it is only necessary to build the jython.jar (jar-complete target) to see the effect in dist/jython.jar.

I wonder if this is simply a consequence of jarjar 1.4 using an old version of ASM. However, it is not completely obvious where to get the legitimate successor version of jarjar.

Maybe we compile with 8 for this release but target 7 in the generated code?
msg12674 (view) Author: Jeff Allen (jeff.allen) Date: 2019-10-02.21:18:15
The best successor I have found to jarjar 1.4 is from Pantsbuild ( It uses ASM 7.0, although now as an external dependency, and it appears to do the trick.

Clearly no British people were involved in the naming of this project, or the team are extremely self-deprecating.
msg12676 (view) Author: Jeff Allen (jeff.allen) Date: 2019-10-05.08:17:52
I claim this is fixed at
Date User Action Args
2019-11-02 10:15:14jeff.allensetstatus: pending -> closed
2019-11-01 22:41:49jeff.allenlinkissue2804 superseder
2019-10-05 08:17:52jeff.allensetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg12676
2019-10-02 21:18:15jeff.allensetassignee: jeff.allen
resolution: accepted
messages: + msg12674
2019-09-28 09:21:05jeff.allencreate