Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to build/use PL/Java on Java 22 #479

Merged
merged 5 commits into from
Mar 27, 2024

Conversation

jcflack
Copy link
Contributor

@jcflack jcflack commented Mar 26, 2024

These changes take care of building and using PL/Java on Java 22.

A separate patch will address new Java 22 features that can be exposed in PL/Java's API for use by user code.

Naturally, no patch will begin using Java 22 features within PL/Java itself until a future major release adopts a newer minimum build version.

jcflack added 5 commits March 25, 2024 21:30
The version of graaljs that works on jdk15-21 won't work
on 22, and the 24.0.0 version of its js-scriptengine uses
class file version 61 and therefore won't work below 17.

As nashorn has been made available as a Maven resource
also, and works painlessly, use that for jdk22 and up.
(For later: use in place of graaljs for 15-21 also, if
tested with no issues.)
It is usable in all the versions for which graaljs was
being used, and with fewer dependency headaches.
No issues observed in compiling manually (without the Maven
directive specifying an earlier --release) on Oracle JDK 22 GA.

cd pljava-api/src/main/java
/var/tmp/jdk-22/bin/javac -d ../../../target/classes/ \
 -Xlint:unchecked -Xlint:-removal --module-version 1.6-SNAPSHOT \
 $(find . -name '*.java')
cd ../../..
/var/tmp/jdk-22/bin/jar cf target/pljava-api-1.6-SNAPSHOT.jar \
 -C target/classes .

cd ../pljava/src/main/java
/var/tmp/jdk-22/bin/javac --module-version 1.6-SNAPSHOT \
 -d ../../../target/classes/ \
 --module-path ../../../../pljava-api/target/pljava-api-1.6-SNAPSHOT.jar \
 --processor-module-path \
  ../../../../pljava-api/target/pljava-api-1.6-SNAPSHOT.jar \
 -Xlint:unchecked -Xlint:-removal $(find . -name '*.java')
cd ../../../
/var/tmp/jdk-22/bin/jar cf target/pljava-1.6-SNAPSHOT.jar \
 -C target/classes .

cd ../pljava-examples/src/main/java
/var/tmp/jdk-22/bin/javac -d ../../../target/classes/ \
 --module-path ../../../../pljava-api/target/pljava-api-1.6-SNAPSHOT.jar \
 --processor-module-path \
  ../../../../pljava-api/target/pljava-api-1.6-SNAPSHOT.jar \
 --class-path \
  ~/.m2/repository/net/sf/saxon/Saxon-HE/10.9/Saxon-HE-10.9.jar: \
 -Xlint:unchecked -Xlint:-removal \
 --add-modules org.postgresql.pljava $(find . -name '*.java')
cd ../../../target/classes
zip -r ../pljava-examples-1.6-SNAPSHOT.jar *
# zip because jar m doesn't preserve order of manifest entries
cd ../../../
# with dir of intended pg_config version on PATH:
mvn clean install --projects pljava-packaging
As of Java 22, the necessary mechanisms have not yet
been disabled. (There is probably, though, with increasing
versions, an increasing risk of Java internals that lack
doPrivileged and will end up needing to leak into policy.)
@jcflack jcflack merged commit 9b7d010 into REL1_6_STABLE Mar 27, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant