|
| 1 | +== ADR 01: Plugin Programming Language |
| 2 | + |
| 3 | +[options="header"] |
| 4 | +|=== |
| 5 | +| Status | Date | Decided by |
| 6 | +| decided | 07.11.20 | rdmueller |
| 7 | +|=== |
| 8 | + |
| 9 | +=== Problem |
| 10 | + |
| 11 | +IntelliJ is JVM based and plugins can be written in one of many languages which create bytecode for the JVM. |
| 12 | +One of those languages have to be selected. |
| 13 | + |
| 14 | +=== Decision |
| 15 | + |
| 16 | +This plugin uses Kotlin as programming language. |
| 17 | + |
| 18 | +=== Alternatives |
| 19 | + |
| 20 | +==== Groovy |
| 21 | + |
| 22 | +As Ralf Müller (rdmueller) is mostly experienced in Groovy, he started to implement the plugin in Groovy. |
| 23 | +Since most plugin examples he tried to learn from, are written in Java, he soon switched over to Java. |
| 24 | + |
| 25 | +==== Java |
| 26 | + |
| 27 | +With the experience of Alexander Schwartz (ahus1) - the maintainer of the asciidoctor plugin for IntelliJ - we dropped Groovy and the first proof of concept has been implemented in Java. |
| 28 | + |
| 29 | +==== Kotlin |
| 30 | + |
| 31 | +When Henning Dieterichs (hediet)- the maintainer of the VS Code draw.io plugin - joined the project, he donated his knowledge about draw.io. |
| 32 | +Since IntelliJ is a jetbrains project and jetbrains switched to Kotlin some time ago, he switched to Kotlin as langauge for the plugin. |
| 33 | + |
| 34 | +Kotlin is a modern language which adds quite a few new features and shortcuts. |
| 35 | +Java Code can be easily transformed to Kotlin through the IntelliJ IDE (`Code` -> `Convert Java File to Kotlin file`). |
| 36 | + |
| 37 | +In addition, the starter template für new plugins is written in Kotlin and thus it is expected that the future will bring more plugins written in Kotlin. |
| 38 | + |
| 39 | +=== Consequences |
| 40 | + |
| 41 | +Contributors might have to learn the details of Kotlin wich might result in code which is not perfect Kotlin code. |
| 42 | + |
| 43 | +Since Kotlin is a relative new language, it seems to be harder to find code examples written in Kotlin. |
| 44 | +For the main code, this seems to be not a big deal, since you can convert Java to Kotlin (even automatically in Intellij via `Code` -> `Convert Java File to Kotlin file`). |
| 45 | +But for the Groovy DSL, this might be more of a problem. |
0 commit comments