Skip to content

Commit

Permalink
Use -Xsam-conversions=class when compiling Kotlin
Browse files Browse the repository at this point in the history
All the way back in version 1.5, Kotlin started using invokedynamic for
SAM-converted lambdas. J2CL is currently unable to handle the IR generated
for that, so the flag avoids exceptions at least.

PiperOrigin-RevId: 599254652
  • Loading branch information
Googler authored and copybara-github committed Jan 17, 2024
1 parent 659e0bd commit 6aa1855
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build_defs/internal_do_not_use/j2cl_common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ DEFAULT_J2CL_KOTLINCOPTS = [
# some instances, ex. a lambda within an inline member. See: b/263391416
# TODO(b/264661698): Reduce to just serialization of inline functions.
"-Xserialize-ir=all",
# Have kotlinc's IR lowering passes generate objects for SAM implementations.
# J2CL lowering passes cannot handle invokedynamic-based representations.
"-Xsam-conversions=class",
]

J2CL_JAVA_TOOLCHAIN_ATTRS = {
Expand Down

0 comments on commit 6aa1855

Please sign in to comment.