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

public members of non-API supertype should be visible in the inheritor #217

Open
dovchinnikov opened this issue Apr 10, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@dovchinnikov
Copy link

Example 1

@PrivateApi
class KtPrivateApi {
  fun foo() = Unit
}

class KtPublicApi : KtPrivateApi() {
}

fun usage() {
  KtPublicApi().foo() // ok, if @PrivateApi applies only for the class declaration but not its members
}

Example 2

This is not applicable for Kotlin, but should be supported in a library, which has compiled classes as input.

class JavaPackagePrivateClass { 
    public void foo() {} 
}
public class JavaPublicClass extends JavaPackagePrivateClass {
  
}

void usage() {
  new JavaPublicClass().foo(); // accessible 
}

For IJ, I've implemented this here:
https://github.com/JetBrains/intellij-community/blob/f8819a2580a0cc6c2f6a456a6a5fa83bf2e3cf7e/tools/apiDump/src/impl.kt#L134

Also please take a look at supertype expansion:
https://github.com/JetBrains/intellij-community/blob/f8819a2580a0cc6c2f6a456a6a5fa83bf2e3cf7e/tools/apiDump/src/impl.kt#L340
It solves this problem:

// not covered the case when there is public superclass after chain of private superclasses

@dovchinnikov dovchinnikov changed the title public members of non-API super type should be visible in the inheritor public members of non-API supertype should be visible in the inheritor Apr 10, 2024
@fzhinkin fzhinkin added the bug Something isn't working label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants