Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
FlowResponseConverterFunctionProvider
Type Extension functio…
…ns toClass() (#5201) ### Type of PR Hello! While reviewing the Kotlin part of Armeria, I noticed that in the `FlowResponseConverterFunctionProvider` class, there's an extension function for `Type` used in the `createResponseConverterFunction()` function of `DelegatingResponseConverterFunctionProvider`. The `toClass()` function returns a type of `Class<*>?`. <br> In the past, when working with Kotlin, I found it beneficial to define extension functions that return nullable values with names following the `toXXXOrNull()` pattern. This made the code more understandable for me and my teammates, especially during maintenance. <br> Since the extension function is defined just below `createResponseConverterFunction()`, it may lead to questions like "Why use `toClass()?.let` here?" Adding `OrNull` to the function name can make the code more readable. <br> > I understand that naming conventions can vary among teams, and it may not be a critical issue. However, if you find the suggestion helpful, I'd appreciate it if you could consider applying the change. --- ```kt private fun Type.toClassOrNull(): Class<*>? = when (this) { is ParameterizedType -> this.rawType as Class<*> is Class<*> -> this else -> null }
- Loading branch information