Skip to content

wrong number of arguments at crossCast - trait extends java.awt.Window - constructor #9780

Closed
@Sciss

Description

@Sciss

Minimized code

From scala-swing:

import java.awt.event.WindowEvent
import java.awt.{Window => AWTWindow}

abstract class Window {
  def peer: AWTWindow with InterfaceMixin

  protected trait InterfaceMixin extends javax.swing.RootPaneContainer

  protected trait SuperMixin extends AWTWindow {
    override protected def processWindowEvent(e: WindowEvent): Unit = {
      super.processWindowEvent(e)
      if (e.getID == WindowEvent.WINDOW_CLOSING)
        closeOperation()
    }
  }
  
  def closeOperation(): Unit = ()
}

Output

compilation fails with

dotc: wrong number of arguments at crossCast for (x$0: java.awt.GraphicsConfiguration): java.awt.Window: (java.awt.Window#<init> : (x$0: java.awt.GraphicsConfiguration): java.awt.Window
  ), expected: 1, found: 0

Expectation

Should work as in Scala 2.12, 2.13. I does work for types other than java.awt.Window, for example javax.swing.JComponent, probably an issue due to the overloaded constructor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions