bug-gettext
[Top][All Lists]
Advanced

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

msgfmt generated java sources not compiliing under Java 9+ due to Module


From: florian
Subject: msgfmt generated java sources not compiliing under Java 9+ due to Module System
Date: Wed, 8 Jun 2022 21:22:41 +0200

Hello,

 

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.".

 

I would be happy to provide a patchfile in case you’re interested, but wantet to check first if this would be okay for you.

 

 

Thanks a lot,

Florian


reply via email to

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