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

オープン
#8,557 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, java, kotlin

調査の方向性

公開された firebase-auth-24.2.0 AAR の classes.jar と POM を調査し、そのメタデータを生成する firebase-auth 依存関係の宣言を追跡します。報告された IdTokenListener lambda で Kotlin の型推論失敗を再現し、compileOnly checker-qual workaround なしでクリーンな consumer build が成功することを確認します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Java
スター
2.6k
フォーク
733
平均マージ
2日 15時間
マージ済み PR(30日)
72

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firebase/firebase-android-sdk のほかの issue

firebase/firebase-android-sdk の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。