Skip to content
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

Remove warning in task :kotlin:compileKotlin #4368

Merged
merged 1 commit into from
Jul 28, 2022

Conversation

mscheong01
Copy link
Contributor

@mscheong01 mscheong01 commented Jul 27, 2022

Motivation:

Noticed some warnings while building the project:

> Task :kotlin:compileKotlin w: Argument -Xopt-in is deprecated. Please use -opt-in instead w: /Users/wjdalstn/Documents/GitHub/armeria/kotlin/src/main/kotlin/com/linecorp/armeria/client/kotlin/CoroutineRestClient.kt: (33, 12): Type parameter 'T' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details w: /Users/wjdalstn/Documents/GitHub/armeria/kotlin/src/main/kotlin/com/linecorp/armeria/client/kotlin/CoroutineRestClient.kt: (33, 20): Type parameter 'T' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details w: /Users/wjdalstn/Documents/GitHub/armeria/kotlin/src/main/kotlin/com/linecorp/armeria/client/kotlin/CoroutineRestClient.kt: (41, 12): Type parameter 'T' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details w: /Users/wjdalstn/Documents/GitHub/armeria/kotlin/src/main/kotlin/com/linecorp/armeria/client/kotlin/CoroutineRestClient.kt: (41, 20): Type parameter 'T' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details

Perhaps something related to the definitly non nullable types feature since kotlin 1.6.20

Modifications:

  • Providing upper bound Any removes the warning

Result:

no warnings!

@codecov
Copy link

codecov bot commented Jul 27, 2022

Codecov Report

Merging #4368 (8ae51c8) into master (7395a2e) will increase coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master    #4368   +/-   ##
=========================================
  Coverage     73.53%   73.54%           
- Complexity    17648    17652    +4     
=========================================
  Files          1500     1500           
  Lines         66010    66010           
  Branches       8328     8328           
=========================================
+ Hits          48540    48544    +4     
+ Misses        13254    13249    -5     
- Partials       4216     4217    +1     
Impacted Files Coverage Δ
...ecorp/armeria/client/kotlin/CoroutineRestClient.kt 0.00% <ø> (ø)
...ecorp/armeria/server/LengthBasedServiceNaming.java 75.00% <0.00%> (-16.67%) ⬇️
...rnal/common/GracefulConnectionShutdownHandler.java 68.08% <0.00%> (-6.39%) ⬇️
...rnal/common/stream/AbstractFixedStreamMessage.java 89.23% <0.00%> (-3.08%) ⬇️
...meria/client/DefaultDnsQueryLifecycleObserver.java 76.81% <0.00%> (-2.90%) ⬇️
...ia/common/stream/ConcatPublisherStreamMessage.java 78.29% <0.00%> (-2.33%) ⬇️
...a/internal/common/stream/ByteBufsDecoderInput.java 85.61% <0.00%> (-0.72%) ⬇️
.../linecorp/armeria/client/Http1ResponseDecoder.java 56.97% <0.00%> (-0.59%) ⬇️
...com/linecorp/armeria/server/HttpServerHandler.java 79.85% <0.00%> (-0.36%) ⬇️
...corp/armeria/common/logging/DefaultRequestLog.java 79.97% <0.00%> (+0.25%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7395a2e...8ae51c8. Read the comment docs.

@ikhoon ikhoon added the cleanup label Jul 28, 2022
Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @j-min5u! ❤️

@@ -29,14 +29,14 @@ import kotlinx.coroutines.future.await
*
* @see JacksonObjectMapperProvider
*/
suspend inline fun <reified T> RestClientPreparation.execute(): ResponseEntity<T> {
suspend inline fun <reified T : Any> RestClientPreparation.execute(): ResponseEntity<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: https://stackoverflow.com/questions/63535390/how-is-any-upper-bound-in-kotlin-different-from-the-default-no-bounds
I didn't know that <T> bound is the same as <T : Any?>. TIL 🙇‍♂️

@ikhoon ikhoon added this to the 1.18.0 milestone Jul 28, 2022
Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @j-min5u ! 🙇 👍 🙇

Copy link
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @j-min5u!

@minwoox minwoox merged commit 86922b2 into line:master Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants