scala / scala-swing

Scala wrappers for Java's Swing API for desktop GUIs
Apache License 2.0
134 stars 48 forks source link

Add support for Dotty #122

Closed Sciss closed 4 years ago

Sciss commented 4 years ago

Add a build for latest Dotty (as of this writing 0.27.0-RC1), and then publish an artifact.

Sciss commented 4 years ago

WIP here: https://github.com/Sciss/scala-swing/tree/dotty

Sciss commented 4 years ago

Currently stopped by https://github.com/lampepfl/dotty/issues/9780

Sciss commented 4 years ago

Compiles with Scala 3.0.0-M1. As soon as ScalaTest is published, I guess I can submit a PR, and we can publish a new stable version.

Sciss commented 4 years ago

ScalaTest is there now. Running into problems with reflective calls (structural types):

// object Action
    trait Wrapper extends Action.Trigger {
      def peer: javax.swing.JComponent {
        def addActionListener(a: ActionListener): Unit
        def removeActionListener(a: ActionListener): Unit
        def setAction(a: javax.swing.Action): Unit
        def getAction(): javax.swing.Action // note: must keep empty parentheses for Java compatibility
      }

      private var _action: Action = Action.NoAction
      def action: Action = _action
      def action_=(a: Action): Unit = { _action = a; peer.setAction(a.peer) }

when I call action_=, it gives


[error] Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: scala
[error]     at scala.swing.package$.reflectiveCalls(package.scala:93)
[error]     at scala.swing.Action$Trigger$Wrapper.action_$eq(Action.scala:41)
[error]     at scala.swing.Action$Trigger$Wrapper.action_$eq$(Action.scala:30)
[error]     at scala.swing.AbstractButton.action_$eq(AbstractButton.scala:25)
...
Sciss commented 4 years ago

PR ready now: https://github.com/scala/scala-swing/pull/124

Sciss commented 4 years ago

fixed in #124