Kotlin logo

Kotlin

A concise multiplatform language developed by JetBrains

Tools

Eclipse Plugin Alpha is Out!

Kotlin support in IntelliJ IDEA has always been among our top priorities, but we have been working on Eclipse support as well, and today we are happy to present the first alpha result of this effort.

Although it’s only a start and many things will be improved over time, it already features

  • Building and Running Your Code
  • Java Interoperability
  • Code Highlighting
  • Debugging
  • Navigation
  • Basic Code Completion (Ctrl+Space)
  • Auto-Import
  • Unit Testing

Installation

To give it a try you will need a clean installation of Eclipse Luna. The Kotlin plugin is available from the Eclipse Marketplace. The easiest way to install the Kotlin plugin is to drag-and-drop this button into a running Eclipse window:

Drag to your running Eclipse workspace to install Kotlin Plugin for Eclipse

Alternatively, you can use Help -> Eclipse Marketplace… menu, or the following update site:

https://dl.bintray.com/jetbrains/kotlin/eclipse-plugin/last/

Our Tutorial describes the installation process in more details.

Eclipse IDE Support

Here we give a quick overview of the features available in this version.

Building Your Code

Kotlin compiler is integrated into Eclipse’s build process, as a result you can mix Kotlin and Java freely in one Eclipse project.

You can start by creating a new Kotlin project or adding a Kotlin file to an existing Java project. In either case Java classes are accessible from Kotlin and vice versa.

New Kotlin File in Context Menu

Diagnostics (errors and warnings) reported by Kotlin are displayed in the Problems View:

Problems View in Action

Editor

The basic editor features such as code highlighting and formatting are supported. Basic code completion is also supported, but it needs further improvements.

Auto-import for unresolved classes both from Java and Kotlin is already there:

Eclipse Auto-Import Feature

Many quick-fixes and intentions would be useful while editing Kotlin sources, and we will gradually add more and more of them. We started with the simple one for replacing get() calls with the indexing operator ([...]):

Replace 'get' With Index Operator

Navigation

Open Declaration is the only navigation action that is supported in this release:

Eclipse References

Also, you can navigate to declarations in Kotlin files with Outline View and search for Kotlin files by name in Open Resource window.

Debugger

With our plugin installed, Eclipse JDT debugger gets initial support for Kotlin. Again, there’s much to be improved, but you can

  • Set breakpoints in Kotlin code
  • Use Step in/over/out
  • View local variables and content of Kotlin objects

Eclipse Debug

Unit Testing

If you already have JUnit 3 or JUnit 4 in the classpath, you can write your tests in Kotlin. Run -> Run As -> Kotlin JUnit Test in the main menu starts testing and opens results in the JUnit View.

Eclipse Tests Demonstation

Eclipse Tests Result

Feedback Welcome

We could have continued implementing features one by one slowly making the plugin more and more stable and powerful. But instead we decided to show the early alpha hoping for the feedback. It is very important for us.

Some issues and feature-requests are already in our tracker. Please fill free to add more. Thanks.

Also, this is an open-source project, and we expect it to be even more of a community effort than our compiler and IntelliJ Plugin are, so your Pull Requests are very welcome.

image description