Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-68091

Improve Kotlin interoparability

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • None
    • None
    • 1
    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      Problem Definition

      When using Kotlin to create a Jira plugin,  one runs into this problem very quickly:
      https://youtrack.jetbrains.com/issue/KT-19515

      The problem is, that Kotlin inheritance respects generics. There are many classes in the Jira source code and/or it's libraries that do not use generics and instead use the raw type.

      For example:

      • com.atlassian.jira.util.ErrorColleciton - uses Generics
      • webwork.action.ActionSupport - does not use Generics
      • This leads to a clash of signatures in com.atlassian.jira.web.action.JiraWebActionSupport:
        • setErrorMessages(Collection)
        • setErrorMessages(Collection<String>)
      • This is fine for the Java compiler. However, the Kotlin compiler is more strict here.
      • Thus, in Kotlin, just subclassing JiraWebActionSupport will lead to a compile error

      Suggested Solution

      • The problem cannot be fixed at client/call side (the plugin).
      • Adaption of the Jira source code and it's dependencies is necessary.
      • Specifically, scan all Java files and add missing generics.
      • Specifically, webwork-1.4-atlassian-30.jar should have generics added (or rather, it should be replaced with a 1.5 version of the library), as this contains the often needed Action base classes.
      • There should not be anything blocking adding generics going forward, as Jira already requires Java 1.8 as stated on "Supported platforms" page

      Why this is important

      Kotlin is picking up momentum and it can be expected that more and more plugins will be created with Kotlin

      Kotlin was on the "Adopt" stage of the Atlassian Tech Radar this year. So if we shall adopt, let's make it as smooth as possible

      Workaround

      Whenever you need to extend a Jira base class that will lead to such a compile error in Kotlin, create the subclass as a Java class instead.

      Attachments

        Activity

          People

            Unassigned Unassigned
            12344ae2-22b7-4631-9675-b1b6a210c937 Deleted Account (Inactive)
            Votes:
            64 Vote for this issue
            Watchers:
            27 Start watching this issue

            Dates

              Created:
              Updated: