New VS Code extension streamlines Java to Kotlin conversion, aiding developers in language transition.
To facilitate the adoption of its Kotlin programming language among Java developers, JetBrains has released a new Java to Kotlin converter extension for Microsoft’s Visual Studio Code editor. Kotlin, a well-established alternative to Java, is already widely utilized in Java environments, particularly in Android mobile app development.
Launched on February 19, the Java to Kotlin converter extension is now available for download from the Visual Studio Marketplace. This tool empowers developers to convert individual Java files into Kotlin code with a simple context menu action, significantly cutting down the manual effort involved in migrating older codebases or switching languages mid-project. According to JetBrains, the extension leverages the same robust engine found in their own IDEs and incorporates large language models (LLMs) to offer intelligent, idiomatic conversion suggestions, providing a seamless, one-click, review-and-commit Java to Kotlin migration directly within VS Code.
Alina Dolgikh, Kotlin product manager at JetBrains, stated that developers can expect high-fidelity conversions that adhere to Kotlin’s idiomatic expressions and syntax rules. She noted that the extension was developed in response to the widespread use of VS Code across diverse projects and tasks, even though JetBrains’s IntelliJ IDEA remains the primary IDE for Kotlin development.
The Java to Kotlin converter extension introduces the following configuration options within VS Code:
j2k.provider: Specifies the LLM backend for Java to Kotlin conversion. Default:GitHub Copilot.j2k.model: Defines the model tag to be used with the chosen provider. Default:codellama:instruct.j2k.ollama.baseUrl: Sets the base URL for the target instance when Ollama is selected as the provider.j2k.openRouter.baseUrl: Sets the base URL for the target instance when OpenRouter is selected as the provider.j2k.apiKey: The API key required by the selected provider (securely stored in VS Code Secrets).