Jenkins Extension Annotations In Kotlin Do Not Work


#1

Implementing a Jenkins plugin, the “@Extension” annotation is used to define extension points. These work in Java, but do not work in Kotlin. I am unsure why. Here is a small snippet of the kotlin code:

class MySCM : SCM, Serializable
{
    @Extension
    class DescriptorImpl : SCMDescriptor(MySCM::class.java, MyRepoBrowser::class.java)
    {
        init
        {
            load()
        }
       ...
    }
    ...
}

#2

Since I believe the idea of the extension is to declare things that need to be implemented, I assume you would want to declare the class as open (non-final in Java-speak) along with the methods to be overridden.