3131 * An emulation class that represents a Java object array. Like a Java array,
3232 * an IOSObjectArray is fixed-size but its elements are mutable.
3333 */
34- @interface IOSObjectArray <__covariant ObjectType> : IOSArray<ObjectType> {
34+ NS_ASSUME_NONNULL_BEGIN
35+ @interface IOSObjectArray <__covariant ObjectType> : IOSArray <ObjectType> {
3536 @public
3637 /* *
3738 * The type of elements in this array.
4647 ObjectType __strong buffer_[0 ] __attribute__ ((aligned (__alignof__ (volatile_id))));
4748}
4849
49- @property (readonly ) IOSClass *elementType;
50+ @property (readonly ) IOSClass *elementType;
5051
5152/* * Create an array from a C object array, length, and type. */
52- + (instancetype )newArrayWithObjects : (const ObjectType *)objects
53+ + (instancetype )newArrayWithObjects : (const _Nonnull ObjectType *_Nonnull )objects
5354 count : (NSUInteger )count
5455 type : (IOSClass *)type ;
5556
5657/* * Create an autoreleased array from a C object array, length, and type. */
57- + (instancetype )arrayWithObjects : (const ObjectType *)objects
58+ + (instancetype )arrayWithObjects : (const _Nonnull ObjectType *_Nonnull )objects
5859 count : (NSUInteger )count
5960 type : (IOSClass *)type ;
6061
101102 * @throws IndexOutOfBoundsException
102103 * if the specified length is greater than the array size.
103104 */
104- - (void )getObjects : (NSObject ** )buffer length : (NSUInteger )length ;
105+ - (void )getObjects : (NSObject *_Nonnull *_Nonnull )buffer length : (NSUInteger )length ;
105106
106107@end
108+ NS_ASSUME_NONNULL_END
107109
108110/* *
109111 * Gets element at a specified index, functional equivalent to objectAtIndex:.
110112 * @throws IndexOutOfBoundsException
111113 * if index is out of range
112114 * @return the element at index.
113115 */
114- __attribute__ ((always_inline)) inline id IOSObjectArray_Get(
115- __unsafe_unretained IOSObjectArray *array, jint index) {
116+ __attribute__ ((always_inline)) inline id _Nullable IOSObjectArray_Get(
117+ __unsafe_unretained IOSObjectArray *_Nonnull array, jint index) {
116118 IOSArray_checkIndex (array->size_ , index);
117119 return ALWAYS_RETAINED_AUTORELEASED_RETURN_VALUE (array->buffer_ [index]);
118120}
@@ -123,7 +125,8 @@ __attribute__((always_inline)) inline id IOSObjectArray_Get(
123125 * if index is out of range
124126 * @return the replacement object.
125127 */
126- FOUNDATION_EXPORT id IOSObjectArray_Set (IOSObjectArray *array, NSUInteger index, id value);
128+ FOUNDATION_EXPORT id _Nullable IOSObjectArray_Set (IOSObjectArray *_Nonnull array, NSUInteger index,
129+ id _Nullable value);
127130
128131/* *
129132 * Sets element at a specified index, same as IOSObjectArray_Set(), but this function
@@ -132,22 +135,24 @@ FOUNDATION_EXPORT id IOSObjectArray_Set(IOSObjectArray *array, NSUInteger index,
132135 * if index is out of range
133136 * @return the replacement object.
134137 */
135- FOUNDATION_EXPORT id IOSObjectArray_SetAndConsume (IOSObjectArray *array, NSUInteger index,
136- id __attribute__ ((ns_consumed)) value);
138+ FOUNDATION_EXPORT id _Nullable IOSObjectArray_SetAndConsume (IOSObjectArray *_Nonnull array,
139+ NSUInteger index,
140+ id _Nullable
141+ __attribute__ ((ns_consumed)) value);
137142
138143// Internal only. Provides a pointer to an element with the array itself.
139144// Used for translating certain compound expressions.
140145typedef struct JreArrayRef {
141- __unsafe_unretained IOSObjectArray *arr;
142- __strong id * pValue;
146+ __unsafe_unretained IOSObjectArray *_Nonnull arr;
147+ __strong id _Nonnull *_Nullable pValue;
143148} JreArrayRef;
144149
145150// Internal only functions.
146151__attribute__ ((always_inline)) inline JreArrayRef IOSObjectArray_GetRef(
147- __unsafe_unretained IOSObjectArray *array, jint index) {
152+ __unsafe_unretained IOSObjectArray *_Nonnull array, jint index) {
148153 IOSArray_checkIndex (array->size_ , index);
149- return (JreArrayRef){ .arr = array, .pValue = &array->buffer_ [index] };
154+ return (JreArrayRef){.arr = array, .pValue = &array->buffer_ [index]};
150155}
151- FOUNDATION_EXPORT id IOSObjectArray_SetRef (JreArrayRef ref, id value);
156+ FOUNDATION_EXPORT id _Nullable IOSObjectArray_SetRef (JreArrayRef ref, id _Nullable value);
152157
153- #endif // IOSObjectArray_H
158+ #endif // IOSObjectArray_H
0 commit comments