can't use `XmirPackage` in package-info.java
At this line, in TranspileMojo, if we remove //, the build fails with internal Javac error (at least for me, with OpenJDK 23.0.1). Let's find out what's wrong and enable the usage of XmirPackage.
@yegor256 If I understand correctly, the issue is that package-info.java files are defined twice. When the compiler crashes with an internal error, the logs show something like this:
[ERROR] /home/user/eolang/eo/eo-runtime/target/generated-sources/E0org/EOeoLang/EOfs/package-info.java: [6,23] a package-info.java file has already been seen for package E0org.EOeolang.EOfs
[ERROR] /home/user/eolang/eo/eo-runtime/target/generated-sources/EOorg/EOeolang/EOmath/package-info.java: [6,23] a package-info.java file has already been seen for package Eorg.EOeolang.EOmath
[ERROR] /home/user/eolang/eo/eo-runtime/target/generated-sources/EOorg/EOeolang/EOsys/package-info.java: [6,23] a package-info.java file has already been seen for package EOrg.EOeolang.EOsys
[ERROR] /home/user/eolang/eo/eo-runtime/target/generated-sources/E0org/EOeolang/EOtxt/package-info.java: [6,23] a package-info.java file has already been seen for package EOorg.EOeolang.EOtxt
[ERROR] /home/user/eolang/eo/eo-runtime/target/generated-sources/E0org/EOeolang/package-info.java: [6,14] a package-info.java file has already been seen for package EOorg.EOeolang
The first time package-info.java is defined is here https://github.com/objectionary/eo/blob/master/eo-runtime/src/main/java/EOorg/package-info.java
and in the nested folders.
Then, TranspileMojo generates them again but with different content, adding the @org.eolang.XmirPackage annotation. This causes the error.
Workarounds:
-
Removing this setting in the
pom.xml: https://github.com/objectionary/eo/blob/1aaeb2a6113c4e82121a2185a6157990a45dc8b3/pom.xml#L387 This way, as far as I understand,package-info.javais regenerated with the new content. -
Deleting the predefined
package-info.javafiles from https://github.com/objectionary/eo/tree/master/eo-runtime/src/main/java/EOorg and its nested folders also helps. Then,TranspileMojogeneratespackage-info.javafiles, and they are compiled only once.
Alternatively, we need to find a way to avoid generating or modifying package-info.java unnecessarily, and we should annotate the predefined package-info.java files in advance.
@Suban05 I don't think this is the problem. It's perfectly legit to have multiple package-info.java files in the same package. We have that in many libraries. The bug is related to something else inside Javac.