Aladdin - Scala Bugtracking
[#308] project: compiler priority: low category: bug
submitter assigned to status date submitted
Michel Martin won't fix 2004-03-15 16:34:26.0
subject Constant folder can prevent initialisation of objects
code
object O {
  val v = 10;
  System.out.println("hellO");
}

object Test {
  def main(args: Array[String]): Unit = {
    O.v;
  }
}
what happened
Nothing got printed.
what expected I expected (well, Erik expected, as he found the bug) "hellO" to be printed. But it's not, as the constant folder replaces the access to O.v by its value, which means that the class is not loaded.
[back to overview]
Changes of this bug report
Martin  edited on  2004-04-05 15:42:22.0