Aladdin - Scala Bugtracking
[#100] project: compiler priority: high category: bug
submitter assigned to status date submitted
Matthias Michel fixed 2003-09-02 15:44:27.0
subject Illegal code (array related?)
code
object FOO {
  def foo(x: scala.Object) = {
    System.out.println(x.isInstanceOf[scala.Object]);
  }
  def main(args: Array[String]) = {
    foo(args);
  }
}
what happened
Compiles, but is not executable. The verifier complains:
Exception in thread "main" java.lang.VerifyError: (class: FOO$, method: main signature: ([Ljava/lang/String;)V) \
Incompatible argument to function
        at FOO.main(A.scala)
what expected Compiler, runtime positive?

Maybe we should reconsider to place arrays at a different place in the inheritance hierarchy. I would have guessed that they are direct subclasses of AnyRef. But obviously, they are subclasses of scala.Object. This is really a bit weired, because in Java they are direct subtypes of java.lang.Object.

[back to overview]
Changes of this bug report
Matthias  edited on  2003-09-02 15:45:06.0
Shall we celebrate bug number 100? ;-)
Burak  edited on  2003-09-23 18:29:23.0
changed priority. let's rather celebrate fixed bug number 100 !
Michel  edited on  2003-09-29 17:11:11.0
Currently, the class scala.Array is a subclass of java.lang.Object, which is apparently not what the typechecker belives. A simple fix for this bug is therefore to change scala.Array to make it inherit from scala.Object and this is what I did. But we should discuss that further.