Message12250
It is more accurate to say that javax.xml.bind.DatatypeConverter is not available in Java 9 SE, used normally. http://openjdk.java.net/jeps/320. There are workarounds (https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j) 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\test_large_method_bytecode_jy.py", 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(MethodWriter.java:2089)
at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:458)
at org.python.compiler.ClassFile.write(ClassFile.java:263)
at org.python.compiler.Module.write(Module.java:664)
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_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:22 | jeff.allen | set | messageid: <1546504462.01.0.412789736417.issue2663@roundup.psfhosted.org> |
2019-01-03 08:34:22 | jeff.allen | set | recipients:
+ jeff.allen, stefan.richthofer |
2019-01-03 08:34:21 | jeff.allen | link | issue2663 messages |
2019-01-03 08:34:21 | jeff.allen | create | |
|