[#316] | project: compiler | priority: high | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Michel | _ | fixed | 2004-04-02 14:33:07.0 | |
subject | Anonymous classes get non-deterministic names | |||
code |
class MyIterator with Iterator[Int] { def hasNext = false; def next = 42; } object Test { def main(args: Array[String]): Unit = (new MyIterator) filter { x: Int => x == 1 }; } |
|||
what happened | When running the above example, one gets:Exception in thread "main" java.lang.NoClassDefFoundError: scala/Iterator$$anon$2 at MyIterator$class.filter(bug_anon.scala:114) at Test$.main(bug_anon.scala:8) at Test.main(bug_anon.scala:7) |
|||
what expected | A normal run. As discussed, the problem is related to the fact that we have a global counter to create fresh names (in FreshNameCreator) and this means that in two successive compilations some classes/methods can get different names. The fix is to remove all uses of FreshNameCreator. |
|||
[back to overview] |
Philippe edited on 2004-04-02 15:35:22.0 |
Moved FreshNameCreator from Global into Unit. |