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

Unable to hide/suppress k-doc in mixed(java+kotlin) project #2227

Closed
macharya opened this issue Nov 16, 2021 · 5 comments
Closed

Unable to hide/suppress k-doc in mixed(java+kotlin) project #2227

macharya opened this issue Nov 16, 2021 · 5 comments
Labels
question A user question, can be resolved if the question is answered/resolved

Comments

@macharya
Copy link

macharya commented Nov 16, 2021

In my project, I've both kotlin and java files, I am trying to hide a package, I tried @hide @hidden @Suppress still cant hide a java class or public method. Added following 3 libs to my build.gradle and nothing seems to work. Also, what's the right way to use the package option in build.gradle not .kts. followed #492 but that did not solve this problem. Any help?

classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.30"
classpath "org.jetbrains.dokka:kotlin-as-java-plugin:1.4.30"
classpath "org.jetbrains.dokka:android-documentation-plugin:1.4.30"
@macharya macharya added the question A user question, can be resolved if the question is answered/resolved label Nov 16, 2021
@vmishenev
Copy link
Member

vmishenev commented Nov 17, 2021

You can use @hide with android-documentation-plugin to hide a method/class from the documentation in Java.
Support of a package level will be in Dokka 1.6. (#2206)

Now matchingRegex can be used to hide a package. See example

Update
@suppress is only for Kotlin.

@bashbug
Copy link

bashbug commented Nov 17, 2021

I have the same issue with dokka 1.5.31

Problem
@hide works for all java functions/classes/etc. Except for functions which have a return value.

How to reproduce
Add to https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-kotlinAsJava-example/src/main/kotlin/demo the following java class.

  • setB() is hidden.
  • getA() is shown, even with the @hide tag
public class JavaClass {
    private String a;
    private String b;
    JavaClass(String a){
        this.a = a;
    }

    /**
     * @hide
     */
    public void setB(String b) {
        this.b = b;
    }

    /**
     * @hide
     */
    public String getA() {
        return a;
    }
}

Is this also fixed @vmishenev with the upcoming 1.6 release?

@macharya
Copy link
Author

@bashbug how is @hide working for your java classes/methods? I tried 1.5.31 and still can't hide the java methods or class. Tried all three of these but no luck

classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.5.31"
classpath "org.jetbrains.dokka:kotlin-as-java-plugin:1.5.31"
classpath "org.jetbrains.dokka:android-documentation-plugin:1.5.31"

@vmishenev
Copy link
Member

@bashbug I suppose this fix will be in the next version after Dokka 1.6.
Dokka handles setB and getA as a setter and a getter so #2158 will fix the bug.
@macharya Can you share your project configuration and code sample with @hide?

@CharlesG-Branch
Copy link
Contributor

CharlesG-Branch commented Nov 20, 2021

@macharya I recently ran into a similar issue — was able to resolve the issue by doing:

buildscript {
    //...
    dependencies {
        //...
        classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.30"
    }
}

Then

dependencies {
    dokkaJavadocPlugin("org.jetbrains.dokka:android-documentation-plugin:1.4.30")
    //...
}

@vmishenev I think including the above in https://github.com/Kotlin/dokka/tree/master#android would go a long way in clearing up confusion.

CharlesG-Branch added a commit to CharlesG-Branch/dokka that referenced this issue Feb 17, 2022
This is in response to this comment Kotlin#2227 (comment)
We spent a fair amount of time trying to figure out why it wasn't working for us & putting this extra line
in the documentation would've saved us a lot of time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A user question, can be resolved if the question is answered/resolved
Projects
None yet
Development

No branches or pull requests

4 participants