-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use default interface method bytecode optimization for target 1.8 #495
Conversation
For a java consumer, how will their usage change hitting this API? |
this will not work for java consumers. in rib repo add: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this breaks java consumers
@jbarr21 @tyvsmith : Got it, we need to preserve Java consumers too, it indeed breaks. Didn't understand at first how java compiles against kotlin interface default methods (for the record, this is a very good resource : https://www.zacsweers.dev/jvmdefault-more-useful/ ) We have a few options, none of them are ideal given Bazel doesn't support yet bytecode output with So our options are :
Again, no ideal solution I could find, but I think #2 is probably the lesser of the evils. Once I hear from you guys, I will update the PR with #2 unless you have a better solution. We should also add a test to cover the java consumer scenario. EDIT : github issue filed at bazelbuild/bazel#15144 |
Discussed offline with @jbarr21 and will temporarily impl solution #2 until bazelbuild/bazel#15144 is solved. |
…erve java compatibility:
Description:
Generating default methods in interfaces (with lambda expression in their body compiled as bridge methods) for the Java 8 target result in bytecode that fails to be de-sugared by Bazel. This will be presumably fixed in future version of bazel, for the time being, disable this optimization and rely on the bytecode generation used in older kotlin compiler, it relies on generating a separate static class and works around the issue with lambda/bridge.
More technical info :