Details
-
New Feature
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
This would provide the following advantages:
Conciseness - Kotlin code is overall much more concise than Java code. For instance, the following method in BooleanUtils:
public static Boolean negate(final Boolean bool) { if (bool == null) { return null; } return bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE; }
can be represented as a single line in Kotlin:
fun Boolean?.negate() = this?.not()
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:
val bool: Boolean? = null bool.negate() // returns null
Attachments
Issue Links
- links to