VarHandle::get() when supplied with a corrupt segment (misaligned or empty), an IllegalArgumentException is being thrown. IllegalArgumentException is not mentioned in the api doc for VarHandle::get()
MemorySegment segment = confinedArena.allocate(someLayout);
MemorySegment segment1 = MemorySegment.ofAddress(segment.address() + 1); //corruptSegment
…
VarHandle vh_x = layout1.varHandle(PathElement.sequenceElement(), PathElement.groupElement("x"));
// vh_x.set(segment, 0, 1.1);
vh_x.get(segment1, 0);
MemorySegment segment = confinedArena.allocate(someLayout);
MemorySegment segment1 = MemorySegment.ofAddress(segment.address() + 1); //corruptSegment
…
VarHandle vh_x = layout1.varHandle(PathElement.sequenceElement(), PathElement.groupElement("x"));
// vh_x.set(segment, 0, 1.1);
vh_x.get(segment1, 0);