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

Java 9 support #4111

Closed
2 tasks done
headius opened this issue Aug 24, 2016 · 9 comments
Closed
2 tasks done

Java 9 support #4111

headius opened this issue Aug 24, 2016 · 9 comments

Comments

@headius
Copy link
Member

headius commented Aug 24, 2016

We have not yet started testing on Java 9, and there are certain to be some interesting challenges running alongside Jigsaw.

This is a catch-all bug to get Java 9 support working by JRuby 9.2.

Here's what we know is outstanding:

@headius headius added this to the JRuby 9.2.0.0 milestone Aug 24, 2016
headius added a commit that referenced this issue Aug 24, 2016
This new exception is raised by Jigsaw when you attempt to make
accessible the inaccessible elements of a module's classes.
Unfortunately, since the exception doesn't exist on Java 8,
there's no way to catch it (in code that needs to build on Java 8)
except for this hack.

This allows `jruby -e 1` to run properly on Java 9.

This fixes part of #4111.
headius added a commit that referenced this issue Aug 24, 2016
This new exception is raised by Jigsaw when you attempt to make
accessible the inaccessible elements of a module's classes.
Unfortunately, since the exception doesn't exist on Java 8,
there's no way to catch it (in code that needs to build on Java 8)
except for this hack.

This allows `jruby -e 1` to run properly on Java 9.

This fixes part of #4111.
@headius
Copy link
Member Author

headius commented Aug 24, 2016

84b12e7 and 677ce03 fix the setAccessible problem for master and 1.7, respectively. That fix allows JRuby to at least do -e 1 and gem list on my OS X system with a recent Java 9 EA release.

@kares
Copy link
Member

kares commented Aug 25, 2016

"najs" hack - was thinking about approaching Java 8 support (in Java code) by doing a core sub-module but it gets complicated maintenance hell quickly. so your approach is probably the best it gets atm.

on a related note maybe we shall at least consider dropping Java 7 for 9.2 does that sound reasonable (we could do much greater JI when compiling under 8) ?

@kares
Copy link
Member

kares commented Aug 25, 2016

just seen #4112 ... so I guess Java 7 stays in the picture (for 9.2) than :(

@jordansissel
Copy link
Contributor

Following up here from #4558

Running JRuby 9.1.7.0 with a bunch of --add-opens flags lets me get to a hello-world:

ruby -J--add-opens=java.base/{java.lang,java.security,java.util,java.security.cert}=ALL-UNNAMED

(This adds opens for java.lang, java.security, java.util, and java.security.cert)

@jordansissel
Copy link
Contributor

Gem installation seems to fail because RubyZlib fails during installation

  • RubyZlib fails during initializer:
% ruby -J--add-opens=java.base/{java.lang,java.security,java.util,java.security.cert}=ALL-UNNAMED  -e 'p org.jruby.ext.zlib.RubyZlib'
NameError: cannot initialize Java class org.jruby.ext.zlib.RubyZlib (java.lang.ExceptionInInitializerError)
  method_missing at org/jruby/javasupport/JavaPackage.java:259
          <main> at -e:1

@jordansissel
Copy link
Contributor

jordansissel commented Apr 7, 2017

RubyZlib calls setAccessible on java.util.zip.CRC32 , so adding java.util.zip to --add-opens works around this.

The following flags are what I'm using now to make progress testing on JRuby 9k + Java 9.

JRUBY_OPTS="$(echo -J--add-opens=java.base/{java.lang,java.security,java.util,java.security.cert,java.util.zip,java.lang.reflect,java.util.regex,java.net}=ALL-UNNAMED)"

@perlun
Copy link
Contributor

perlun commented Oct 5, 2017

Do we have any updates on this? (I haven't yet installed Java 9; the GA release was announced a couple of weeks ago.)

@headius
Copy link
Member Author

headius commented Oct 31, 2017

JRuby 9.1.14 will work properly on Java 9, albeit with some warnings for some actions. The examples here with --add-opens flags provide a fine workaround for now, and we may have to put some of these in our executables.

The other day I ran JRuby 9.1.14 with Rails 5 on JDK9 and it was able to do everything properly without many warnings. I would say we support JDK9 well enough to close this issue.

I will open a new issue for ongoing accessibility warnings, so we can aggregate what flags are needed and get them into the launchers (or find alternative ways that don't trigger warnings).

@jordansissel
Copy link
Contributor

jordansissel commented Oct 31, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants