This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kotlinc Foo.kt | |
$ javap -c Foo > bytecode_kotlin.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ javac Foo.java | |
$ javap -c Foo > bytecode_java.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiled from "Bar.kt" | |
public final class Bar { | |
public final boolean is valid(); | |
Code: | |
0: aload_0 | |
1: getfield #10 // Field "is valid":Z | |
4: ireturn | |
public final boolean is_valid(); | |
Code: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiled from "Foo.kt" | |
public final class Foo { | |
public final int getNumber(); | |
Code: | |
0: aload_0 | |
1: getfield #10 // Field isValid:Z | |
4: ifeq 11 | |
7: iconst_1 | |
8: goto 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiled from "Foo.java" | |
public final class Foo { | |
public final int getNumber(); | |
Code: | |
0: aload_0 | |
1: invokevirtual #5 // Method java/lang/Object.getClass:()Ljava/lang/Class; | |
4: pop | |
5: iconst_1 | |
6: ireturn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class Bar { | |
private final boolean is valid = true; | |
private final boolean is_valid = true; | |
public final boolean is_valid/* $FF was: is valid*/() { | |
return this.is valid; | |
} | |
public final boolean is_valid() { | |
return this.is_valid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bar { | |
val `is valid` = true | |
val is_valid = true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class Foo { | |
private final int product = this.getNumber() * 2; | |
private final boolean isValid = true; | |
public final int getNumber() { | |
return this.isValid ? 1 : 0; | |
} | |
public final int getProduct() { | |
return this.product; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
val number | |
get() = if (isValid) 1 else 0 | |
val product = number * 2 | |
val isValid = true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class PrefDelegate<T>(val prefKey: String) { | |
companion object { | |
private var context: Context? = null | |
/** | |
* Initialize PrefDelegate with a Context reference | |
* This method needs to be called before any other usage of PrefDelegate | |
*/ | |
fun init(context: Context) { |
NewerOlder