Skip to content

OSGeo Java codesprint 2018

María Arias de Reyna edited this page Sep 13, 2018 · 10 revisions

Regarding the OSGeo Java 2018 CodeSprint.

Why do we need a codesprint?

Java is evolving a lot now. Both in how the language works and in the support of previous versions.

With the faster release cadence, a new strategy was required for delivering updates. Oracle now produce two JDK binaries: the traditional Oracle JDK and one built purely from OpenJDK source. By JDK 11 these will be functionally equivalent but not so from the perspective of updates. Each OpenJDK binary will only have updates (security patches and bug fixes) for six months, until the release of the next JDK. The Oracle JDK will have a long-term support (LTS) release every three years. JDK 8 is currently an LTS; the next will be JDK 11.

source

source

Conclusion: We should move to Java 11 version.

Major changes that break backwards compatibility were introduced mostly in Java9, so the effort would be the same (and Java9 is also out of support).

Should we use OpenJDK or Oracle as reference?

Actually, Oracle JDK’s build process builds from OpenJDK source code. So there is no major technical difference between Oracle JDK and OpenJDK.

source

Conclusion: They are the same. Use OpenJDK as reference.

Can we move to OpenJDK 11 (next LTE version) seamlessly?

Strategy:

  1. Run an existing Java application with JDK 11.
  2. Compile the application with Java 11.
  3. Modularize the application to use Module System.

source + long explanation

Naive Attempt

Check if GeoNetwork is compatible seamlessly. TL;DR: No.

Run with maven/jetty

  1. As expected, Spring fails to load.
  2. Warning on reflection:

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

Build with maven

Installing OpenJDK 11 and try to run maven fails:

  1. Missing javax classes (and probably even more missing/moved core JDK classes).
  2. Warning on reflection:

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

List of actions to make GeoNetwork compatible

This list may not be complete.

  1. Replace Spring with latest version: from 3.2.0 to 5 https://jira.spring.io/browse/SPR-16391
  2. Locate and replace all imports referencing missing JDK API
  3. Replace other dependencies that may be struggling with JDK 11
  4. Check all reflection

Extras that can make our life easier

  1. "Get rid" as much as possible of Jeeves
  2. Migrate all remaining services to REST/API
  3. Remove old/no longer used services

Out of scope

This is the list of things that would be nice to have, but are not really mandatory (yet).

  1. Move to the new module/jigsaw from classpath

Will GeoNetwork be backwards compatible with JDK 8?

Hard to say.

Spring 5 is compatible with Java 8. But the importing of the core JDK libraries and changes on the code for reflection...

Clone this wiki locally
You can’t perform that action at this time.