plexus-compiler currently will default -source and/or -target to 1.7
whenever the following occours:
1) whenever either has not being set
2) whenever either has been set to 1.6 or earlier
This patch modifies the detection logic in order to be able to set the
'--release' flag when (and only when):
- the '--release' is *not* set
- AND both -source and -target are being set to a default value
- AND the running jvm is jdk9 or newer
This prevents errors such as the infamous "Method
flip()Ljava/nio/ByteBuffer; does not exist in class java.nio.ByteBuffer"
that is caused by building with openjdk-9 with -source set without
setting the proper bootclasspath [1,2]. JEP-247  has provided the
--release to prevent such issues and should be used instead of -source
whenever the javac being used is jdk9 or higher.
I have tested and I can confirm it works fine, but I would like some
review to make sure it is sane and get opinions on other (better?) ways
to do this - specially concerning the detection of the jvm being run.
Also, fork and an alternative javac compiler might be set, thus I would
like to discuss as to what behavior it should default it in that case.
-- System Information:
Debian Release: buster/sid
APT prefers bionic
APT policy: (500, 'bionic'), (400, 'bionic-proposed')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.15.0-13-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled