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

[K2] Methods implemented by delegation miss the override keyword and KDoc #3384

Closed
atyrin opened this issue Nov 29, 2023 · 4 comments · Fixed by #3566
Closed

[K2] Methods implemented by delegation miss the override keyword and KDoc #3384

atyrin opened this issue Nov 29, 2023 · 4 comments · Fixed by #3566
Assignees
Labels
bug topic: K2 Issues / PRs that are related to the K2 migration. See #2888
Milestone

Comments

@atyrin
Copy link
Contributor

atyrin commented Nov 29, 2023

interface CookieJar {
    /**
     * Saves cookies
     */
    fun saveFromResponse(url: String)
}

class CookieJarImpl() : CookieJar {
    override fun saveFromResponse(url: String) {}
}

class JavaNetCookieJar private constructor(
    delegate: CookieJarImpl,
) : CookieJar by delegate

With K1 the JavaNetCookieJar got override keyword and kdoc from the interface
image


In K2 both are missed:
image

Installation

  • Dokka version: 1.9.20

Parent: #3328

@atyrin atyrin added bug topic: K2 Issues / PRs that are related to the K2 migration. See #2888 labels Nov 29, 2023
@IgnatBeresnev
Copy link
Member

We consider K1's behaviour to be correct in this case, so there should be the override keyword.

@vmishenev
Copy link
Member

It can be implemented on Dokka's side.
See K1 implementation for descriptors:
https://github.com/JetBrains/kotlin/blob/5fba2962b9b5f6cb105fcd81dbd5f259cdd0db1d/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java#L138

    public static boolean isOverride(@NotNull CallableMemberDescriptor descriptor) {
        return !descriptor.getOverriddenDescriptors().isEmpty();
    }

@vmishenev
Copy link
Member

vmishenev commented Jan 8, 2024

Currently, in K2 members implemented by delegation have their own pages and have no KDoc.
In K1 they refer to overriden declarations.

It is blocked by https://youtrack.jetbrains.com/issue/KT-64833/Analysis-API-Members-implemented-by-delegation-have-no-overridden-symbols to implement it like in K1.

Also related: #3196

@vmishenev vmishenev changed the title [K2] Methods implemented by delegation miss the override keyword [K2] Methods implemented by delegation miss the override keyword and KDoc Jan 13, 2024
@IgnatBeresnev IgnatBeresnev added the upstream bug An issue that appears due to an upstream dependency bug, such as kotlin-compiler label Jan 19, 2024
@IgnatBeresnev
Copy link
Member

This has been unblocked and fixed upstream, just need to check it and write a test.

Note: in K2 if a class inherits a function from an interface, clicking on this function in the child should lead to the interface.

The PR #3440 can be resurrected, but not necessarily

@IgnatBeresnev IgnatBeresnev removed the upstream bug An issue that appears due to an upstream dependency bug, such as kotlin-compiler label Apr 5, 2024
@IgnatBeresnev IgnatBeresnev added this to the Dokka 2.0.0 milestone Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug topic: K2 Issues / PRs that are related to the K2 migration. See #2888
Projects
None yet
3 participants