Aladdin - Scala Bugtracking
[#1121] project: api priority: low category: feature
submitter assigned to status date submitted
Nikolay Sean fixed 2007-05-21 08:43:15.0
subject [contrib #512] make def underlying public in jcl.*
code
Please make all def underlying public in jcl.*, so it could be possible to write something like:

===
import scala.collection.jcl

// some external java library method that accepts j.u.Collection
def someJavaLibraryMethod(c: java.util.Collection) = ()

// my function that returns collection. I do not want to specify what concrete collection I return
def someMyFunction: jcl.CollectionWrapper[Int] = new jcl.ArrayList[Int]

val l = someMyFunction

someJavaLibraryMethod(l.underlying)
===

error: method underlying cannot be accessed in scala.collection.jcl.CollectionWrapper[Int]

This change will also make easier to write implicit converters from jcl collections to java.util collections.
what happened
what expected
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-05-21 08:44:15.0
Lex  edited on  2007-05-21 10:31:32.0

I don't know, that looks like a class use of "private" or "protected". If you start monkeying with the underlying collection directly, then the wrapped version can get confused.

For the specific case of getting a collection of a different type, it is best to create a new collection and copy the elements over. If the poster has other functionality desired, then please follow up and we can investigate ways to help support it.

Sean  edited on  2007-05-21 14:28:49.0
Changed in my local copy, will be fixed when I check into trunk.