renjin icon indicating copy to clipboard operation
renjin copied to clipboard

Upgrade to Java 11

Open perNyfelt opened this issue 3 years ago • 2 comments

Premier support of Java 8 ends in March 2022 Non-LTS Java 9 and Java 10 aren't supported since 2018 and the next LTS release is 11 which has Premier support until September 2023. More and more OS libraries are starting to require java 11 so I think it makes sense for us to move there as soon as possible as well.

perNyfelt avatar Jan 22 '22 13:01 perNyfelt

I made an initial attempt here: https://github.com/perNyfelt/renjin/tree/java11

I did NOT do any modularization but tried to stay as close to the current implementation as possible. As a result, not many files needed to change.

Good things: it compiles and all tests pass.

Maybe problematic things:

  1. The Classloader after java 8 is no longer a URLClassloader and the module system makes this non-trivial to adress. To work around that I did:
  • In the gcc-bridge i introduced a dependency on the classgraph project to build a custom URLClassloader with all classpath elements to get Soot to work.
  • In the ForkedTestControllerTest I just changed getCurrentClassPath to do System.getProperty("java.class.path")
  • In test.local.file.R in the test.jar.resource function i changed the test for res:java/util/Map.class to res:org/renjin/sexp/AtomicVector.class. The reason is that res:java/util/Map.class resolves to jrt:///java.base/java/util/Map.class which the FileSystemManager cannot make sense of. There is a way to handle this in later versions of vfs2 but upgrading vf2 looked like a LOT of work. I am not sure of the use case for locating a jar for java internal classes (e.g. java.util.Map) - there really isn't one in the jigsaw world, however if this case is important, it is probably possible to do some magic with the help of ClassGraph.

So at least there is a buildable branch based on java 11. Comments and/or suggestions would be most welcome!

perNyfelt avatar Jan 23 '22 18:01 perNyfelt

This is great, Per!

akbertram avatar Jan 24 '22 18:01 akbertram