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

Presence of a private backing field breaks having multiple Java setters #2992

Closed
owengray-google opened this issue May 3, 2023 · 0 comments · Fixed by #3002
Closed

Presence of a private backing field breaks having multiple Java setters #2992

owengray-google opened this issue May 3, 2023 · 0 comments · Fixed by #3002
Assignees
Labels
bug feedback: Google An issue/PR submitted by colleagues at Google, most likely related to the Android API reference docs language: Java Issue/PR related to the Java language feature/analysis/docs

Comments

@owengray-google
Copy link
Contributor

Describe the bug
The second assert fails:

@Test
    fun `Can have two setters in Java`() {
        var classlike = """
            |public class HasTwoSettersAndNoPrivateBackingField {
            |   public String setFoo(String foo) { return "Setter One"; }
            |   public String setFoo(String foo, String anotherArg) { return "Setter Two"; }
            |}
        """.render(java = true).page("HasTwoSettersAndNoPrivateBackingField").data.content
        var setListenerMethods =
            classlike.data.publicFunctionsSummary.data.items.filter { it.name() == "setFoo" }
        assertThat(setListenerMethods.size).isEqualTo(2)

        classlike = """
            |public class HasTwoSettersAndPrivateBackingField {
            |   private String foo;
            |   public String setFoo(String foo) { return "Setter One"; }
            |   public String setFoo(String foo, String anotherArg) { return "Setter Two"; }
            |}
        """.render(java = true).page("HasTwoSettersAndPrivateBackingField").data.content
        setListenerMethods =
            classlike.data.publicFunctionsSummary.data.items.filter { it.name() == "setFoo" }
        assertThat(setListenerMethods.size).isEqualTo(2)
    }

Expected behaviour
The second assert passes

Screenshots
Screenshot 2023-05-03 at 7 15 37 AM
Screenshot 2023-05-03 at 7 16 02 AM

Installation

  • Dokka version: 1.8.10-dev-203

This is very related to #2603

@IgnatBeresnev IgnatBeresnev added the language: Java Issue/PR related to the Java language feature/analysis/docs label May 19, 2023
@IgnatBeresnev IgnatBeresnev self-assigned this May 19, 2023
@IgnatBeresnev IgnatBeresnev added the feedback: Google An issue/PR submitted by colleagues at Google, most likely related to the Android API reference docs label May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feedback: Google An issue/PR submitted by colleagues at Google, most likely related to the Android API reference docs language: Java Issue/PR related to the Java language feature/analysis/docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants