Inheritance from Java class

I'm trying to make a Kotlin class that inherent from the JFrame class.

In Java it would be something like this code snippet

public class MyFrame extends JFrame {

  public MyFrame() {

  }
  
}


How would I do this in Kotlin? I have tried to inherent like:

import java.awt.;
import java.awt.event.
;
import javax.swing.*

open class MyFrame() : JFrame() {

}

and

import java.awt.;
import java.awt.event.
;
import javax.swing.*

open class MyFrame() : JFrame {


}

I get an error like:

java.lang.AssertionError: Rewrite at slice CONSTRUCTOR key: PsiMethod:Cause old value: ctor Cause() defined in <module>.<root>.sun.awt.CausedFocusEvent.Cause[ConstructorDescriptorImpl@3f30a8]@4141224 new value: ctor Cause() defined in <module>.<root>.sun.awt.CausedFocusEvent.Cause[ConstructorDescriptorImpl@1f2054a]@32638282
  at org.jetbrains.jet.util.slicedmap.Slices$1.processRewrite(Slices.java:36)
  at org.jetbrains.jet.util.slicedmap.SlicedMapImpl.put(SlicedMapImpl.java:64)
  at org.jetbrains.jet.lang.resolve.BindingTraceContext.record(BindingTraceContext.java:69)
  at org.jetbrains.jet.lang.resolve.ObservableBindingTrace.record(ObservableBindingTrace.java:56)

  etc.

I’m probably overlooking something simple here. But does anyone have any ideas?

Hi,

This code works fine in the latest build:

``

import java.awt.;
import java.awt.event.
;
import javax.swing.*

open class MyFrame() : JFrame() {

}

fun main(args : Array<String>) {
  MyFrame().setVisible(true)
}

Please, update to the nightly build, see instructions here: http://confluence.jetbrains.net/display/Kotlin/Getting+Started

Thanks for the very quick response!