firebase-auth publishes @UnknownInitialization but does not declare checker-qual, breaking Kotlin consumers

Abierto
#8,557 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
android, java, kotlin

Línea de trabajo

Inspecciona el classes.jar y el POM del AAR publicado firebase-auth-24.2.0 y, a continuación, rastrea la declaración de dependencia de firebase-auth que produce esos metadatos. Reproduce el fallo de inferencia de Kotlin con la lambda IdTokenListener indicada y verifica que una compilación limpia del consumidor se realiza correctamente sin la solución alternativa compileOnly checker-qual.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

api: auth type: bug
[READ] Step 1: Are you in the right place?

Yes — this is a defect in the published com.google.firebase:firebase-auth artifact metadata.

[REQUIRED] Step 2: Describe your environment
  • Android Studio version: n/a (Gradle CLI)
  • Firebase Component: Authentication (com.google.firebase:firebase-auth:24.2.0, via firebase-bom:34.18.0)
  • Component version: 24.2.0
  • Kotlin: 2.4.10 · AGP: 9.4.0-rc01 · Gradle: 9.7.1 · JDK 21
[REQUIRED] Step 3: Describe the problem

firebase-auth publishes classes annotated with org.checkerframework.checker.initialization.qual.UnknownInitialization, but its POM does not declare org.checkerframework:checker-qual. Consumers therefore have no way to resolve that annotation, and any Kotlin code that compiles against the annotated API and lets a type be inferred fails to compile.

Confirmed by scanning the artifact contents — the annotation reference is inside firebase-auth itself, not a transitive dependency:

$ unzip -p firebase-auth-24.2.0.aar classes.jar | strings | grep UnknownInitialization
# present in 24.2.0 and 24.1.0

and it is absent from the published POM (all 17 declared dependencies checked; androidx.*, play-services-*, firebase-*, kotlin-stdlib — no checker-qual).

Nothing else on the compile classpath supplies it either. firebase-auth pulls only the com.google.guava:listenablefuture stub, not full Guava — and full Guava is what historically put checker-qual on the classpath transitively. That is presumably why this was latent: the annotation is present in 24.1.0 as well, so an unrelated dependency change is what removed the accidental path to it.

Steps to reproduce:

Compile Kotlin against FirebaseAuth.IdTokenListener with an inferred lambda parameter, with checker-qual absent from the classpath:

FirebaseAuth.IdTokenListener { auth ->   // `auth` type inferred
  // ...
}

Relevant Code / error:

Type annotation class 'org.checkerframework.checker.initialization.qual.UnknownInitialization'
of the inferred type is inaccessible. Check the module classpath for missing or conflicting dependencies.

This reproduces through the official Flutter plugin (firebase_auth 6.6.0), whose IdTokenChannelStreamHandler.kt:23 is exactly that shape — :firebase_auth:compileDebugKotlin fails outright.

Note javac tolerates this (the JLS says unresolvable annotations are ignored), so Java consumers do not notice; Kotlin needs the annotation to resolve the inferred type, so only Kotlin consumers break.

Workaround (in a consumer's build, for anyone finding this):

dependencies { compileOnly("org.checkerframework:checker-qual:3.49.5") }

Suggested fix: declare checker-qual in firebase-auth's POM so it lands on consumers' compile classpath, or strip the annotation from the published class files if it is not meant to be part of the public API surface.

Lenguaje dominante
Java
Estrellas
2.6k
Forks
733
Merge medio
2 d 15 h
PR fusionados (30 d)
72

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/firebase-android-sdk

Todos los issues de firebase/firebase-android-sdk

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.