[#150] | project: compiler | priority: high | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Stephane | Martin | not repro | 2003-09-26 18:12:51.0 | |
subject | ClassFormatError (Repetitive method name/signature) | |||
code |
import scala.collection.mutable.HashMap; class Vector[A] with Seq[A] { protected var indexMap = new HashMap[Int, A](); protected var len: Int = 0; def length: Int = len; def apply(n: Int): A = get(n) match { case None => error("element not found") case Some(value) => value } def get(n: Int): Option[A] = indexMap.get(n); def elements: Iterator[A] = indexMap.values; } object Main { def main(args: Array[String]) = { val v = new Vector[Int](); } } |
|||
what happened | Exception in thread "main" java.lang.ClassFormatError: scala/Seq$class (Repetitive method name/signature) at java.lang.ClassLoader.defineClass0(Native Method) [..] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at scala.collection.mutable.HashMap$class.initTable (sources/scala/collection/mutable/HashMap.scala:112) at scala.collection.mutable.HashMap$class. |
|||
what expected | no runtime error | |||
[back to overview] |
Stephane edited on 2003-09-26 18:22:11.0 |
Michel edited on 2003-09-29 12:45:18.0 |
This is apparently a bug of the code which loads the source file of classes which are compiled separately but used as mixins. My reason for stating that is that this bug does not appear when one compiles Seq.scala along with the file above, or when one disables separate compilation.
I don't know what the exact problem is, but the fact is that Seq.scala, when loaded separatly, confuses erasure, which adds two bridge methods for the isDefinedAt method. These are the duplicate methods reported above.
|
Martin edited on 2003-10-09 15:06:35.0 |
I tried with the latest version, and things run as they should. Maybe it got accidentally fixed in the meantime. |