-
Notifications
You must be signed in to change notification settings - Fork 926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Koltlin nullable type support to AnnotatedService
#4225
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4225 +/- ##
============================================
- Coverage 73.34% 73.34% -0.01%
- Complexity 16952 16978 +26
============================================
Files 1451 1450 -1
Lines 63982 64104 +122
Branches 8026 8061 +35
============================================
+ Hits 46928 47017 +89
- Misses 12964 12991 +27
- Partials 4090 4096 +6
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looking nice!
kotlin/src/test/kotlin/com/linecorp/armeria/server/kotlin/NullableTypeSupportTest.kt
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotatedValueResolver.java
Outdated
Show resolved
Hide resolved
…ableTypeSupportTest.kt Co-authored-by: Ikhun Um <ih.pert@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @ks-yim! 💯❤️
Thanks, it would be nice if we improve the doc, too. I will work on that too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great news for Kotlin users 🙇
kotlin/src/test/kotlin/com/linecorp/armeria/server/kotlin/NullableTypeSupportTest.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 😄
Motivation:
AnnotatedService
requires@Nullable
annotations for nullable resolved values even when it is used with Kotlin which offers nice null-safety with nullable types.Modifications:
isMarkedNullable
method toKotlinUtil
.AnnotatedValueResolver#Builder
detect Kotlin nullable types ofField
andParameter
and allow null values for them.Result:
@Nullable
annotations to nullable arguments & fields inAnnotatedService
if they are Kotlin nullable types(?
).AnnotatedService
arguments #4144