Aladdin - Scala Bugtracking
[#32] project: specification priority: medium category: missing feature
submitter assigned to status date submitted
Stephane Martin fixed 2003-06-10 12:57:41.0
subject cannot override
code
import java.io._;

class PromptStream(s: OutputStream) extends PrintStream(s) {
    override def println() = super.println();
}

object Main {

    val out = new PromptStream(System.out);

    System.setOut(out);

    def main(args: Array[String]) =
        out.println("hello world");

}
what happened
Main.scala:6: method println in class PromptStream of type ()scala.Unit
 cannot override value println in class java.io.PrintStream of type ()scala.Unit  (scala.Boolean)scala.Unit\
  ....
    override def println() = super.println();
                 ^
Main.scala:16: wrong number of arguments for method println()
        out.println("hello world");
                   .^
two errors found.
what expected "hello world" is printed out (as in Java)
[back to overview]
Changes of this bug report
Martin  edited on  2003-07-04 16:53:18.0
Martin  edited on  2003-07-10 15:42:40.0
Matthias  edited on  2003-10-06 12:33:23.0
I closed this bug because Martin addressed this issue already. In order to make the code above compile, you have to explicitly type variable out though:
val out: PrintStream = new PromptStream(System.out);
Matthias  edited on  2003-10-06 12:34:11.0