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

add support for checking overrides for property getters/setters from Java code #93

Closed
yigit opened this issue Sep 30, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request P1 major features or blocking bugs
Milestone

Comments

@yigit
Copy link
Collaborator

yigit commented Sep 30, 2020

It is not possible right now to check if a Java class overrides a field declared in interface/class.

For instance:

            interface MyInterface {
                var y:Int
            }
            class JavaImpl implements MyInterface {
                public int getY() {
                    return 1;
                }
                public void setY(int value) {
                    
                }
            }

I want to check if getY in JavaImpl overrides the getter for val y in MyInterface.
I receive JavaImpl.getYas aKSFunctionDeclarationand forval y, all I have is a KSProperty (not even KSPropertySetter since it is an interface).

Right now, KSFunctionDeclaration.overrides expects a KSFunctionDeclaration.

It could be changed into recieve KSDeclaration but that won't let me distinguish between the setter and getter. It might make sense to have overrides for KSPropertySetter/Getter as well as overridesGetter(ksProperty), overridesSetter(ksProperty).

@neetopia neetopia self-assigned this Sep 30, 2020
@neetopia neetopia added the enhancement New feature or request label Sep 30, 2020
@neetopia neetopia added this to the 2020Q3 milestone Sep 30, 2020
@yigit
Copy link
Collaborator Author

yigit commented Sep 30, 2020

btw, the java processing version of this API receives a 3rd argument as the type in which override is checked:

https://docs.oracle.com/javase/7/docs/api/javax/lang/model/util/Elements.html#overrides(javax.lang.model.element.ExecutableElement,%20javax.lang.model.element.ExecutableElement,%20javax.lang.model.element.TypeElement)

The documentation lists some edge cases where it matters.

@ting-yuan ting-yuan added the P1 major features or blocking bugs label Oct 3, 2020
@ting-yuan ting-yuan modified the milestones: 2020Q3, 2020Q4 Oct 4, 2020
@neetopia neetopia closed this as completed Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P1 major features or blocking bugs
Projects
None yet
Development

No branches or pull requests

3 participants