MethodHandle () { try { Class<?> clazz = Class.forName("com.intellij.openapi.application.ex.ApplicationManagerEx"); MethodHandle handle = MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()).findStatic(clazz, "isInStressTest", MethodType.methodType(boolean.class)); Object result = handle.invokeWithArguments(); assert result instanceof Boolean; return handle; } catch (Throwable e) { throw new RuntimeException(e); } }