diff --git a/src/library/scala/runtime/Statics.java b/src/library/scala/runtime/Statics.java index 09288e09fbfd..886d000592ef 100644 --- a/src/library/scala/runtime/Statics.java +++ b/src/library/scala/runtime/Statics.java @@ -159,7 +159,7 @@ private static MethodHandle mkHandle() { MethodHandles.Lookup lookup = MethodHandles.lookup(); try { return lookup.findStatic(Class.forName("java.lang.invoke.VarHandle"), "releaseFence", MethodType.methodType(Void.TYPE)); - } catch (ClassNotFoundException e) { + } catch (NoSuchMethodException | ClassNotFoundException e) { try { Class unsafeClass = Class.forName("sun.misc.Unsafe"); return lookup.findVirtual(unsafeClass, "storeFence", MethodType.methodType(void.class)).bindTo(findUnsafe(unsafeClass)); @@ -168,7 +168,7 @@ private static MethodHandle mkHandle() { error.addSuppressed(e); throw error; } - } catch (NoSuchMethodException | IllegalAccessException e) { + } catch (IllegalAccessException e) { throw new ExceptionInInitializerError(e); } }