Skip to content

Instantly share code, notes, and snippets.

@agonist
Last active October 9, 2017 09:38
Show Gist options
  • Save agonist/278e674d5338e9a42d109b265b2d4532 to your computer and use it in GitHub Desktop.
Save agonist/278e674d5338e9a42d109b265b2d4532 to your computer and use it in GitHub Desktop.
class KotlinClass {
// here foo is declared as not nullable (nullable declaration would have been fun makeItCrash(foo: String?)
fun makeItCrash(foo: String) {
}
}
public class Main {
public static void main(String[] args) {
KotlinClass kotlinClass = new KotlinClass();
kotlinClass.makeItCrash(null);
// AndroidStudio only warns you, but you will get an IllegalArgumentException during execution
// if you pass a null value from Java code to a non-nullable Kotlin method parameter.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment