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
headius opened this issue Aug 24, 2016 · 9 comments
Closed

Java 9 support #4111

headius opened this issue Aug 24, 2016 · 9 comments
Labels

Comments

@headius
Copy link
Member

@headius 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:

  • Booting up currently raises java.lang.reflect.InaccessibleObjectException, a new exception in 9 that indicates we can't setAccessible JDK classes. (84b12e7 and 677ce03)
  • io/console warnings on startup (#3611)
@headius headius added the JRuby 9000 label Aug 24, 2016
@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 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 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 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

@jordansissel jordansissel commented Apr 7, 2017

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

@jordansissel jordansissel commented Apr 7, 2017

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 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 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 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 jordansissel commented Oct 31, 2017

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.