Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: javac -source and -target version

15 views
Skip to first unread message

Hideki Yamane

unread,
Oct 4, 2023, 11:40:03 AM10/4/23
to
Hi,

Some of Java packages are FTBFS with Java21 due to javac -source and -target
version is lower than that is supported in Java21.

Well, is there any text / document to use which version should be
used for -source and -target version, or is just dropgping those options
allowed?


Maybe I asked it before but cannot remember the reasons...
so I hope someone let me know it.


Thanks!

--
Hideki Yamane <hen...@iijmio-mail.jp>

Emmanuel Bourg

unread,
Oct 4, 2023, 2:00:04 PM10/4/23
to
Le 04/10/2023 à 13:36, Hideki Yamane a écrit :

> Well, is there any text / document to use which version should be
> used for -source and -target version, or is just dropping those options
> allowed?

For Java 17 the minimum was 7, and with Java 21 the minimum is 8. For
packages using ant, Maven or Gradle the level is adjusted automatically.
You can drop the language level, but the package will require the same
version or higher at runtime.

We should probably provide the minimum language level supported as a
variable in the /usr/share/java/java_defaults.mk file from java-common.

Emmanuel Bourg

Hideki Yamane

unread,
Oct 4, 2023, 7:10:04 PM10/4/23
to
Hi,

On Wed, 4 Oct 2023 19:49:44 +0200
Emmanuel Bourg <ebo...@apache.org> wrote:
> We should probably provide the minimum language level supported as a
> variable in the /usr/share/java/java_defaults.mk file from java-common.

Nice, each Java packages do not need to care about which level
should use and drop it safely, then?

--
Hideki Yamane <hen...@iijmio-mail.jp>

Emmanuel Bourg

unread,
Oct 4, 2023, 7:40:04 PM10/4/23
to
Le 05/10/2023 à 01:07, Hideki Yamane a écrit :

>> We should probably provide the minimum language level supported as a
>> variable in the /usr/share/java/java_defaults.mk file from java-common.
>
> Nice, each Java packages do not need to care about which level
> should use and drop it safely, then?


I've just uploaded java-common/0.75 with a new java_compat_level
variable if you want to give it a try:

#!/usr/bin/make -f

include /usr/share/java/java_defaults.mk

build:
javac -source $(java_compat_level) -target $(java_compat_level) ...


It's preferable to keep using the -source/-target options rather than
removing them, it extends the lower bound of the Java versions range
usable with the package.

Emmanuel Bourg

Hideki Yamane

unread,
Oct 7, 2023, 11:30:04 PM10/7/23
to
Hi,

On Thu, 5 Oct 2023 01:26:11 +0200
Emmanuel Bourg <ebo...@apache.org> wrote:
> I've just uploaded java-common/0.75 with a new java_compat_level
> variable if you want to give it a try:
>
> #!/usr/bin/make -f
>
> include /usr/share/java/java_defaults.mk
>
> build:
> javac -source $(java_compat_level) -target $(java_compat_level) ...

Thank you, and how about adding java_compat_level=8 for Java21?
Since some FTBFS reports are there.
https://salsa.debian.org/java-team/java-common/-/merge_requests/3


> It's preferable to keep using the -source/-target options rather than
> removing them, it extends the lower bound of the Java versions range
> usable with the package.

Okay :)


--
Regards,

Hideki Yamane henrich @ debian.org/iijmio-mail.jp

Emmanuel Bourg

unread,
Oct 10, 2023, 5:30:04 PM10/10/23
to
Hi Hideki,

Le 08/10/2023 à 05:25, Hideki Yamane a écrit :

> Thank you, and how about adding java_compat_level=8 for Java21?
> Since some FTBFS reports are there.
> https://salsa.debian.org/java-team/java-common/-/merge_requests/3

java_compat_level=8 is supported in java-common/0.75+exp1 in
experimental. If you want to test the compatibility with Java 21 you can
install default-jdk from experimental, it will switch the default JDK to
Java 21 and update the java_compat_level macro.

Emmanuel Bourg
0 new messages