Issue2792

classification
Title: Failures in test_import_jy from Java 13
Type: Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jeff.allen
Priority: normal Keywords:

Created on 2019-08-03.06:37:39 by jeff.allen, last changed 2022-06-13.11:39:34 by jeff.allen.

Messages
msg12616 (view) Author: Jeff Allen (jeff.allen) Date: 2019-08-03.06:37:38
Observed on Linux (my own job on Travis CI) we see two failures in test_import_jy when running on Java 13 or 14:

     [exec] ======================================================================
     [exec] FAIL: test_dunder_init (test.test_import_jy.MislabeledImportTestCase)
     [exec] ----------------------------------------------------------------------
     [exec] Traceback (most recent call last):
     [exec]   File "/home/travis/build/jeff5/jython/dist/Lib/test/test_import_jy.py", line 65, in test_dunder_init
     [exec]     self.assertEquals(module_obj.__file__, init)
     [exec] AssertionError: '/home/travis/build/jeff5/jython/dunder_init_test/__init__.py' != 'dunder_init_test/__init__.py'
     [exec] 
     [exec] ======================================================================
     [exec] FAIL: test_import_star (test.test_import_jy.ImpTestCase)
     [exec] ----------------------------------------------------------------------
     [exec] Traceback (most recent call last):
     [exec]   File "/home/travis/build/jeff5/jython/dist/Lib/test/test_import_jy.py", line 177, in test_import_star
     [exec]     self.assertEquals(0, subprocess.call(
     [exec] AssertionError: 0 != 1
     [exec] 
     [exec] ----------------------------------------------------------------------

Before the second of these, we see:
     [exec] Traceback (most recent call last):
     [exec]   File "/home/travis/build/jeff5/jython/dist/Lib/test/import_star_from_java.py", line 4, in <module>
     [exec]     p = Pattern.compile("foo")
     [exec] NameError: name 'Pattern' is not defined
     [exec] test_import_star (test.test_import_jy.ImpTestCase) ... FAIL

This suggests the import has failed here:
from java.util.regex import *   # Module: java.base
p = Pattern.compile("foo")

I'm pretty sure Pattern is there, so I think this may be the cache playing up again. One line of investigation is that, about Java 13, Oracle note:

Reminder of a change in b24 - A jrt URI can only encode paths to files in /modules tree (JDK-8224946)(https://bugs.openjdk.java.net/browse/JDK-8224946)

A jrt URL is a hierarchical URI with syntax jrt:/[$MODULE[/$PATH]]. When using the jrt file system, a java.net.URI object can be created with the java.nio.file.Path::toUri method to encode a normalized path to a file in the /modules tree. A jrt URL cannot encode a path to a file in the /packages tree. The jrt file system provider has changed in this release so that toUri fails with IOError when it is not possible to encode the file path as a jrt URI. This change may impact tools have been making use of URLs that are not compliant with the syntax. Tools with paths to files in /packages can use the toRealPath() method to obtain the real path (in /modules) before attempting to convert the file path to a URI.

We may as a result be bug-compatible with Java 9 to 12 in the work done on #2362 and #2734. Or it may be something quite different. Or both, as there are 2 failures.
msg13226 (view) Author: Jeff Allen (jeff.allen) Date: 2022-06-13.11:39:34
Also https://github.com/jython/jython/issues/105 and believed fixed in updating ASM JARs at https://github.com/jython/jython/commit/7c11f58d7b84b6ae0ea22bed0abc96a72cbd8de6 .
History
Date User Action Args
2022-06-13 11:39:34jeff.allensetstatus: open -> closed
resolution: fixed
messages: + msg13226
2019-08-03 06:37:39jeff.allencreate