javac source & target
Ronald Klop <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.java |
|---|---|
| Message-ID | <707700450.1043.1765456430535@localhost> |
Hi,
I'm looking into the PR "Mk/bsd.default-versions.mk: update JAVA_DEFAULT to 21".
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272855
Quiet some work involves changing hardcoded -source -target settings to javac. Quite some ports have targets lower than 8 which is not supported by recent javac version.
/usr/local/openjdk21/bin/javac --help:
--target <release>, -target <release>
Generate class files suitable for the specified Java SE release.
Supported releases:
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21
Openjdk17 supports 7-17 and openjdk25 supports 8-25. Mind that java can read classes going back to version 1. It is just that the javac compiler can't generate them anymore.
To make class files usable between ports I think it is user friendly to compile targeted for the oldest JDK in the ports tree which is now openjdk8.
Or we can aim to remove the source/target definitions and compile for JAVA_DEFAULT.
Unfortunately these source/target definitions are often hardcoded in the source code of the port so we need to patch anyways.
What are your thoughts on this?
Regards,
Ronald.