I document all of the parameters/properties in my ...
# dokka
e
I document all of the parameters/properties in my constructor, but they don’t show up in the generated kdoc. Is this working as intended?
k
I don’t think so. Could you show me your code and generated docs? (If the bug is that bad then screenshots will probably suffice)
e
Here’s how the class starts:
Copy code
/**
 * A class that can be run on two devices to allow them to connect. This supports sending a single
 * message at a time in each direction. It contains internal synchronization and may be accessed
 * from any thread.
 *
 * @constructor Constructs a new connection, which will call [NearbyConnectionObserver.onStateUpdated]
 *     with an argument of type [ConnectionState.Isolated]. No further action will be taken unless
 *     other methods are called by the client.
 * @property context context needed to initiate connection, used only at start
 * @property name name shown by this device to other devices
 */
class NearbyConnection(
    private val context: Context,
    private val name: String = Build.MODEL
) : Observable<NearbyConnectionObserver> by ObserverRegistry() {
My guess is the problem is that the properties are marked private, but the caller should still need to know what they’re supposed to be.
Here’s how it looks in the browser:
k
Yes, that’s true - it’s because of the visibility. You can use the configuration option
includeNonPublic
to have it documented
We should do something about this though
e
Thanks for letting me know, @Kamil Doległo. This is the first thing I like better about Java than Kotlin.
k
Oh, I’ve missed something (sorry, it’s late). You can just change your docs from
@property
to
@param
e
I thought I tried that, but I’ll try again.
k
That’s because private properties are not documented, but in fact you want to document the parameters
The params should be visible on the constructor page
e
Ah yes, if I click through. I hadn’t realized that I needed to do that. Thank you.
I see that’s true for ordinary methods as well. My bad! I expected parameters to be documented on the main page.
k
No problem. Yeah, it’s done like that for consistency with ordinary methods. Documenting parameters on the main page would also be a problem for more constructor parameters, secondary constructors and so on. Although I see some ways to make that better, I’ll think of that
🙏 1
e
It sounds like you’re heavily involved in dokka. You rock!
k
Thanks! I try to do my best 😉