In association with heise online

12 December 2012, 10:17

Fourth Kotlin milestone adds annotation tool

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

Kotlin logo Following the resolution of 128 issue reports, Kotlin M4 is now available to download. Among other improvements, the programming language, which has been designed as an alternative to Java by Czech software house JetBrains, now features improved compatibility with Java Development Kit 7 (JDK 7).

Another new feature is KAnnotator, which was written in Kotlin and is able to automatically annotate included libraries. KAnnotator essentially infers annotations from libraries stored in jar format and writes them to XML files. Annotations for methods and fields can then be added to projects and are visible to both the Java IDE and the Kotlin compiler. The tool is still at an early stage of development, but should, according to developer Andrey Breslav, rapidly improve.

Data classes were introduced in Kotlin M3 and, following a number of requests, instances of classes can now be copied and their properties modified without modifying the object. Sample code illustrating this can be found in a blog post.

data class Person(val firstName: String, val lastName: String)

fun Person.asMarried(newLastName: String)
= this.copy(lastName = newLastName)

Other new functions include support for deprecation and improvements to the IDE, such as more help resolving code errors. All of the changes and sample use cases can be found in the release announcement.

IntelliJ IDEA 12 is required to install the Kotlin plugin. Once this is in place, Kotlin M4 can be accessed via the plugin repository. Alternatively, the source code is available on GitHub and is licensed under the Apache Licence version 2.

See also:


Print Version | Send by email | Permalink:

  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit