Skip to content

scaladoc: hiding of protected and private members can have poor usability #12083

Open
@coreyoconnor

Description

@coreyoconnor

reproduction steps

Imagine you are trying to find how a method is available to a WordSpec in ScalaTest. A reasonable place to start is with the scaladoc for the wordspec trait:

problem

This looks like complete documentation for the word spec trait: There are the asserts, extension methods for should, ignore, skip etc. For a customer using this API this looks like complete documentation.

Unfortunately, we've hit two difficulties:

  1. Developers don't know that protected methods are hidden (See incomplete survey here )
  2. The appropriate interface in this context is different than actual.

Discussion

I think the first difficulty can be resolved with a small change to UI.

The second tho: The conflict is from the different expectations of two use cases:

  1. Using non-abstract classes from a library.
  2. Extending classes and traits from a library.

For the first use case hiding protected members by default is expected. Users are neither expected nor able to use those methods. Discovering how a class works is aided by showing protected members but that isn't the default activity.

For the second use case showing (specific?) protected members by default is expected. Developers implementing subtypes will expect the API they use (which includes protected members) to be the presented API.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions