On 26/03/2018 02:58, James Roper wrote:
Hi all,

According to Alan Bateman, MR jars can be used to introduce JDK9 API
features on classes, such that javac can compile code against them to use
the JDK9 specific API provided by the JDK9 version of the class, and still
have the same classes be compatible with (and loadable by) JDK8:

http://kto.so/2017/09/30/the-practical-truth-about-multi-release-jars/#comment-3563924109

:

So it would be nice to have an official statement about whether the above
use case is using the MR feature as intended, and whether that use case is
considered a good practice or not.
That blog has been updated since I added the comment. If I recall correctly, the original blog was using javac with an exploded build, not a MR JAR.

In any case, the intention is that a specific version of a library export one API and it shouldn't vary depending on the JDK version. The implementation may of course have code specific to JDK 9, 10, ... but the API for consumers of that version of the library should always be the same. The `jar` tool checks this when creating a MR JAR. I don't know if the Maven Archiver and other plugins that create JAR files do the same check yet.

-Alan

Reply via email to