openequella / openEQUELLA

Core openEQUELLA sources
https://openequella.github.io/
Apache License 2.0
42 stars 44 forks source link

Update build to work with JDK 11 #2911

Open edalex-ian opened 3 years ago

edalex-ian commented 3 years ago

Is your feature request related to a problem? Please describe.

The codebase is currently targetted to be build with JDK 8, where as JDK 11 has now been the latest LTS for awhile - further the next LTS (JDK 17) is due this year (2021).

Describe the solution you'd like

Fix the current issues with the SBT build which is blocking this. (In theory the code would not yet have to be changed, as this ticket does not yet suggest also increasing the target version to 11 - another ticket should capture that.)

Describe alternatives you've considered

Just upgrading to 9 or 10 - however they're already obsolete.

Additional context

Here is a quick attempt with no effort to address anything.

At git commit:

$ git log --oneline -1
717109d89 (HEAD -> develop, origin/develop, origin/HEAD) chore(deps): Update SBT wrapper script

With java version:

$ java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment 18.9 (build 11.0.10+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9, mixed mode)

Results in (using the SBT wrapper script in project root):

$ ./sbt installerZip
[info] Loading settings from idea.sbt ...
[info] Loading global plugins from /home/ian/.sbt/1.0/plugins
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /var/tmp/openEQUELLA/project
[info] Updating ProjectRef(uri("file:/var/tmp/openEQUELLA/project/"), "openequella-build")...
[info] Done updating.
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]  * org.ow2.asm:asm-commons:8.0.1 is selected over 7.0
[warn]      +- org.jacoco:org.jacoco.core:0.8.6                   (depends on 8.0.1)
[warn]      +- org.pantsbuild:jarjar:1.7.2                        (depends on 7.0)
[warn]  * org.ow2.asm:asm-analysis:8.0.1 is selected over 7.0
[warn]      +- org.ow2.asm:asm-commons:8.0.1                      (depends on 8.0.1)
[warn]      +- org.ow2.asm:asm-commons:7.0                        (depends on 7.0)
[warn]  * org.ow2.asm:asm-tree:8.0.1 is selected over 7.0
[warn]      +- org.jacoco:org.jacoco.core:0.8.6                   (depends on 8.0.1)
[warn]      +- org.ow2.asm:asm-analysis:8.0.1                     (depends on 8.0.1)
[warn]      +- org.ow2.asm:asm-commons:8.0.1                      (depends on 8.0.1)
[warn]      +- org.ow2.asm:asm-analysis:7.0                       (depends on 7.0)
[warn]      +- org.ow2.asm:asm-commons:7.0                        (depends on 7.0)
[warn]  * org.ow2.asm:asm:8.0.1 is selected over 7.0
[warn]      +- org.jacoco:org.jacoco.core:0.8.6                   (depends on 8.0.1)
[warn]      +- org.ow2.asm:asm-tree:8.0.1                         (depends on 8.0.1)
[warn]      +- org.ow2.asm:asm-commons:8.0.1                      (depends on 8.0.1)
[warn]      +- org.pantsbuild:jarjar:1.7.2                        (depends on 7.0)
[warn]      +- org.ow2.asm:asm-tree:7.0                           (depends on 7.0)
[warn]      +- org.ow2.asm:asm-commons:7.0                        (depends on 7.0)
[warn]  * net.sf.saxon:Saxon-HE:9.6.0-5 is selected over 10.3
[warn]      +- com.etsy:sbt-checkstyle-plugin:3.1.1 (scalaVersion=2.12, sbtVersion=1.0) (depends on 9.6.0-5)
[warn]      +- com.puppycrawl.tools:checkstyle:8.41.1             (depends on 10.3)
[warn] Run 'evicted' to see detailed eviction warnings
[info] Compiling 16 Scala sources to /var/tmp/openEQUELLA/project/target/scala-2.12/sbt-1.0/classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.6. Compiling...
[info]   Compilation completed in 4.681s.
[warn] there were two feature warnings; re-run with -feature for details
[warn] one warning found
[info] Done compiling.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/home/ian/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.1.6/protobuf-java-3.3.1.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
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
/var/tmp/openEQUELLA/build.sbt:140: error: ambiguous reference to overloaded definition,
both method putAll in class Properties of type (x$1: java.util.Map[_, _])Unit
and  method putAll in class Hashtable of type (x$1: java.util.Map[_ <: Object, _ <: Object])Unit
match argument types (java.util.Map[String,String])
  props.putAll(
        ^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 

This obviously looks like a fairly simple issue, but it's just a question of how many of these follow.

NOTE: Those dependency warnings are not new or related to this.

edalex-ian commented 3 years ago

I've also just noticed in com.tle.core.application.impl.PluginServiceImpl there is use of Reflection.getCallerClass(depth) which is deprecated in Java 8 and slated for removal in 9. Probably need to go and find others like this and get a list together.