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

Forbid method names for built-in types #2576

Closed
vRallev opened this issue Apr 23, 2021 · 2 comments · Fixed by #2716
Closed

Forbid method names for built-in types #2576

vRallev opened this issue Apr 23, 2021 · 2 comments · Fixed by #2716

Comments

@vRallev
Copy link

vRallev commented Apr 23, 2021

Method names like

@BindsInstance public fun int(int: Int): Builder

are problematic and cause surprising errors. As @bcorso highlighted here Kapt seems to skip generating stubs for these method names. It would be great if Dagger could detect such scenarios.

@danysantiago
Copy link
Member

There is a feature request to prevent users from using Java keywords / identifiers when using KAPT but it seems it never got enough traction to be done. https://youtrack.jetbrains.com/issue/KT-25518

The current KAPT 'strictMode' does not error out when KAPT skips generating stubs due to usage of Java keywords.

Detecting this seems decently expensive, it means we would need to validate all elements with the information of the Metadata, looking for missing ones. However, this seem like an issue KAPT could prevent more easily.

@vRallev
Copy link
Author

vRallev commented Apr 23, 2021

Sounds fair, feel free to close this ticket if you think there's no work needed on your side.

copybara-service bot pushed a commit that referenced this issue Jul 14, 2021
Fixes #2576

RELNOTES=Check if user added methods have name that is a java reserved keyword.
PiperOrigin-RevId: 379896307
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants