Monday, May 11, 2020

Kotlin vs Java continued

Kotlin has support for a number of tools to help with the compilation and build. 

Annotation processing is fine with the help of kapt tool. A plugin for gradle by the name Kotlin-Kapt is also available. Key value pairs can be passed in to Kapt as arguments.

Kapt tasks can be run in parallel. It can also leverage gradle’s compile avoidance feature to skip notation processing altogether. This plugin is available in the jar form to make it easy to be run from the command line. 

The language fit documentation in Kotlin is Kdoc. It takes the comments preceding class and member declarations and converts it into documentation. 
There is a convention to be followed for those comments to appear in the docs the first line. Is usually a summary followed by a more detailed description and then the parameters and return types described. The latter is specified with the help of prefixes such as 
@param, @return, @constructor, @properties, @throws, @exception, @sample, @see, @author, @since,@suppress. Text can also include link to references on the same page by enclosing terms in square braces. Module and package annotation is made with declarations in a separate file and passed to a tool called Dokka.

Dynamic component system can be specified with the help of OSGI specifications. 

Components are packaged in bundles which communicate locally or via services across the gateway and hence the acronym for open services gateway interface.

 Kotlin offers support for this specification with the help of a separate Kotlin-Osgi-bundle library which replaces regular libraries such as Kotlin-runtime, kotlin-stdlib and Kotlin-reflect. The usual gradle tag to specify exclusions Aldo works for these above referenced libraries. The manifest requirement in other languages to specify the Osgi bundle is also possible in Kotlin but it is not sufficient. That option is certainly the most preferred way but it does not solve a well-known package split issue. 


No comments:

Post a Comment