Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jruby 9.2.7 with Java 11 "NoMethodError: undefined method `separator' for Java::JavaIo::File:Class" #5737

twkatadin opened this issue May 18, 2019 · 2 comments


Copy link

@twkatadin twkatadin commented May 18, 2019


jruby (2.5.3) 2019-04-09 8a269e3 OpenJDK 64-Bit Server VM 11+28 on 11+28 +jit
Windows 10

Expected Behavior

From a command prompt the following command under Java 8 returns the system file separator character:
(jruby (2.5.3) 2019-04-09 8a269e3 OpenJDK 64-Bit Server VM 25.212-b04 on 1.8.0_212-b04 +jit [mswin32-x86_64])

jruby -e "separator =; puts separator.to_s"

Actual Behavior

From a command prompt under Java 11:
jruby -e "separator =; puts separator.to_s"
2019-05-17T14:41:22.761-10:00 [main] WARN FilenoUtil : Native subprocess control requires open access to
Pass '--add-opens java.base/' or '=org.jruby.core' to enable.
java.lang.IllegalCallerException: is not open to module org.jruby.dist
at java.base/java.lang.Module.addOpens(
at org.jruby.dist/com.headius.backport9.modules.impl.Module9.addOpens(
at org.jruby.dist/com.headius.backport9.modules.Modules.addOpens(
at org.jruby.dist/$ReflectiveAccess.(
at org.jruby.dist/
at org.jruby.dist/
at org.jruby.dist/
at org.jruby.dist/
at org.jruby.dist/
at org.jruby.dist/org.jruby.RubyIO.prepIO(
at org.jruby.dist/org.jruby.RubyIO.prepStdio(
at org.jruby.dist/org.jruby.RubyGlobal.initSTDIO(
at org.jruby.dist/org.jruby.RubyGlobal.createGlobals(
at org.jruby.dist/org.jruby.Ruby.init(
at org.jruby.dist/org.jruby.Ruby.newInstance(
at org.jruby.dist/org.jruby.Main.internalRun(
at org.jruby.dist/
at org.jruby.dist/org.jruby.Main.main(
NoMethodError: undefined method `separator' for Java::JavaIo::File:Class
method_missing at org/jruby/

at -e:1

Copy link

@kares kares commented May 19, 2019

you should access it using constant syntax, since its a constant:


Copy link

@headius headius commented May 20, 2019

@kares That was my first thought as well...but that syntax, with a lower-case s, is equivalent to calling the separator method anyway. The problem here is that this is a static final value on that does not have a leading cap.

Because the field does not have a leading capital letter, it falls into the logic for accessors, which in used too-restrictive guards for accessibility. That was fixed by #5731.

@twkatadin This behavior should work again in For now you should be able to access these constants using the following code:

$ jruby -e 'p java::io::File.java_class.field(:separator).value(nil)'

@kares @enebo I guess we should spend some time making sure JI specs run under Java 9+ so we can avoid regressing JI behavior like this.

I will close this as a dup of #5730.


@headius headius closed this May 20, 2019
@headius headius added this to the JRuby milestone May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants