Hello all
Le 2025-05-24 à 15 h 33, Elliotte Rusty Harold a écrit :
If you want to upgrade the minimum Java version, you need a better
reason than that. I haven't yet heard a reason strong enough to
convince me. Others have other opinions.
Java 9+ for supporting JPMS. This is needed not only in some plugins
(compiler, javadoc, maybe surefire), but also in some places of Maven
core (class-path versus module-path, cache of module-info). Even if not
everyone is interested in JPMS, trying to enable JPMS while preserving
Java 8 compatibility (e.g. with reflection) would have been difficult.
Java 16+ for starting the migration to records. Some data structures in
Maven core overlap with Java records. In particular, all the classes
generated from the `maven.mdo` file, but not only. In short term,
migrating to records would remove the need to declare constructors,
hashCode and equals methods, thus making classes simpler and reducing
the risk of bugs. In medium term, "derived record creation" (currently
in preview) could replace builders. That would be a massive
simplification of record-like classes.
Java 24+ (in a later Maven version) for class-file API. It would resolve
at least some of the compatibility problems observed when new Java
versions are released and Maven wants to analyse the byte code.
I would much rather people invested their time into fixing Maven bugs
and improving the health of the codebase rather than continuously
migrating code from one Java version to the next.
There is two distinct tasks:
* Making sure that Maven is compatible with latest Java version. This
is the task that sometime requires work. This task must be done in
any cases.
* Upgrading the minimum Java version. Assuming that above task is
done, this task is not much more than changing the value of some
properties.
Upgrading the minimum Java version does not force us to migrate any
code. But we can start using new API that make some tasks easier, thus
saving time.
Martin