Skip to content

Commit 822f3ca

Browse files
committed
run on Java 21 #11518
1 parent 0d1ce5e commit 822f3ca

39 files changed

+23
-2802
lines changed

gradle/libs.versions.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mockito = "5.19.0"
44
slf4j = "1.7.36"
55
jetty = "9.4.58.v20250814"
66
tika = "3.2.2"
7+
graalvm = "23.1.9"
78

89
[libraries]
910
junit-junit4 = { module = "junit:junit", version = "4.13.2" }
@@ -54,7 +55,7 @@ osgi-core = { module = "org.osgi:osgi.core", version = "8.0.0" }
5455
felix-metatype = { module = "org.apache.felix:org.apache.felix.metatype", version = "1.2.4" }
5556
felix-eventadmin = { module = "org.apache.felix:org.apache.felix.eventadmin", version = "1.6.4" }
5657
felix-configadmin = { module = "org.apache.felix:org.apache.felix.configadmin", version = "1.9.26" }
57-
felix-scr = { module = "org.apache.felix:org.apache.felix.scr", version = "2.2.6" }
58+
felix-scr = { module = "org.apache.felix:org.apache.felix.scr", version = "2.2.14" }
5859
felix-framework = { module = "org.apache.felix:org.apache.felix.framework", version = "7.0.5" }
5960
felix-utils = { module = "org.apache.felix:org.apache.felix.utils", version = "1.11.8" }
6061
felix-log = { module = "org.apache.felix:org.apache.felix.log", version = "1.3.0" }
@@ -65,7 +66,7 @@ felix-gogo-runtime = { module = "org.apache.felix:org.apache.felix.gogo.runtime"
6566
felix-gogo-shell = { module = "org.apache.felix:org.apache.felix.gogo.shell", version = "0.12.0" }
6667
felix-shell-remote = { module = "org.apache.felix:org.apache.felix.shell.remote", version = "1.1.2" }
6768

68-
bcprov-jdk18on = { module = "org.bouncycastle:bcprov-jdk18on", version = "1.81" }
69+
bcprov-jdk18on = { module = "org.bouncycastle:bcprov-jdk18on", version = "1.82" }
6970

7071
elasticsearch = { module = "org.elasticsearch:elasticsearch", version = "2.4.6" }
7172

@@ -77,7 +78,7 @@ jsoup = { module = "org.jsoup:jsoup", version = "1.21.2" }
7778

7879
owaspsanitizer = { module = "com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer", version = "20240325.1" }
7980

80-
bytebuddy = { module = "net.bytebuddy:byte-buddy", version = "1.17.7" }
81+
bytebuddy = { module = "net.bytebuddy:byte-buddy", version = "1.17.8" }
8182

8283
cronutils = { module = "com.cronutils:cron-utils", version = "9.2.0" }
8384

@@ -86,10 +87,12 @@ jhlabs-filters = { module = "com.jhlabs:filters", version = "2.0.235-1" }
8687
attoparser = { module = "org.attoparser:attoparser", version = "1.3" }
8788

8889
nashorn = { module = "org.openjdk.nashorn:nashorn-core", version = "15.7" }
89-
graaljs = { module = "org.graalvm.js:js", version = "22.3.5" }
90+
graalvm-polyglot = { module = "org.graalvm.polyglot:polyglot", version.ref = "graalvm" }
91+
graalvm-js = { module = "org.graalvm.polyglot:js", version.ref = "graalvm" }
92+
graalvm-jsse = { module = "org.graalvm.js:js-scriptengine", version.ref = "graalvm" }
9093

9194
commons-lang = { module = "commons-lang:commons-lang", version = "2.6" }
92-
commons-lang3 = { module = "org.apache.commons:commons-lang3", version = "3.18.0" }
95+
commons-lang3 = { module = "org.apache.commons:commons-lang3", version = "3.19.0" }
9396
commons-io = { module = "commons-io:commons-io", version = "2.20.0" }
9497
commons-compress = { module = "org.apache.commons:commons-compress", version = "1.28.0" }
9598

modules/runtime/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55

66
configurations {
77
lib
8+
mods
89
}
910

1011
dependencies {
@@ -14,6 +15,13 @@ dependencies {
1415
lib libs.nashorn
1516
}
1617

18+
dependencies {
19+
mods libs.nashorn
20+
mods libs.graalvm.polyglot
21+
mods libs.graalvm.js
22+
mods libs.graalvm.jsse
23+
}
24+
1725
ext {
1826
bundleCopySpecs = []
1927
}
@@ -284,6 +292,9 @@ distributions {
284292
into( '/lib' ) {
285293
from( configurations.lib )
286294
}
295+
into( '/mods' ) {
296+
from( configurations.mods )
297+
}
287298
into( '/' ) {
288299
from( 'src' ) {
289300
filesMatching( '**/*.sh' ) {

modules/runtime/src/bin/server.bat

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,13 @@ goto fail
4040
set XP_INSTALL=%DIRNAME%..
4141
set DEFAULT_JAVA_OPTS=-XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch
4242
set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
43-
set CONSTANT_XP_OPTS=-Dfile.encoding=UTF8 -Dmapper.allow_dots_in_name=true --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
44-
45-
"%JAVA_EXE%" --list-modules -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct >NUL 2>NUL
46-
if %ERRORLEVEL% EQU 0 set CONSTANT_XP_OPTS=-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct %CONSTANT_XP_OPTS%
43+
set CONSTANT_XP_OPTS=-Dfile.encoding=UTF8 -Dmapper.allow_dots_in_name=true --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
4744

4845
if "%JAVA_OPTS%" == "" set JAVA_OPTS=%DEFAULT_JAVA_OPTS%
4946
if "%JAVA_DEBUG_OPTS%" == "" set JAVA_DEBUG_OPTS=%DEFAULT_JAVA_DEBUG_OPTS%
5047

5148
IF "%1"=="debug" set JAVA_OPTS=%JAVA_OPTS% %JAVA_DEBUG_OPTS%
5249

5350
:execute
54-
"%JAVA_EXE%" %JAVA_OPTS% -Dxp.install="%XP_INSTALL%" %XP_OPTS% %CONSTANT_XP_OPTS% -classpath "%XP_INSTALL%\lib\*" com.enonic.xp.launcher.LauncherMain %ARGS%
51+
"%JAVA_EXE%" %JAVA_OPTS% -Dxp.install="%XP_INSTALL%" %XP_OPTS% %CONSTANT_XP_OPTS% --module-path "%XP_INSTALL%\mods" -classpath "%XP_INSTALL%\lib\*" com.enonic.xp.launcher.LauncherMain %ARGS%
5552
endlocal

modules/runtime/src/bin/server.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ locateJava() {
3939
setupDefaults() {
4040
DEFAULT_JAVA_OPTS="-XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch"
4141
DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
42-
CONSTANT_XP_OPTS=(-Dfile.encoding=UTF8 -Dmapper.allow_dots_in_name=true --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED)
42+
CONSTANT_XP_OPTS=(-Dfile.encoding=UTF8 -Dmapper.allow_dots_in_name=true --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED)
4343
}
4444

4545
setupOptions() {
@@ -75,7 +75,7 @@ init() {
7575
}
7676

7777
run() {
78-
exec "$JAVACMD" $JAVA_OPTS -Dxp.install="$XP_INSTALL" $XP_OPTS "${CONSTANT_XP_OPTS[@]}" -classpath "$XP_INSTALL/lib/*" com.enonic.xp.launcher.LauncherMain "${ARGS[@]}"
78+
exec "$JAVACMD" $JAVA_OPTS -Dxp.install="$XP_INSTALL" $XP_OPTS "${CONSTANT_XP_OPTS[@]}" --module-path "$XP_INSTALL/mods" -classpath "$XP_INSTALL/lib/*" com.enonic.xp.launcher.LauncherMain "${ARGS[@]}"
7979
}
8080

8181
main() {

modules/script/script-impl/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ dependencies {
33
implementation project( ':core:core-internal' )
44

55
implementation libs.nashorn
6-
implementation libs.graaljs
76

87
testImplementation( testFixtures( project(":core:core-app") ) )
98

modules/script/script-impl/src/main/java/com/enonic/xp/script/graal/GraalJSContextFactory.java

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)