Author jeff.allen
Recipients jeff.allen, stefan.richthofer
Date 2019-01-03.08:34:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
It is more accurate to say that javax.xml.bind.DatatypeConverter is not available in Java 9 SE, used normally. There are workarounds ( but I think we would like this to work without.

So why, in practice, does Jython run happily on Java 9 SE?

Both occurrences of the class in question exist to support large modules (#527524). So execution is rare in normal use. The related test_large_method_bytecode_jy that might reveal the problem does not execute any test cases where it occurs in regression tests, since it lacks the test_main function. Run as a program it fails, like this:

PS jython-jvm9> dist\bin\jython -m test.test_large_method_bytecode_jy
  File "C:\Users\Jeff\Documents\Eclipse-O\jython-jvm9\dist\Lib\test\", line 25, in setUpClass
    import large_methods as _large_methods
org.objectweb.asm.MethodTooLargeException: Method too large: test/large_methods$py.large_function$1 (Lorg/python/core/PyFrame;Lorg/python/core/ThreadState;)Lorg/python/core/PyObject;
        at org.objectweb.asm.MethodWriter.computeMethodInfoSize(
        at org.objectweb.asm.ClassWriter.toByteArray(
        at org.python.compiler.ClassFile.write(
        at org.python.compiler.Module.write(

So where is the NoClassDefFoundError we should expect?

This happens because the message in the exception is not exactly what was expected by the code. That's probably something I broke by upgrading ASM to 7.0 recently. Testing the message text is a yukky way to sort exceptions, of course. It must've been necessary once (see example in #1891), but in ASM 7.0's favour, it now defines the specific exception class seen above.

With improvements to address these two, we can now fail as we ought:

PS jython-jvm9> dist\bin\jython -m test.regrtest test_large_method_bytecode_jy
test test_large_method_bytecode_jy crashed -- <type 'java.lang.NoClassDefFoundError'>: java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter

I'll commit that as a distinct change, probably with a skip on Java >= 9 for now, then move on to the main event, to find a substitute for DatatypeConverter. It is helpful to know it is only there to solve one problem: it is used to embed Python byte code as a large constant. There may be another way to do that.
Date User Action Args
2019-01-03 08:34:22jeff.allensetmessageid: <>
2019-01-03 08:34:22jeff.allensetrecipients: + jeff.allen, stefan.richthofer
2019-01-03 08:34:21jeff.allenlinkissue2663 messages
2019-01-03 08:34:21jeff.allencreate