[#898] | project: compiler | priority: low | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Sean | Martin | fixed | 2007-01-17 14:04:37.0 | |
subject | verify error when creating nested class instance during constructor call | |||
code |
package test; object Test { abstract class SortedSetWrapper[A] { def underlying : java.util.TreeSet; } class TreeSet[A <% Ordered[A]](val underlying : java.util.TreeSet) extends SortedSetWrapper[A] { private class Comparator extends java.util.Comparator { def compare(x0 : Any, x1 : Any) = x0.asInstanceOf[A].compare(x1.asInstanceOf[A]); } def this() = this(new java.util.TreeSet(new Comparator)); } def main(args : Array[String]) : Unit = new TreeSet[String]; } |
|||
what happened | n execute:Exception in thread "main" java.lang.VerifyError: (class: test/Test$TreeSet, method: |
|||
what expected | A compiler error. | |||
[back to overview] |
Iulian edited on 2007-01-22 11:21:11.0 |
This is very similar to bug #908: the call to 'new Comparator' as argument to another constructor is illegal since it needs an outer instance, which is really the object being constructed (uninitialized). As bug #908, this exists only in the svn repository (the current release points out the error). |
Martin edited on 2007-01-23 16:18:33.0 |
This is a duplicate of 908. |