Skip to content

SYSTEM Cited by 1 source

J2K Converter

J2K (short for Java to Kotlin) is JetBrains' IntelliJ-bundled tool that translates a Java source file into Kotlin. Invoked in the IDE via "Convert Java File to Kotlin File" or the equivalent keyboard shortcut. Open-source at github.com/JetBrains/intellij-community/tree/master/plugins/kotlin/j2k.

Role in the wiki

J2K is the core translator that Meta's Kotlinator pipeline wraps. Kotlinator is "built around J2K"; the 200+ custom pre/post-processing steps exist specifically because "the vast majority of conversion diffs produced by the vanilla J2K would not build" at Meta's scale and with Meta's custom frameworks. That framing makes J2K a well-lit example of the single-button IDE tool that does not scale without surrounding infrastructure — useful, but insufficient by orders of magnitude.

Headless J2K (Meta contribution pattern)

J2K was historically tightly coupled to the IntelliJ UI. Meta collaborated with JetBrains' J2K maintainer (Ilya Kirillov) and built headless J2K: an IntelliJ plugin whose class extends ApplicationStarter and calls JavaToKotlinConverter directly from a server process with no UI. This enables parallel / remote / CI-friendly invocation — the unlock without which Kotlinator could not exist in its current form. See concepts/headless-ide-inspection.

K2 compiler port + client hooks (2024+)

Early 2024, JetBrains began adapting J2K to the new K2 Kotlin compiler. Meta used the opening to contribute:

  • Fixes for long-standing J2K bugs (e.g. "disappearing override keywords").
  • Client hooks allowing organisations to run their own pre/post-conversion steps inside the IDE / J2K instead of alongside it — giving the organisation steps access to J2K's more precise symbol resolution (especially for third-party libraries). See patterns/upstream-collaboration-as-migration-unblock.

Seen in

Last updated · 319 distilled / 1,201 read