Skip to content

Hilt ignores Suppress class annotations when generating code #2834

@kubak89

Description

@kubak89

When a class is annotated with @AndroidEntryPoint annotation the generated class doesn't have @Suppress annotation the original class has.

Steps to reproduce:

  • Create an android entry point class inheriting from a deprecated class and annotate it with @Suppress("deprecation"), e.g.
@AndroidEntryPoint
@Suppress("deprecation")
class FooService : JobIntentService() { ... }
  • Build project

Expected result

Generated class retains @Suppress annotation and no warnings are raised during build.

Actual result

Generated class doesn't have @Suppress annotation and warning is raised during the build process, e.g.

/**
 * A generated base class to be extended by the @dagger.hilt.android.AndroidEntryPoint annotated class. If using the Gradle plugin, this is swapped as the base class via bytecode transformation.
 */
public abstract class Hilt_FooService extends JobIntentService implements GeneratedComponentManagerHolder { ... }

with warning produced during build:

/<generated sources location>/Hilt_FooService.java:4: warning: [deprecation] JobIntentService in androidx.core.app has been deprecated
import androidx.core.app.JobIntentService;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions