Support Kotlin’s "Unused Return Value" Warnings for improved developer experience #4027
daniel-morgenstern
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
@rocketraman, would you mind commenting on this, please? @daniel-morgenstern, would you be interested in contributing this feature in a PR? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Kotlin provides a feature that allows APIs to indicate that a return value must be used. When this is enabled via an annotation, the Kotlin compiler can emit warnings if a caller ignores the return value.
Applying this annotation in Log4j could help prevent subtle logging mistakes. For example, consider the following code (missing
.log()):log.atInfo().setMessage("Some sample message")By marking the return value of all builder methods as “must be used,” the Kotlin compiler could emit warnings for incomplete fluent logging statements. This would make such issues detectable at compile time and improve the overall developer experience for Kotlin users working with fluent Log4j APIs.
You can get more information about this here: https://kotlinlang.org/docs/unused-return-value-checker.html
Beta Was this translation helpful? Give feedback.
All reactions