From cee96f8e571a0e5f5d8f1163ec978d8c5a451964 Mon Sep 17 00:00:00 2001 From: Frank Liu Date: Fri, 27 Sep 2024 09:33:11 -0700 Subject: [PATCH] [mxnet] Fixes build error on JDK 22 --- .../test/java/ai/djl/util/SecurityManagerTest.java | 4 ++++ engines/mxnet/jnarator/build.gradle.kts | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/api/src/test/java/ai/djl/util/SecurityManagerTest.java b/api/src/test/java/ai/djl/util/SecurityManagerTest.java index fbe09975d60..322aed7344e 100644 --- a/api/src/test/java/ai/djl/util/SecurityManagerTest.java +++ b/api/src/test/java/ai/djl/util/SecurityManagerTest.java @@ -13,6 +13,7 @@ package ai.djl.util; import org.testng.Assert; +import org.testng.SkipException; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -25,6 +26,9 @@ public class SecurityManagerTest { @BeforeTest public void setUp() { + if (Runtime.version().version().get(0) > 17) { + throw new SkipException("Skip SecurityManagerTest for JDK 19+"); + } originalSM = System.getSecurityManager(); } diff --git a/engines/mxnet/jnarator/build.gradle.kts b/engines/mxnet/jnarator/build.gradle.kts index 3f63a179a19..4f3ddbcbb2a 100644 --- a/engines/mxnet/jnarator/build.gradle.kts +++ b/engines/mxnet/jnarator/build.gradle.kts @@ -19,6 +19,14 @@ tasks { checkstyleMain { exclude("ai/djl/mxnet/jnarator/parser/*") } pmdMain { exclude("ai/djl/mxnet/jnarator/parser/*") } + compileJava { + options.apply { + release = 8 + encoding = "UTF-8" + compilerArgs = listOf("-proc:none", "-Xlint:all,-options,-static") + } + } + jar { dependsOn(generateGrammarSource) manifest { @@ -39,5 +47,4 @@ tasks { generateTestGrammarSource { dependsOn(verifyJava) } - -} \ No newline at end of file +}