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

Đang mở
#8,557 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, java, kotlin
Lĩnh vực
build-system, mobile-dev

Hướng nghiên cứu

Kiểm tra classes.jar và POM của AAR firebase-auth-24.2.0 đã phát hành, sau đó truy vết khai báo dependency firebase-auth tạo ra metadata đó. Tái hiện lỗi suy luận Kotlin với lambda IdTokenListener đã được báo cáo và xác minh rằng một consumer build sạch thành công mà không cần workaround compileOnly checker-qual.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Java
Star
2.6k
Fork
733
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
72

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/firebase-android-sdk

Tất cả issue của firebase/firebase-android-sdk

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.