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

Hilt ignores Suppress class annotations when generating code #2834

Closed
kubak89 opened this issue Sep 1, 2021 · 2 comments
Closed

Hilt ignores Suppress class annotations when generating code #2834

kubak89 opened this issue Sep 1, 2021 · 2 comments

Comments

@kubak89
Copy link

kubak89 commented Sep 1, 2021

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;
@kubak89
Copy link
Author

kubak89 commented Sep 1, 2021

I've also tried to use @Suppress annotation before JobIntentService() constructor call like shown below, but that also didn't help

@AndroidEntryPoint
class FooService : @Suppress("deprecation") JobIntentService() { ... }

@wanyingd1996
Copy link

Hi, a change supports copying the Suppress annotation will be shipped in a day or two.

copybara-service bot pushed a commit that referenced this issue Sep 30, 2021
…ting values from Kotlin @Suppress annotations.

This CL also adds regression tests that contain @androidentrypoint classes that use Kotlin @Suppress.

Fixes #2834

RELNOTES=Fix #2834:Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations.
PiperOrigin-RevId: 399945204
copybara-service bot pushed a commit that referenced this issue Sep 30, 2021
…ting values from Kotlin @Suppress annotations.

This CL also adds regression tests that contain @androidentrypoint classes that use Kotlin @Suppress.

Fixes #2834

RELNOTES=Fix #2834:Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations.
PiperOrigin-RevId: 399945204
copybara-service bot pushed a commit that referenced this issue Sep 30, 2021
…ting values from Kotlin @Suppress annotations.

This CL also adds regression tests that contain @androidentrypoint classes that use Kotlin @Suppress.

Fixes #2834

RELNOTES=Fix #2834:Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations.
PiperOrigin-RevId: 399945204
copybara-service bot pushed a commit that referenced this issue Sep 30, 2021
…ting values from Kotlin @Suppress annotations.

This CL also adds regression tests that contain @androidentrypoint classes that use Kotlin @Suppress.

Fixes #2834

RELNOTES=Fix #2834:Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations.
PiperOrigin-RevId: 399945204
copybara-service bot pushed a commit that referenced this issue Sep 30, 2021
…ting values from Kotlin @Suppress annotations.

This CL also adds regression tests that contain @androidentrypoint classes that use Kotlin @Suppress.

Fixes #2834

RELNOTES=Fix #2834:Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations.
PiperOrigin-RevId: 399945204
copybara-service bot pushed a commit that referenced this issue Sep 30, 2021
…ting values from Kotlin @Suppress annotations.

This CL also adds regression tests that contain @androidentrypoint classes that use Kotlin @Suppress.

Fixes #2834

RELNOTES=Fix #2834:Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations.
PiperOrigin-RevId: 399945204
copybara-service bot pushed a commit that referenced this issue Sep 30, 2021
…ting values from Kotlin @Suppress annotations.

This CL also adds regression tests that contain @androidentrypoint classes that use Kotlin @Suppress.

Fixes #2834

RELNOTES=Fix #2834:Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations.
PiperOrigin-RevId: 399945204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants