8319560: Reformat method parameters in the FFM API

Reviewed-by: mcimadamore
This commit is contained in:
Per Minborg 2023-11-07 15:05:03 +00:00
parent ef8c8408a6
commit 134c382d39
4 changed files with 26 additions and 12 deletions
src/java.base/share/classes/java/lang/foreign

@ -550,7 +550,9 @@ public sealed interface Linker permits AbstractLinker {
*/
@CallerSensitive
@Restricted
MethodHandle downcallHandle(MemorySegment address, FunctionDescriptor function, Option... options);
MethodHandle downcallHandle(MemorySegment address,
FunctionDescriptor function,
Option... options);
/**
* Creates a method handle that is used to call a foreign function with the given signature.
@ -637,7 +639,10 @@ public sealed interface Linker permits AbstractLinker {
*/
@CallerSensitive
@Restricted
MemorySegment upcallStub(MethodHandle target, FunctionDescriptor function, Arena arena, Linker.Option... options);
MemorySegment upcallStub(MethodHandle target,
FunctionDescriptor function,
Arena arena,
Linker.Option... options);
/**
* Returns a symbol lookup for symbols in a set of commonly used libraries.

@ -670,7 +670,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
*/
@CallerSensitive
@Restricted
MemorySegment reinterpret(long newSize, Arena arena, Consumer<MemorySegment> cleanup);
MemorySegment reinterpret(long newSize,
Arena arena,
Consumer<MemorySegment> cleanup);
/**
* {@return {@code true}, if this segment is read-only}
@ -2081,9 +2083,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
* @throws IndexOutOfBoundsException if either {@code srcOffset}, {@code dstIndex} or {@code elementCount} are {@code < 0}
*/
@ForceInline
static void copy(
MemorySegment srcSegment, ValueLayout srcLayout, long srcOffset,
Object dstArray, int dstIndex, int elementCount) {
static void copy(MemorySegment srcSegment, ValueLayout srcLayout, long srcOffset,
Object dstArray, int dstIndex,
int elementCount) {
Objects.requireNonNull(srcSegment);
Objects.requireNonNull(dstArray);
Objects.requireNonNull(srcLayout);
@ -2121,9 +2123,9 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
* @throws IndexOutOfBoundsException if either {@code srcIndex}, {@code dstOffset} or {@code elementCount} are {@code < 0}
*/
@ForceInline
static void copy(
Object srcArray, int srcIndex,
MemorySegment dstSegment, ValueLayout dstLayout, long dstOffset, int elementCount) {
static void copy(Object srcArray, int srcIndex,
MemorySegment dstSegment, ValueLayout dstLayout, long dstOffset,
int elementCount) {
Objects.requireNonNull(srcArray);
Objects.requireNonNull(dstSegment);
Objects.requireNonNull(dstLayout);

@ -372,8 +372,11 @@ public interface SegmentAllocator {
* @throws IndexOutOfBoundsException if either {@code sourceOffset} or {@code elementCount} are {@code < 0}
*/
@ForceInline
default MemorySegment allocateFrom(ValueLayout elementLayout, MemorySegment source,
ValueLayout sourceElementLayout, long sourceOffset, long elementCount) {
default MemorySegment allocateFrom(ValueLayout elementLayout,
MemorySegment source,
ValueLayout sourceElementLayout,
long sourceOffset,
long elementCount) {
Objects.requireNonNull(source);
Objects.requireNonNull(sourceElementLayout);
Objects.requireNonNull(elementLayout);

@ -262,7 +262,11 @@ public interface SymbolLookup {
return libraryLookup(path, RawNativeLibraries::load, arena);
}
private static <Z> SymbolLookup libraryLookup(Z libDesc, BiFunction<RawNativeLibraries, Z, NativeLibrary> loadLibraryFunc, Arena libArena) {
private static <Z>
SymbolLookup libraryLookup(Z libDesc,
BiFunction<RawNativeLibraries, Z, NativeLibrary> loadLibraryFunc,
Arena libArena) {
Objects.requireNonNull(libDesc);
Objects.requireNonNull(libArena);
// attempt to load native library from path or name