JdbLastErrorTest.java tests use of SetLastError and GetLastError using Panama (on Windows). It is unreliable.
The updated Panama situation is that this test as written will still fail sometimes, but that is because the test is doing it wrong. An actual call to the native GetLastError can still overwrite the last error value: making a new call is likely to break the last error value just doing method resolution, at least the first time it happens.
But the answer to the original problem is that we now have Linker.Option.CaptureCallState which gives us the chance to capture last error when calling a MethodHandle, and read the stored last error code in a VarHandle.
The test should be removed, it is redundant. Calling set/get last error directly is not the way to do this, and CaptureCallState is tested in test/jdk/java/foreign/capturecallstate/TestCaptureCallState.java