Aladdin - Scala Bugtracking
[#287] project: specification priority: low category: missing feature
submitter assigned to status date submitted
Burak Martin fixed 2004-01-27 15:27:16.0
subject [contrib #1] overridden methods ("inheritance does not work")
code
object testBuf {
  class mystream extends java.io.BufferedOutputStream(new java.io.FileOutputStream("/dev/null")) {
    def w( x:String ):Unit = {
      val foo = new Array[byte](2);

      // write( byte[] ) is defined in FilterOutputStream, the superclass of BufferedOutputStream
      super.write( foo ); // error

      super.write( foo, 0, foo.length ); // this works however
    }
  }
}
what happened
/home/hejira> scalac -d /tmp /tmp/testBuf.scala
/tmp/testBuf.scala:7: type mismatch;
 found   : scala.Array[scala.Byte]
 required: scala.Int
      super.write( foo ); // error
                   ^
one error found
what expected no error
[back to overview]
Changes of this bug report
Burak  edited on  2004-01-27 15:28:54.0
This is indeed not normal behaviour is it ? It was shortly discussed in a Scala meeting. All names, also overridden ones of a Java class, should be visible to Scala, no ?
Martin  edited on  2004-04-05 15:48:52.0
Martin  edited on  2004-04-18 12:17:16.0
The (open) question is whether we can change our overloading behavior to more closely resemble Java's.
Martin  edited on  2004-07-01 15:36:50.0
I fixed the compiler to accept this case, by adding inherited overloaded methods.
Martin  edited on  2004-07-01 15:37:28.0