Skip to content

Kotlin: Respect override modifier in useless parameter query#9145

Merged
tamasvajk merged 2 commits intogithub:mainfrom
tamasvajk:kotlin-useless-param
May 17, 2022
Merged

Kotlin: Respect override modifier in useless parameter query#9145
tamasvajk merged 2 commits intogithub:mainfrom
tamasvajk:kotlin-useless-param

Conversation

@tamasvajk
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the Java label May 13, 2022
@tamasvajk tamasvajk marked this pull request as ready for review May 13, 2022 13:26
@tamasvajk tamasvajk requested a review from a team as a code owner May 13, 2022 13:26
@tamasvajk tamasvajk requested review from a team and igfoo and removed request for igfoo May 13, 2022 13:26
atorralba
atorralba previously approved these changes May 13, 2022
Copy link
Contributor

@atorralba atorralba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. OOC, why isn't this covered by not this.(Method).overridesOrInstantiates(_) in the charpred?

@tamasvajk
Copy link
Contributor Author

LGTM. OOC, why isn't this covered by not this.(Method).overridesOrInstantiates(_) in the charpred?

Good question, I haven't investigated this now, I just added the modifier check next to the java equivalent: this.getAnAnnotation() instanceof OverrideAnnotation. Also, I added two commits to show that the change does fix the issue. I vaguely remember that the overridesOrInstantiates check the signature of candidate methods, and for generics it doesn't always match.

@smowton
Copy link
Contributor

smowton commented May 13, 2022

Does the signature mismatching inhibit dataflow from spotting a possible callee of an overridden method? If so we should fix that

@tamasvajk
Copy link
Contributor Author

@smowton I've added an internal issue for this.

atorralba
atorralba previously approved these changes May 16, 2022
Copy link
Contributor

@atorralba atorralba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving under the assumption that we'll investigate and, if necessary, handle the dataflow issue in a separate PR.

@tamasvajk tamasvajk force-pushed the kotlin-useless-param branch from bdc5065 to 5ce2573 Compare May 16, 2022 12:47
@tamasvajk tamasvajk added the no-change-note-required This PR does not need a change note label May 16, 2022
@tamasvajk tamasvajk merged commit 350d137 into github:main May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants