[ 
https://issues.apache.org/jira/browse/LANG-1538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary D. Gregory closed LANG-1538.
---------------------------------
    Resolution: Won't Do

> Implement the functions of the Utils classes as Kotlin extension functions.
> ---------------------------------------------------------------------------
>
>                 Key: LANG-1538
>                 URL: https://issues.apache.org/jira/browse/LANG-1538
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Isira Seneviratne
>            Priority: Major
>
> This would provide the following advantages:
> Conciseness - Kotlin code is overall much more concise than Java code. For 
> instance, the following method in BooleanUtils:
> {code:java}
> public static Boolean negate(final Boolean bool) {
>     if (bool == null) {
>         return null;
>     }
>     return bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
> }
> {code}
> can be represented as a single line in Kotlin:
> {code:java}
> fun Boolean?.negate() = this?.not()
> {code}
> Compatibility with Java - Kotlin extension functions are compiled as static 
> methods in Java bytecode, so existing code that makes use of Apache Commons 
> Lang will not be affected by the conversion.
> Kotlin support - Extension functions can be called in Kotlin code as if they 
> were part of the original class declaration. For instance, the above method 
> can be called as follows:
> {code:java}
> val bool: Boolean? = null
> bool.negate() // returns null
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to