Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 842447 - update java-pkg-simple.eclass to die when module-info.java has been found but jdk < 9 is used for compilation
Summary: update java-pkg-simple.eclass to die when module-info.java has been found but...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords: PullRequest
Depends on: 796875
Blocks:
  Show dependency tree
 
Reported: 2022-05-03 14:55 UTC by Volkmar W. Pogatzki
Modified: 2023-03-07 08:23 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volkmar W. Pogatzki 2022-05-03 14:55:16 UTC
Please.
Comment 1 Miroslav Šulc gentoo-dev 2022-05-03 15:33:46 UTC
i just did a test and it seems that i was wrong with this one.

i dropped module-info support from java-pkg-simple.eclass, and forced source on stax2-api to 9 using JAVA_PKG_WANT_SOURCE="9". the goal was to compile the code using jdk 9+ source but build jdk 1.8 bytecode. but this is the result on the modified stax2-api:

javac -source 9 -target 1.8 -d target/classes -encoding UTF-8 --module-version 4.2.1 @sources.lst
warning: source release 9 requires target release 9

and then ejavac crashes.

so the only change to java-pkg-simple.eclass will be probably just changing

ewarn "Need at least JDK 9 to compile module-info.java in src_compile,"

to die as Flow suggested. still, this would be good to do to catch any packages that would not be fixed by accident.
Comment 2 Jan Henke 2022-05-03 19:18:39 UTC
As far as I remember, the way to do it was to compile everything for Java 1.8 (source/target/bootstrap; the last one is important too, since otherwise you get 1.8 class files which can still depend on the 9+ standard library) except the module-info.java, which is then compiled with source/target/bootstrap of Java 9.

At runtime Java 1.8 would then complain about the class file version of the module-info.class, but it has no meaning for it anyway.
Comment 3 Larry the Git Cow gentoo-dev 2022-05-05 09:30:52 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a890940dce62dea54a867901f85e37985bc76943

commit a890940dce62dea54a867901f85e37985bc76943
Author:     Florian Schmaus <flow@gentoo.org>
AuthorDate: 2022-05-03 20:19:05 +0000
Commit:     Florian Schmaus <flow@gentoo.org>
CommitDate: 2022-05-05 09:30:28 +0000

    java-pkg-simple.eclass: eqawarn if module-info.java is not compiled
    
    In preperation of this ewarn part becoming 'die' (bug #842447), switch
    it to eqawarn to improve catching the affected packages.
    
    Bug: https://bugs.gentoo.org/796875
    Bug: https://bugs.gentoo.org/842447
    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    Closes: https://github.com/gentoo/gentoo/pull/25306

 eclass/java-pkg-simple.eclass | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Comment 4 Volkmar W. Pogatzki 2023-03-07 08:23:15 UTC
Fixed withccommit a890940dce62dea54a867901f85e37985bc76943