Skip to content

[K2] Members of enum entry are not displayed #3129

@vmishenev

Description

@vmishenev

In K2 Dokka does not display members of enum entry, e.g. name and ordinal. if the body of an enum entry is empty (also see KT-61256 )

Dokka K2 will not display anonymous members of entry anymore. It does not make to have documentation for them since they are anonymous and unavailable outside of an enum entry's initializing anonymous object.
Pitfall: Overridden KDoc in an entry (anonymous classes) will not be displayed.

Example

enum class ProtocolState {
    WAITING {
       /*
       * Dokka will display the documentation from the super member on entry page.
       * In this example: `Some KDos`
       */
        override fun signal() = anonymousFun()
        /**
        * This member will be invisible in generated documentation
        */
        fun anonymousFun() =  TALKING
    },

    TALKING {
        override fun signal() = WAITING
    };
    /**
    * Some KDoc
    */
    abstract fun signal(): ProtocolState
}

So the Waiting entry-page will have the members:

  • val name
  • val ordinal
  • fun signal() Note: not override fun signal()
    Some KDoc

Motivation/Technical details
Dokka will get the required members from the enum class's scope since, e.g. the A enum entry in the enum E is

static val A: E = object : E() {
   val x: Int = 5
}

but it needs to exclude all static members like values and valueOf.
x cannot be visible outside the object's initializer and is an implementation detail

Metadata

Metadata

Assignees

Labels

bugtopic: K2Issues / PRs that are related to the K2 migration. See #2888

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions