vach
02/08/2017, 10:34 AMfun enter(key: String) {
if (disabled) {
return
}
// lots of code
}
when i decompile kotlin bytecode to see what is the underlying java code i see this
public final void enter(@NotNull String key) {
Intrinsics.checkParameterIsNotNull(key, "key");
if(!disabled) {
// lots of code moved inside inverted if
}
}
not a big deal just curious why inverting the if statement? i cant think of some low level performance trick that may be the reason for thiselizarov
02/08/2017, 10:41 AMvach
02/08/2017, 10:42 AMelizarov
02/08/2017, 10:43 AMsigurdsa
02/08/2017, 10:44 AMvach
02/08/2017, 11:08 AMreturns
by restructuring ifs…orangy
if
in bytecode, they are lower level constructs. So decompiler tries to reconstruct Java from bytecode it sees, and there are potentially a lot of ways to represent particular bytecode in equivalent Java syntax.vach
02/09/2017, 2:13 AM