Skip to content

Commit

Permalink
8291359: Specification of method j.l.foreign.VaList::skip still deser…
Browse files Browse the repository at this point in the history
…ves clarification

Reviewed-by: mcimadamore
  • Loading branch information
JornVernee committed Dec 2, 2022
1 parent 2821fa9 commit 562bc17
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/java.base/share/classes/java/lang/foreign/VaList.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
* As such, this interface only supports reading {@code int}, {@code double},
* and any other type that fits into a {@code long}.
* <h2 id="safety">Safety considerations</h2>
* Accessing a value through a variable argument list using the wrong memory layout will result in undefined behavior.
* For instance, if a variable argument list currently points at a C {@code int} value, then accessing it using
* {@link #nextVarg(ValueLayout.OfLong)} is illegal. Similarly, accessing the variable argument list with
* {@link #skip(MemoryLayout...)}, and providing a layout other than {@link ValueLayout.OfInt} is illegal.
* Any such illegal accesses might not be detected by the implementation, and can corrupt the variable argument list,
* so that the behavior of subsequent accesses is also undefined.
* <p>
* It is possible for clients to access elements outside the spatial bounds of a variable argument list.
* Variable argument list implementations will try to detect out-of-bounds reads on a best-effort basis.
* <p>
Expand Down

1 comment on commit 562bc17

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.