Suppress annotation on @Inject is not honored on the Factory
BraisGabin opened this issue · 1 comments
BraisGabin commented
I have a class that needs to inject a deprecated class. It looks like this:
public class Foo {
@Inject
@SuppressWarnings("deprecation")
Foo(DeprecatedClass foo) {
}
}
The generated Foo_Factory
doesn't add the @SuppressWarning
for "deprecation"
:
@ScopeMetadata
@QualifierMetadata
@DaggerGenerated
@Generated(
value = "dagger.internal.codegen.ComponentProcessor",
comments = "https://dagger.dev"
)
@SuppressWarnings({
"unchecked",
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
})
public final class Foo_Factory implements Factory<Foo> {
private final Provider<DeprecatedClass> fooProvider;
public Foo_Factory(Provider<DeprecatedClass> fooProvider) {
this.fooProvider = fooProvider;
}
// ...
This prevents me to run java with -Werror
active. I found that this feature exist on Hilt for other cases or at least that's what I understand from #2834.
Something similar happens when the deprecated class has the @Inject
. The Factory also contains warning. Example:
@Deprecated("Don't use, please")
class DeprecatedClass @Inject constructor()
I found out this last one while writing this snippets for this issue so I don't care that much about it. And I'm not sure if it should be tracked in this issue or open a new one.