Bug#895619: plexus-compiler: use --release instead of -source/-target for jdk9+ when setting defaults

Tiago Stürmer Daitx tiago.daitx at canonical.com
Fri Apr 13 16:14:55 BST 2018


Source: plexus-compiler
Version: 2.8.2-5
Severity: normal

Dear Maintainer,

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 [3] 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.

Regards,
Tiago Daitx

References:
[1] https://bugs.launchpad.net/ubuntu/+source/gradle/+bug/1760359
[2] https://github.com/plasma-umass/doppio/issues/497
[3] http://openjdk.java.net/jeps/247


-- 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 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled



More information about the pkg-java-maintainers mailing list