-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Suppress Warnings in Generated Code with @file:Suppress("REDUNDANT_VISIBILITY_MODIFIER")
#459
Comments
I attempted to add suppression annotations before but couldn't get them to work, PR welcoming if you can get this to work #267 (comment) |
As a more minor note your issue description is overly verbose. Would be quicker and easier to understand without the extra fluff. |
Sure, I'll give it a try after the holidays.
I'll keep it in mind for the next time. |
When using Kotlin Inject in a project configured with stricter compiler options, such as:
The following warning is generated for Kotlin Inject-generated code:
This warning appears because the generated code includes unnecessary visibility modifiers, which the stricter compiler options flag as redundant.
Proposed Solution
Add the annotation
@file:Suppress("REDUNDANT_VISIBILITY_MODIFIER")
at the top of each generated file to suppress this specific warning in generated code.This change would prevent these warnings from appearing when stricter compiler options like
extraWarnings.set(true)
are enabled, while not impacting other aspects of the generated code or its functionality.Example: Generated Code with Suppression
Here’s an example of how the annotation could be included in a generated file:
Benefits
extraWarnings
setting for the entire project.This small change will improve developer experience by ensuring Kotlin Inject-generated code does not cause unnecessary warnings in projects with stricter compiler settings.
The text was updated successfully, but these errors were encountered: