Title: Illegal reflective access by org.python.modules.gc
Type: behaviour Severity: minor
Components: Library Versions: Jython 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jeff.allen, stefan.richthofer
Priority: normal Keywords: Java Roadmap, test failure causes

Created on 2018-05-07.06:55:31 by jeff.allen, last changed 2018-05-08.22:13:29 by stefan.richthofer.

msg11950 (view) Author: Jeff Allen (jeff.allen) Date: 2018-05-07.06:55:30
test_gc_jy produces warnings in Java 9

WARNING: Illegal reflective access by org.python.modules.gc (file:.../jython-dev.jar) to field java.util.ArrayList.elementData

A cut-down version of the test only running GCTests_Jy_TraverseByReflection is a good basis for debugging. Launching the test as:
dist\bin\jython -J--illegal-access=debug -m test.regrtest -v test_gc_jy
will show where the illegal access happens, at the call to setAccessible in org.python.modules.gc.traverseByReflectionIntern.

I'm peeling this off from #2656 in order to park it. I don't consider this a blocker for 2.7.2, but it is a long-term Java roadmap issue. Before the available JVMs prohibit access to private fields (at the moment they just produce an ugly message), our implementation of gc will need a re-think. The ugly message is not encountered unless the optional gc module is invoked, which must mean the user is prepared for a tussle with JVM internals.
msg11963 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2018-05-08.22:13:28
traverseByReflection is only a fallback mode, see javadoc of modules.gc.DONT_TRAVERSE_BY_REFLECTION for details.
The easiest solution on this front would be to disable it by default, currently it is enabled by default.

A more elaborate solution could attempt to get fields by method access to avoid private access. However the current implementation intentionally avoids this because of unforeseeable potential side effects of method calls.
Date User Action Args
2018-05-08 22:13:29stefan.richthofersetnosy: + stefan.richthofer
messages: + msg11963
2018-05-07 06:55:32jeff.allencreate