You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compiler/suspend-transform-plugin-cli/src/test/kotlin/love/forte/plugin/suspendtrans/cli/ConfigurationSerializeTests.kt
Copy file name to clipboardExpand all lines: compiler/suspend-transform-plugin-configuration/src/main/kotlin/love/forte/plugin/suspendtrans/configuration/SuspendTransformConfiguration.kt
+77-2Lines changed: 77 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -246,6 +246,53 @@ class IncludeAnnotation @InternalSuspendTransformConfigurationApi constructor(
246
246
}
247
247
}
248
248
249
+
/**
250
+
* Controls the nullability applied to the generic argument copied from the
251
+
* original suspend function return type into [Transformer.transformReturnType].
252
+
*
253
+
* This setting is only meaningful when [Transformer.transformReturnType] is not
254
+
* `null` and [Transformer.transformReturnTypeGeneric] is `true`.
255
+
*
256
+
* The main use case is [NON_NULL]: some wrapper APIs, such as Reactive
257
+
* Streams-style containers, do not allow `null` elements and represent absence
258
+
* as an empty result instead. In that case the generated generic argument should
259
+
* describe the emitted element as non-null.
260
+
*
261
+
* @since 0.14.0
262
+
*/
263
+
@Serializable
264
+
enumclassTransformReturnTypeGenericMode {
265
+
/**
266
+
* Keep the original return type unchanged.
267
+
*
268
+
* Example: `T` remains `T`, and `Foo?` remains `Foo?`.
269
+
*/
270
+
NORMAL,
271
+
272
+
/**
273
+
* Make the copied generic argument nullable.
274
+
*
275
+
* Example: `Foo` becomes `Foo?`.
276
+
*
277
+
* This is provided for explicit nullable wrappers. The primary motivation of
278
+
* this enum is [NON_NULL].
279
+
*/
280
+
NULLABLE,
281
+
282
+
/**
283
+
* Make the copied generic argument non-nullable.
284
+
*
285
+
* For type parameters with nullable bounds, this uses a definitely-not-null
286
+
* type at the use site, e.g. `T` becomes `T & Any`. It does not rewrite the
287
+
* original type parameter declaration or its upper bound.
288
+
*
289
+
* This is useful for wrappers whose element type cannot be `null`, for
290
+
* example Reactive Streams-style APIs where `null` must be modeled as an
Copy file name to clipboardExpand all lines: compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformerAnnotations.kt
0 commit comments