maintainer-approval requested: [Bug 293756] Mk/Uses/java.mk: prefer latest LTS openjdk : [Attachment 269337] git diff to change the order of preferred java version

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 03 Apr 2026 10:03:35 UTC
Ronald Klop <ronald@FreeBSD.org> has asked freebsd-java (Nobody)
<java@FreeBSD.org> for maintainer-approval:
Bug 293756: Mk/Uses/java.mk: prefer latest LTS openjdk
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293756

Attachment 269337: git diff to change the order of preferred java version
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=269337&action=edit



--- Comment #6 from Ronald Klop <ronald@FreeBSD.org> ---
Created attachment 269337
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=269337&action=edit
git diff to change the order of preferred java version

Ok, I incorporated the remarks you have.

See attachment for new patch.

This patch does not change anything about the usage of JAVA_DEFAULT.
JAVA_DEFAULT is still used as the preferred jdk, as it is currently.
The only thing the patch does is re-order the LTS/non-LTS versions.
Java.mk used to prefer the oldest jdk in the JAVA_VERSION range. Now it prefers
LTS over non-LTS and it prefers newer versions over older versions.

Old:
JAVA_DEFAULT=21 JAVA_VERSION=8 11 17 22 => 8 (prefer oldest)
JAVA_DEFAULT=21 JAVA_VERSION=17 21 25 => 21 (prefer DEFAULT)
JAVA_DEFAULT=21 JAVA_VERSION=22 25 => 22 (prefer oldest)

New:
JAVA_DEFAULT=21 JAVA_VERSION=8 11 17 22 => 17 (prefer latest LTS)
JAVA_DEFAULT=21 JAVA_VERSION=17 21 25 => 21 (no change, prefer DEFAULT)
JAVA_DEFAULT=21 JAVA_VERSION=22 25 => 25 (prefer LTS)

Taking into account what JDKs are already installed is unchanged and still
works as intended.

Of the 485 ports with USES=java this change will only affect these 17 ports:
biology/gkl: 8 11
databases/cassandra4: 8 11
devel/argouml: 8 11 17 18
devel/gradle5: 8 11
devel/jetbrains-sqlite: 17 21
devel/spark: 8 11 17
java/apache-commons-collections: 8 11 17 18 19 20
lang/kawa: 8 11
math/jacop: 8 11 17
misc/jbidwatcher: 8 11
multimedia/kodi: 8 11
net/activemq: 21 17
net/seda: 8 11 17 21
net/spread-j: 8 11
sysutils/logstash7: 17 11 8
sysutils/rundeck: 11 17
textproc/elasticsearch7: 21 17 11 8

All other java ports already compile with JAVA_DEFAULT or are pinned to a
specific jdk.

I will do some test runs to make sure everything still compiles.

Can you review the patch in the meantime?