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

Misleading representation of Java Varargs #2395

Open
tripolkaandrey opened this issue Mar 22, 2022 · 0 comments
Open

Misleading representation of Java Varargs #2395

tripolkaandrey opened this issue Mar 22, 2022 · 0 comments
Labels
bug language: Java Issue/PR related to the Java language feature/analysis/docs plugin: kotlin-as-java An issue/PR related to Dokka's kotlin-as-java plugin

Comments

@tripolkaandrey
Copy link
Contributor

tripolkaandrey commented Mar 22, 2022

Describe the bug
When generating documentation for a Java method which contains a varags argument Dokka interprets varargs as Array<T>. Documentation for

public B byId(String... ids) {
    this.ids = ImmutableSet.copyOf(ids);
    return self();
}

looks like that

public B byId(Array<String> ids)

I understand that JVM packs varargs in Array, but as an API reference, it is misleading. For instance, classic Javadoc explicitly states that a method expects a varargs parameter.

Expected behaviour
If a method contains a varargs parameter, documentation should explicitly state it. So for the provided above piece of code
documentation should be following

public B byId(String.... ids)

Screenshots
Classic Javadoc(expected behaviour):
Classic Javadoc

Output of the dokkaJavadoc task:
Dokka Javadoc

Output of the dokkaHtml task:
Dokka Html

Dokka configuration
I have added kotlin-as-java-plugin as I have a Java project. So nothing other than provided below and connecting Dokka to your project is not needed to reproduce the issue.

dependencies {
    dokkaPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.10")
}

Installation

  • Operating system: macOS
  • Build tool: Gradle v7.3.3
  • Dokka version: 1.6.10
@tripolkaandrey tripolkaandrey changed the title Incorrect processing of Java Varargs Misleading processing of Java Varargs Mar 22, 2022
@IgnatBeresnev IgnatBeresnev added the format: Javadoc An issue/PR related to Dokka's Javadoc output format or the Javadoc comments in general label Mar 22, 2022
@tripolkaandrey tripolkaandrey changed the title Misleading processing of Java Varargs Misleading representation of Java Varargs Mar 22, 2022
@IgnatBeresnev IgnatBeresnev added language: Java Issue/PR related to the Java language feature/analysis/docs plugin: kotlin-as-java An issue/PR related to Dokka's kotlin-as-java plugin and removed format: Javadoc An issue/PR related to Dokka's Javadoc output format or the Javadoc comments in general labels Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug language: Java Issue/PR related to the Java language feature/analysis/docs plugin: kotlin-as-java An issue/PR related to Dokka's kotlin-as-java plugin
Projects
None yet
Development

No branches or pull requests

2 participants