當你有具有默認參數的函數科特林產生具有所要求的參數和一個附加Int
作爲最後的參數的合成功能和做一些位操作
例科特林功能:
fun lotsOfParameters(a: String = "Default",
b: Byte = 2,
c: Char = 'p',
d: Boolean = false,
e: Any = true,
f: Int = 2) {
}
編譯Java代碼:
public static final void lotsOfParameters(@NotNull String a, byte b, char c, boolean d, @NotNull Object e, int f) {
Intrinsics.checkParameterIsNotNull(a, "a");
Intrinsics.checkParameterIsNotNull(e, "e");
}
// $FF: synthetic method
// $FF: bridge method
public static void lotsOfParameters$default(String var0, byte var1, char var2, boolean var3, Object var4, int var5, int var6, Object var7) {
if ((var6 & 1) != 0) {
var0 = "Default";
}
if ((var6 & 2) != 0) {
var1 = 2;
}
if ((var6 & 4) != 0) {
var2 = 'p';
}
if ((var6 & 8) != 0) {
var3 = false;
}
if ((var6 & 16) != 0) {
var4 = true;
}
if ((var6 & 32) != 0) {
var5 = 2;
}
lotsOfParameters(var0, var1, var2, var3, var4, var5);
}