Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review scala.collection public members #11433

lrytz opened this Issue Feb 5, 2018 · 2 comments


None yet
4 participants
Copy link

lrytz commented Feb 5, 2018

At some point before shipping we should review public types / methods in the collection package. The following can be pasted in the repl:


import symtab.Flags

def packagesIn(p: Symbol): List[Symbol] = {
  val ps =, Flags.PACKAGE).toList
  ps ::: ps.flatMap(packagesIn)

val collP = rootMirror.getPackage(TermName("scala.collection"))
val allPackages = collP :: packagesIn(collP)

def packageMembers(p: Symbol) = {
  // removes non-existing members from the scope (List$) => !m.isPackage)

val msInPackages = => (p, {
  val ms = packageMembers(p)
  ms.groupMap(m => m.accessString)(m => {
    val typeMs = => !m.isSynthetic)
    (m, typeMs.groupBy(m => m.accessString))

for ((p, packageMsByAccess) <- msInPackages) {
  for ((pa, pms) <- packageMsByAccess) {
    val paa = if (pa.isEmpty) "<public>" else pa
    println(s"  $paa:")
    for ((m, typeMsByAccess) <- pms) {
      println(s"    $m:")
      for ((ta, tms) <- typeMsByAccess) {
        val taa = if (ta.isEmpty) "<public>" else ta
        println(s"      $taa:")
        println(tms.mkString("        ", "\n        ", ""))

Example output: - can be improved :)


This comment has been minimized.

Copy link
Member Author

lrytz commented Feb 5, 2018

We should also convert the above code to a partest test to make sure no public members are added accidentially.

@SethTisue SethTisue self-assigned this Nov 16, 2018

@SethTisue SethTisue transferred this issue from scala/collection-strawman Feb 20, 2019

@adriaanm adriaanm transferred this issue from scala/scala-dev Mar 13, 2019

@adriaanm adriaanm changed the title Review public members Review scala.collection public members Mar 13, 2019

@adriaanm adriaanm added this to the 2.13.0-RC1 milestone Mar 13, 2019


This comment has been minimized.

Copy link

joshlemer commented Mar 15, 2019

It would also be handy to include the exposed type of each member, so that nobody accidentally exposes/commits to a return type that's more specific than it should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.