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

KSDeclaration.isOpen for interfaces returns false #6

Closed
yigit opened this issue Sep 7, 2020 · 0 comments
Closed

KSDeclaration.isOpen for interfaces returns false #6

yigit opened this issue Sep 7, 2020 · 0 comments
Assignees

Comments

@yigit
Copy link
Collaborator

yigit commented Sep 7, 2020

The isOpen check for an interface returns false but i think it should return true since isOpen can be used to check if something can be overridden / extended.

the following code assumes KSDeclaration is NOT as it only checks for parent for checking interfaces, not the declaration itself.

fun KSDeclaration.isOpen() = !this.isLocal()
        && (this.modifiers.contains(Modifier.OVERRIDE)
        || this.modifiers.contains(Modifier.ABSTRACT)
        || this.modifiers.contains(Modifier.OPEN)
        || (this.parentDeclaration as? KSClassDeclaration)?.classKind == ClassKind.INTERFACE
        || (!this.modifiers.contains(Modifier.FINAL) && this.origin == Origin.JAVA)
        )

@neetopia neetopia self-assigned this Sep 8, 2020
@davidjwiner davidjwiner transferred this issue from android/kotlin Sep 25, 2020
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