Message12662

Author jeff.allen
Recipients jeff.allen
Date 2019-09-28.09:21:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569662465.75.0.423414825494.issue2806@roundup.psfhosted.org>
In-reply-to
Content
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>(ThreadStateMapping.java:31)
        at org.python.core.Py.<clinit>(Py.java:1734)
        at org.python.core.PySystemState.<clinit>(PySystemState.java:72)
        at org.python.util.jython.main(jython.java:531)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.MapMaker
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 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 {};
   Code:
      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 jython.java.version = "1.7".)

PS jython-trunk> ant -D"jython.java.version=1.7" 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 {};
    Code:
       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?
History
Date User Action Args
2019-09-28 09:21:05jeff.allensetrecipients: + jeff.allen
2019-09-28 09:21:05jeff.allensetmessageid: <1569662465.75.0.423414825494.issue2806@roundup.psfhosted.org>
2019-09-28 09:21:05jeff.allenlinkissue2806 messages
2019-09-28 09:21:05jeff.allencreate