+ try (ClassLoaderObjectInputStream is = new ClassLoaderObjectInputStream(system.dynamicAccess().classLoader(),
+ new ByteArrayInputStream(bytes))) {
+ return is.readObject();
+ } catch (IOException | ClassNotFoundException e) {
+ throw new IllegalStateException("Failed to deserialize object", e);
+ }