You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't call methods of private subclasses with java_method in java 12 #5841
You can't call methods of private subclasses with java_method in java 12.
$ jruby test.rb
2019-08-20T09:36:29.010+09:00 [main] WARN FilenoUtil : Native subprocess control requires open access to sun.nio.ch
Pass '--add-opens java.base/sun.nio.ch=org.jruby.dist' or '=org.jruby.core' to enable.
TypeError: illegal access on 'publicMethod': class org.jruby.javasupport.JavaMethod (in module org.jruby.dist) cannot access a member of class JavaTest$PrivateSubclass with modifiers "public"
call at org/jruby/RubyMethod.java:120
<main> at test.rb:2
It looks like all places that use the JI_SETACCESSIBLE option (with the default "false" on Java 9+) are already using our safe trySetAccessible that's aware of modules. Changing this calculated default to "true" appears to work fine.
I'm going to push it to a PR to make sure it doesn't affect too much other code.
Activity
headius commentedon Aug 20, 2019
Looks like this is a problem with how we determine whether we should set methods accessible.
The logic here basically turns off setAccessible when on Java 9 or higher:
jruby/core/src/main/java/org/jruby/util/cli/Options.java
Line 319 in cf7a2bf
I'm going to look at changing this property back to always true and modify the logic that uses it to use our trySetAccessible logic.
headius commentedon Aug 20, 2019
It looks like all places that use the JI_SETACCESSIBLE option (with the default "false" on Java 9+) are already using our safe trySetAccessible that's aware of modules. Changing this calculated default to "true" appears to work fine.
I'm going to push it to a PR to make sure it doesn't affect too much other code.
Move all JI setAccessible to trySetAccessible.
Move all JI setAccessible to trySetAccessible.