This file contains hidden or 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
// lightsaber.kt | |
@file:JvmName("SaberUtils") | |
@file:JvmMultifileClass | |
package org.example | |
fun makeLightSaber() { /*...*/ } |
This file contains hidden or 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
@file:JvmName("SaberUtils") | |
package org.example | |
fun makeLightSaber() { /*...*/ } |
This file contains hidden or 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
package org.example | |
// Generated class | |
class AppKt { | |
public static void makeLightSaber() { /*..*/ } | |
} |
This file contains hidden or 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
package org.example | |
fun makeLightSaber() { /*...*/ } |
This file contains hidden or 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
// Generated class | |
public final class SaberFactory { | |
public static final SaberFactory INSTANCE = new SaberFactory(); | |
private SaberFactory() { } | |
public final void makeLightSaber() { /*...*/ } | |
} |
This file contains hidden or 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
object SaberFactory { | |
fun makeLightSaber() { /*...*/ } | |
} | |
class SaberFactory { | |
fun makeLightSaber() { /*...*/ } | |
} |
This file contains hidden or 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 Saber(val powers: Int) { | |
companion object Factory { | |
fun makeLightSaber(powers: Int): LightSaber { | |
return LightSaber(powers) | |
} | |
} | |
} |
This file contains hidden or 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
object SaberFactory { | |
fun makeLightSaber(powers: Int): LightSaber { | |
return LightSaber(powers) | |
} | |
} |
This file contains hidden or 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
Dalvik VM | ART | |
---|---|---|
JIT compilation | Ahead-of-time (AOT) and just-in-time (JIT) compilation (Android 7.0) with code profiling | |
No extra installation time and storage space | Take time and storage space to translate .dex file during install | |
Use dex opt to convert .dex bytecode to .odex bytecode | Use dex2oat to generate .oat native code from .dex bytecode |
This file contains hidden or 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
JIT | AOT | |
---|---|---|
Dynamic translate part of bytecode to machine code and cache in memory when app run | Statically translate bytecode to machine code at installation time and store in storage | |
Small memory | One time event. Code execute faster but need extra space and time |