Aladdin - Scala Bugtracking
[#332] project: compiler priority: high category: bug
submitter assigned to status date submitted
Burak Martin fixed 2004-05-14 12:00:42.0
subject [contrib #32] Compilation error with Java Swing code
code
Test.scala:

class Test extends javax.swing.JComponent {

}
what happened
Test.scala:1: class Test needs to be abstract, since method remove in trait java.awt.MenuContainer is not d\
efined
class Test extends javax.swing.JComponent {
       ^
one error found
what expected Successful compilation. I saw another bug report super interfaces that was deemed a feature, but I am not sure this is related. Defining a remove method does not solve the problem.
[back to overview]
Changes of this bug report
Burak  edited on  2004-05-14 12:01:40.0
Burak: Java overriding + overloading is the problem.
  • javax.swing.JComponent extends java.awt.Component (which define remove(MenuComponent))
  • java.awt.Component extends java.awt.Container (whiche defines remove(int) and remove(Component))
The problem is likely to be the same as bug#287 (which came from contrib#1)
Burak  edited on  2004-05-14 14:17:01.0
Here's another (scala) instance of the problem:
trait A {
  def foo(i:int) : unit ;
}


class B {
  def foo(i:int) = {}
}

// overloaded def shadows super's methods
class C extends B with A {
  def foo(s:String) = {} 
}
what happens:
testS.scala:11: class C needs to be abstract, since method foo in trait A is not defined
class C extends B with A {
      ^
one error found

Martin  edited on  2004-07-01 14:11:31.0