Kotlin 1.1.4 EAP

Unfortunately, the kotlin-noarg plugin started to break again and I am only now finding out… Although it is broken already since at least 1.1.4-eap-69, as far as I can backtrack now.

It took me a while to find the minimum reproduction scenario.

I have an @Entity class with 2 subclasses, something I have implemented with sealed classes similar to this:

@Entity
sealed class Demo(val name : String) {

    @Entity
    class Foo(name: String) : Demo(name)

    @Entity
    class Bar(name: String) : Demo(name)

}

(This is a very stripped down example and Hibernate will not actually load this class, but it’s sufficient for demonstrating the issue).

After processing this class with the kotlin-noarg plugin, I should be able to do:

val cls = Demo.Foo::class.java
val inst = cls.newInstance()

(Which is basically what Hibernate does when creating instances). This works with kotlin 1.1.3-2, but breaks in kotlin 1.1.4-eap-69, eap-77 and today’s final:

java.lang.NoSuchMethodError: com.example.sealedclassallopenissue.Demo.<init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V

at com.example.sealedclassallopenissue.Demo$Foo.<init>(SealedClassAllopenIssueApplication.kt)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)

I’ll raise the issue in YouTrack.

I’ve now raised it as issue KT-19687