RFR: 8282191: Implementation of Foreign Function & Memory API (Preview)

Julia Boes jboes at openjdk.java.net
Mon Mar 21 16:36:45 UTC 2022


On Mon, 21 Mar 2022 10:45:27 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This PR contains the API and implementation changes for JEP-424 [1]. A more detailed description of such changes, to avoid repetitions during the review process, is included as a separate comment.
> 
> [1] - https://openjdk.java.net/jeps/424

src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 600:

> 598:      * @param elementLayout the source element layout. If the byte order associated with the layout is
> 599:      * different from the native order, a byte swap operation will be performed on each array element.
> 600:      * @return a fresh short array copy of this memory segment.

Maybe use "new" instead of "fresh" here and in the other MemorySegment::toArray methods?

src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 600:

> 598:      * @param elementLayout the source element layout. If the byte order associated with the layout is
> 599:      * different from the native order, a byte swap operation will be performed on each array element.
> 600:      * @return a fresh short array copy of this memory segment.

Maybe use "new" instead of "fresh" here and in the other MemorySegment::toArray methods?

src/java.base/share/classes/java/lang/foreign/package-info.java line 149:

> 147:  * provided:
> 148:  *
> 149:  * {@snippet lang=java :

missing leading space in comment on line 150 and 162

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 7986:

> 7984:      * <p>
> 7985:      * When calling e.g. {@link VarHandle#get(Object...)} on the resulting var handle, the incoming coordinate values
> 7986:      * starting at position {@code pos} (of type {@code C1, C2 ... Cn}, where {@code C1, C2 ... Cn} are the return type

... are the return *types* ...

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 7986:

> 7984:      * <p>
> 7985:      * When calling e.g. {@link VarHandle#get(Object...)} on the resulting var handle, the incoming coordinate values
> 7986:      * starting at position {@code pos} (of type {@code C1, C2 ... Cn}, where {@code C1, C2 ... Cn} are the return type

... are the return *types* ...

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 8035:

> 8033:      * @param pos the position of the first coordinate to be inserted
> 8034:      * @param values the series of bound coordinates to insert
> 8035:      * @return an adapter var handle which inserts an additional coordinates,

... which inserts additional coordinates, ...

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 8035:

> 8033:      * @param pos the position of the first coordinate to be inserted
> 8034:      * @param values the series of bound coordinates to insert
> 8035:      * @return an adapter var handle which inserts an additional coordinates,

... which inserts additional coordinates, ...

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 8151:

> 8149:      *
> 8150:      * @param target the var handle to invoke after the dummy coordinates are dropped
> 8151:      * @param pos position of first coordinate to drop (zero for the leftmost)

... of *the* first coordinate to drop ...

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 8151:

> 8149:      *
> 8150:      * @param target the var handle to invoke after the dummy coordinates are dropped
> 8151:      * @param pos position of first coordinate to drop (zero for the leftmost)

... of *the* first coordinate to drop ...

-------------

PR: https://git.openjdk.java.net/jdk/pull/7888



More information about the security-dev mailing list