bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: msgfmt generated java sources not compiliing under Java 9+ due to Mo


From: Bruno Haible
Subject: Re: msgfmt generated java sources not compiliing under Java 9+ due to Module System
Date: Tue, 19 Nov 2024 19:44:57 +0100

Hi,

> using gettext-tools version 0.21, when using msgfmt with  --java2 -source to
> generate java sources ("ResourceBundles") for later use, I receive a
> compiler error, caused by the Java Platform Module System (JPMS), which was
> introduced with Java 9: The package java.lang is accessible from more than
> one module.
>
>
>
> I found this is caused by the explicit reference to java.lang.String and
> java.lang.Object in several places. This specific reference is not needed
> and can be left out (even without explicit import statements).
>
>
>
> I'd therefore like to suggest the following changes to  /src/write-java.c
>
>
>
>
>
> 426       fprintf (stream, "new java.lang.String[] { ");
>
> Replace by
>
> 426       fprintf (stream, "new String[] { ");
>
>
>
>
>
> 460       fprintf (stream, "      java.lang.Object found = table[idx];\n");
>
> Replace by
>
> 460       fprintf (stream, "      Object found = table[idx];\n");
>
>
>
> Etc.
>
>
>
> Essentially, removing all occurences of "java.lang.".

Thanks for the report. GNU gettext version 0.22.x now supports Java versions
up to 20 (at least), and I did not encounter the hassles that you mention.

Do you still reproduce the issue with Java 11 or newer? (Java 9 is
out-of-support by now, see
https://en.wikipedia.org/wiki/Java_version_history#Release_table ).

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]