max.kammerer
12/08/2021, 10:45 AM-Xjvm-default=disable
mode to -Xjvm-default=all
. This change will keep source compatibility but could break binary one if you are using compiler internals. If you use some compiler internal interfaces could you please list them in thread. In such case we will try to also ship binary compatible stubs for DefaultImpls
classes (that would gone away in all
mode)
UPD: this post is not about switching default value for -Xjvm-default
. The aim of it to avoid any occasional breakage for compiler extension, pluginsmax.kammerer
12/08/2021, 10:46 AMmbonnin
12/08/2021, 1:02 PM-Xjvm-default=all
doesn't break binary compatibility? If app.jar
contains bytecode that references DefaultImpls
in lib-1.0.jar
, I'd expect shipping a newer version of the lib (lib-1.1.jar
without the DefaultImpls
) and putting that in the classpath would result in a runtime crash?max.kammerer
12/08/2021, 3:14 PM-Xjvm-default
option also provides modes that keep binary compatibility (there will be also additional option with @JvmDefaultWithCompatibility
annotation in -Xjvm-default=all
mode since 1.6.20), that could be used by libraries authors. In original message I'm wrote not about default switch in -Xjvm-default
but about shipping compiler built with -Xjvm-default=all
+ @JvmDefaultWithCompatibility
flagsmbonnin
12/08/2021, 3:17 PM@JvmDefaultWithCompatibility
everywhere to be able to be used with newer versions of the compiler? That sounds like a lot of bytecode to be shipped all around? I'd rather keep the current behaviour until the next breaking version of my lib (if that's something that newer compilers can read?)max.kammerer
12/08/2021, 3:24 PMWhat is the recommendation for library authors moving forward?I assume that we speak about libraries but not about compiler extension/plugins. Than...
Should we use...both variants (old and new one ) would work smoothly.everywhere to be able to be used with newer versions of the compiler?@JvmDefaultWithCompatibility
I'd rather keep the current behaviour until the next breaking version of my lib (if that's something that newer compilers can read?)And yes, switching to
-Xjvm-default=X
will require proper library versioning
That sounds like a lot of bytecode to be shipped all around?What do you mean?
mbonnin
12/08/2021, 3:30 PMI assume that we speak about libraries but not about compiler extension/plugins. Than...Correct 👍
What do you mean? (Ideally, I'd like to continue compiling my lib with with
-Xjvm-default=disable
(which I understand is the current 1.6 behaviour)
I understand -Xjvm-default=all-compatibility
will generate both default methods and DefaultImpls
but I'd better avoid this to avoid the extra bytecode (having both the default method as well as DefaultImpls
).
Am I correct assuming that once the behaviour changes in the compiler, I can continue compiling my lib with `-Xjvm-default=disable`and newer versions of the compiler will still be able to use it?max.kammerer
12/08/2021, 3:34 PMAm I correct assuming that once the behaviour changes in the compilerWe are not changing compiler behaviour yet.
-Xjvm-default=disable
is still default one and would be default one in several upcoming release. disable
mode would be available after switching default value for this option. We will provide migration guide to -Xjvm-default=all
latemax.kammerer
12/08/2021, 3:36 PMhaving both the default method as well asDefaultImpls
DefaultImpls
will have simple stubs that would invoke default methods from interfaceralf
12/08/2021, 5:50 PMmax.kammerer
12/09/2021, 8:19 AMIn what release do you expect this change?@ralf If you asking about original post (switching compilation mode for Kotlin compiler build), it will be in 1.7
ralf
12/09/2021, 5:29 PM