Skip to content

Support Kotlin-compatible companion objects in J2ObjC#2755

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_908123728
Open

Support Kotlin-compatible companion objects in J2ObjC#2755
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_908123728

Conversation

@copybara-service
Copy link
Copy Markdown

Support Kotlin-compatible companion objects in J2ObjC

  • Companion protocol generation is triggered by a new annotation "GenerateObjCCompanion"
  • This works exclusively for non-private Java classes declaring static members carrying the annotation; If the annotation is used in other cases, compilation will fail with a corresponding error message.
  • Avoids subclass covariance mismatch errors via localized Wincompatible-property-type pragma wrappers.
  • Companion properties retrieved via the meta-class object incur zero extra heap allocations.

* Companion protocol generation is triggered by a new annotation "GenerateObjCCompanion"
* This works exclusively for non-private Java classes declaring static members carrying the annotation; If the annotation is used in other cases, compilation will fail with a corresponding error message.
* Avoids subclass covariance mismatch errors via localized Wincompatible-property-type pragma wrappers.
* Companion properties retrieved via the meta-class object incur zero extra heap allocations.

PiperOrigin-RevId: 908123728
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant