RFR: 8292362: java/lang/Thread/jni/AttachCurrentThread/AttachTest.java#id1 failed on some platforms

Alan Bateman alanb at openjdk.org
Mon Aug 15 13:02:06 UTC 2022


On Mon, 15 Aug 2022 12:23:41 GMT, Ao Qi <aoqi at openjdk.org> wrote:

> For example, java/lang/Thread/jni/AttachCurrentThread/AttachTest.java#id1 failed on LoongArch64 (probably other platforms unsupported in src/java.base/share/classes/jdk/internal/foreign/CABI.java might have the same issue):
>  
> 
> Exception in thread "main" java.lang.UnsupportedOperationException: Unsupported os, arch, or address size: Linux, loongarch64, 64
> at java.base/jdk.internal.foreign.CABI.current(CABI.java:69)
> at java.base/jdk.internal.foreign.abi.SharedUtils.getSystemLinker(SharedUtils.java:237)
> at java.base/java.lang.foreign.Linker.nativeLinker(Linker.java:198)
> at ImplicitAttach.main(ImplicitAttach.java:48)

Linker.nativeLinker is currently specified to throw UOE so you might find the following will avoid ports needing to change the test:


--- a/test/jdk/java/lang/Thread/jni/AttachCurrentThread/ImplicitAttach.java
+++ b/test/jdk/java/lang/Thread/jni/AttachCurrentThread/ImplicitAttach.java
@@ -45,7 +45,13 @@ public class ImplicitAttach {
         }
         latch = new CountDownLatch(threadCount);
 
-        Linker abi = Linker.nativeLinker();
+        Linker abi;
+        try {
+            abi = Linker.nativeLinker();
+        } catch (UnsupportedOperationException e) {
+            System.out.println("Test skipped, no native linker on this platform");
+            return;
+        }
 
         // stub to invoke callback
         MethodHandle callback = MethodHandles.lookup()

-------------

PR: https://git.openjdk.org/jdk/pull/9877


More information about the core-libs-dev mailing list