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

KMP Kotlin-to-Java direct actualization #391

Open
nikitabobko opened this issue Sep 2, 2024 · 2 comments
Open

KMP Kotlin-to-Java direct actualization #391

nikitabobko opened this issue Sep 2, 2024 · 2 comments

Comments

@nikitabobko
Copy link
Member

nikitabobko commented Sep 2, 2024

This issue is for discussion of the proposed Kotlin-to-Java direct actualization. The full text of the proposal is here.

PR: #392

@kevin1e100
Copy link
Contributor

I'm a little unclear whether @KotlinActual annotations will be needed on methods and nested classes of classes that have that annotation? So for instance:

// COMMON
expect class Foo {
  fun bar()

  class Quux {}
}
@KotlinActual
public class Foo {
    @KotlinActual // (1) needed?
    public void bar() {...}

    public void baz() {...}

    @KotlinActual // (2) needed?
    public static class Quux {}
}

It would seem tedious to have to annotate (1) in particular, i.e., every method corresponding to a declaration in the expected class.

@nikitabobko
Copy link
Member Author

I'm a little unclear whether @KotlinActual annotations will be needed on methods and nested classes of classes that have that annotation?

Yes, both (1) and (2) will be needed. @KotlinActual in Java works similarly to actual keyword in Kotlin

It would seem tedious to have to annotate (1) in particular, i.e., every method corresponding to a declaration in the expected class.

I understand the concern. I agree that initially, it will be harder to commonize existing Java classes, but hopefully @KotlinActual will help in the long run with the error prevention and library maintenance https://github.com/Kotlin/KEEP/blob/kotlin-to-java-direct-actualization/proposals/kmp-kotlin-to-java-direct-actualization.md#actual-keyword-is-a-virtue

It's appealing to me that the annotation resembles actual keyword behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants