Menu

#16 elib.prim.Queue.enqueue doesn't coerce

open
nobody
5
2001-08-16
2001-08-16
Anonymous
No

org.erights.e.elib.prim.Queue#enqueue(newElement) type checks its arg by storing it in a typed array. However, if this fails, it should try e-coercing it to the elementType and try again. The following shows the bug. The enqueue should have coerced the thunk to a Runnable rather than complaining.

? def QueueMaker := <unsafe:org.erights.e.elib.prim.Queue>
# value: <unsafe:org.erights.e.elib.prim.Queue>

? def Runnable := <import:java.lang.Runnable> asType()
# value: Runnable

? def q := QueueMaker new(Runnable)
# value: org.erights.e.elib.prim.Queue@6b7fcb

? q enqueue( thunk{ println("foo") } )
# problem: <ArrayStoreException>

Discussion


Log in to post a comment.

MongoDB Logo MongoDB