-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Description
Seems to be a dupe of #488, but I'm bumping into it with Anvil 2.5.1 (Kotlin version is 2.1.0), so submitting a new report.
We've got the following annotation:
@RequiresOptIn(
level = RequiresOptIn.Level.ERROR,
message = "...",
)
@Retention(AnnotationRetention.BINARY)
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.FIELD,
AnnotationTarget.PROPERTY,
)
annotation class UnstableSyncValueMigrationApi
Which annotates a class:
@UnstableSyncValueMigrationApi
class DebugSyncValueMigrationBypass @Inject constructor() : SyncValueMigrationBypass
That's bound in a module:
@UnstableSyncValueMigrationApi
@Module
@ContributesTo(SandboxedScope::class)
abstract class SyncValueMigrationBypassModule {
@Binds abstract fun bind(impl: DebugSyncValueMigrationBypass): SyncValueMigrationBypass
}
Anvil generates the following factory:
// Generated by Anvil.
// https://github.com/square/anvil
@file:Suppress(
"DEPRECATION",
"OPT_IN_USAGE",
"OPT_IN_USAGE_ERROR",
)
package com.squareup.cash.`data`.featureflags.syncvalue
import dagger.`internal`.Factory
import kotlin.Suppress
import kotlin.jvm.JvmStatic
public object DebugSyncValueMigrationBypass_Factory : Factory<DebugSyncValueMigrationBypass> {
override fun `get`(): DebugSyncValueMigrationBypass = newInstance()
@JvmStatic
public fun create(): DebugSyncValueMigrationBypass_Factory = this
@JvmStatic
public fun newInstance(): DebugSyncValueMigrationBypass = DebugSyncValueMigrationBypass()
}
Which fails to compile:
e: file:///.../DebugSyncValueMigrationBypass_Factory.kt:16:16 Base declaration of supertype 'Factory' needs opt-in. The declaration override must be annotated with '@com.squareup.cash.common.backend.featureflags.syncvalue.UnstableSyncValueMigrationApi' or '@OptIn(com.squareup.cash.common.backend.featureflags.syncvalue.UnstableSyncValueMigrationApi::class)'
The workaround I found is to change RequiresOptIn.Level
to WARNING
, which allows the compilation to go through, but is not what we ultimately want.
This happens in cash-android, so please feel free to reach out internally for more troubleshooting data!
Metadata
Metadata
Assignees
Labels
No labels