@@ -62,6 +62,7 @@ public sealed interface FunctionDescriptor permits FunctionDescriptorImpl {
62
62
* Returns a function descriptor with the given argument layouts appended to the argument layout array
63
63
* of this function descriptor.
64
64
* @param addedLayouts the argument layouts to append.
65
+ * @throws IllegalArgumentException if one of the layouts in {@code addedLayouts} is a padding layout.
65
66
* @return the new function descriptor.
66
67
*/
67
68
FunctionDescriptor appendArgumentLayouts (MemoryLayout ... addedLayouts );
@@ -72,13 +73,15 @@ public sealed interface FunctionDescriptor permits FunctionDescriptorImpl {
72
73
* @param index the index at which to insert the arguments
73
74
* @param addedLayouts the argument layouts to insert at given index.
74
75
* @return the new function descriptor.
76
+ * @throws IllegalArgumentException if one of the layouts in {@code addedLayouts} is a padding layout.
75
77
* @throws IllegalArgumentException if {@code index < 0 || index > argumentLayouts().size()}.
76
78
*/
77
79
FunctionDescriptor insertArgumentLayouts (int index , MemoryLayout ... addedLayouts );
78
80
79
81
/**
80
82
* Returns a function descriptor with the given memory layout as the new return layout.
81
83
* @param newReturn the new return layout.
84
+ * @throws IllegalArgumentException if {@code newReturn} is a padding layout.
82
85
* @return the new function descriptor.
83
86
*/
84
87
FunctionDescriptor changeReturnLayout (MemoryLayout newReturn );
@@ -96,10 +99,12 @@ public sealed interface FunctionDescriptor permits FunctionDescriptorImpl {
96
99
* The carrier type of a layout is determined as follows:
97
100
* <ul>
98
101
* <li>If the layout is a {@link ValueLayout} the carrier type is determined through {@link ValueLayout#carrier()}.</li>
99
- * <li>If the layout is a {@link GroupLayout} the carrier type is {@link MemorySegment}.</li>
100
- * <li>If the layout is a {@link PaddingLayout}, or {@link SequenceLayout} an {@link IllegalArgumentException} is thrown.</li>
102
+ * <li>If the layout is a {@link GroupLayout} or a {@link SequenceLayout}, the carrier type is {@link MemorySegment}.</li>
101
103
* </ul>
102
104
*
105
+ * @apiNote A function descriptor cannot, by construction, contain any padding layouts. As such, it is not
106
+ * necessary to specify how padding layout should be mapped to carrier types.
107
+ *
103
108
* @return the method type consisting of the carrier types of the layouts in this function descriptor
104
109
* @throws IllegalArgumentException if one or more layouts in the function descriptor can not be mapped to carrier
105
110
* types (e.g. if they are sequence layouts or padding layouts).
@@ -110,6 +115,8 @@ public sealed interface FunctionDescriptor permits FunctionDescriptorImpl {
110
115
* Creates a function descriptor with the given return and argument layouts.
111
116
* @param resLayout the return layout.
112
117
* @param argLayouts the argument layouts.
118
+ * @throws IllegalArgumentException if {@code resLayout} is a padding layout.
119
+ * @throws IllegalArgumentException if one of the layouts in {@code argLayouts} is a padding layout.
113
120
* @return the new function descriptor.
114
121
*/
115
122
static FunctionDescriptor of (MemoryLayout resLayout , MemoryLayout ... argLayouts ) {
@@ -121,6 +128,7 @@ static FunctionDescriptor of(MemoryLayout resLayout, MemoryLayout... argLayouts)
121
128
/**
122
129
* Creates a function descriptor with the given argument layouts and no return layout.
123
130
* @param argLayouts the argument layouts.
131
+ * @throws IllegalArgumentException if one of the layouts in {@code argLayouts} is a padding layout.
124
132
* @return the new function descriptor.
125
133
*/
126
134
static FunctionDescriptor ofVoid (MemoryLayout ... argLayouts ) {
0 commit comments