-
Notifications
You must be signed in to change notification settings - Fork 289
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
jvmModifiers
doesn't return the Builder
#638
Comments
It doesn't need to wait. @JvmName("jvmModifiers")
@Deprecated(level = HIDDEN)
fun jvmModifersOld(..) { .. }
@JvmName("jvmModifiersNew")
fun jvmModifers(..): Builder { .. } |
Wouldn't it break implicit returns in Kotlin though? Also, introducing |
Yes it is source incompatible but literally (and not hyperbolically) no one is relying on this. It would have to be the last function call on the builder when used as an expression.
I mean you can name it whatever you want, but I'm not sure how much I care about the ergonomics of Java callers here. Android suffixed their methods with "Flags" when they made this change. You can also use bytecode manipulation to break neither binary nor source compatibility: https://github.com/JakeWharton/OverloadReturn |
Yeah, agree. Fine with both fixing it now the way you suggest, or leaving it hanging until 2.0. The workaround is straightforward ( |
Sorry, This comment may not be good for here.
|
I don't think that |
you seem to want to make functions which same-name, same-parameter and different-result-type to fix this. But current Kotlin doesn't allow(see https://pl.kotl.in/wITeF-6gG). I think we can make a future request for Kotlin. This is a suggestion about what we can do. |
This is not something that Java allows either, and I'm pretty sure it's not allowed by the JVM spec (correct me if I'm wrong). |
It's allowed in bytecode, not source code. |
In the new java source code, the function with DeprecationLevel.HIDDEN is hidden in java too and can invoke new function. |
The method
jvmModifiers
inFunSpec
breaks the chaining by not returning theBuilder
. There is a similar method inParameterSpec
which does return theBuilder
.This will be a breaking change so it will have to wait till 2.x.
The text was updated successfully, but these errors were encountered: