Skip to content

Private Java field with public accessors has private keyword in Kotlin signature #2439

@flyingfish162

Description

@flyingfish162

Describe the bug
I have a module mixed with java/kotlin classes in Android project. Generating docs with includeNonPublic set to false still adds Java non-public properties (that have public getter/setter specifically) to the output while their getter and setter not outputted.

Expected behaviour
Non-public properties not visible in the html output while their public getter and setter are visible.

Screenshots
Current generated doc page:
Screen Shot 2022-04-14 at 17 27 55
Screen Shot 2022-04-14 at 17 30 22

To Reproduce

  1. Create TestClass.java:
package com.example.test;

public class TestClass {
    private int a;
    int b;

    public int getA() {
        return a;
    }

    public void setA(int a) {
        this.a = a;
    }

    public int getB() {
        return b;
    }

    public void setB(int b) {
        this.b = b;
    }
}
  1. Run ./gradlew app:dokkaHtml
  2. Output should not contain a and b but public getter and setter

Dokka configuration
Configuration of dokka used to reproduce the bug

Module build.gradle:

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

apply from: 'kdoc.gradle'

kdoc.gradle:

apply plugin: "org.jetbrains.dokka"

dokkaHtml {
    outputDirectory.set(file("build/kdoc"))
    dokkaSourceSets {
        configureEach {
            includeNonPublic.set(false)
            skipEmptyPackages.set(true)
            jdkVersion.set(8)
            noAndroidSdkLink.set(true)
            noStdlibLink.set(true)
            noJdkLink.set(true)
        }
    }
}

Project build.gradle:

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20"
        classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.6.10")
    }
}

Installation

  • Operating system: macOS
  • Build tool: Gradle v7.2
  • Dokka version: 1.6.10

Additional context
I see this issue since Dokka version 1.4.32

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issueA beginner-friendly issue for which some assistance is expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions