class Foo(val bar: Int = 0) class Outer { val foo = 1 inner class Inner { val bar = foo + 1 } } foo(ArrayList) Kotlin foo(ArrayList<String?>?) , null, . , : - Kotlin ArrayList, foo(), ArrayList , . , : Kotlin generic- nullable, foo() foo(ArrayList?) .
Java- "" Kotlin, NPE, Kotlin , : - , Java- Kotlin-:
Exception in thread "main" java.lang.IllegalStateException: Method specified as non-null returned null: JavaClass.foo at _DefaultPackage.main(hello.kt:4)
Kotlin M5 , IntelliJ IDEA 12.0.3 .
, : Darcula . M5 (-). ! foo(ArrayList) Kotlin foo(ArrayList<String?>?) , null, . , : - Kotlin ArrayList, foo(), ArrayList , . , : Kotlin generic- nullable, foo() foo(ArrayList?) .
Java- "" Kotlin, NPE, Kotlin , : - , Java- Kotlin-:
Exception in thread "main" java.lang.IllegalStateException: Method specified as non-null returned null: JavaClass.foo at _DefaultPackage.main(hello.kt:4)
Kotlin M5 , IntelliJ IDEA 12.0.3 .
, : Darcula . M5 (-). ! foo(ArrayList) Kotlin foo(ArrayList<String?>?) , null, . , : - Kotlin ArrayList, foo(), ArrayList , . , : Kotlin generic- nullable, foo() foo(ArrayList?) .
Java- "" Kotlin, NPE, Kotlin , : - , Java- Kotlin-:
Exception in thread "main" java.lang.IllegalStateException: Method specified as non-null returned null: JavaClass.foo at _DefaultPackage.main(hello.kt:4)
Kotlin M5 , IntelliJ IDEA 12.0.3 .
, : Darcula . M5 (-). ! foo(ArrayList) Kotlin foo(ArrayList<String?>?) , null, . , : - Kotlin ArrayList, foo(), ArrayList , . , : Kotlin generic- nullable, foo() foo(ArrayList?) .
Java- "" Kotlin, NPE, Kotlin , : - , Java- Kotlin-:
Exception in thread "main" java.lang.IllegalStateException: Method specified as non-null returned null: JavaClass.foo at _DefaultPackage.main(hello.kt:4)
Kotlin M5 , IntelliJ IDEA 12.0.3 .
, : Darcula . M5 (-). !foo(ArrayList) Kotlin foo(ArrayList<String?>?) , null, . , : - Kotlin ArrayList, foo(), ArrayList , . , : Kotlin generic- nullable, foo() foo(ArrayList?) .
Java- "" Kotlin, NPE, Kotlin , : - , Java- Kotlin-:
Exception in thread "main" java.lang.IllegalStateException: Method specified as non-null returned null: JavaClass.foo at _DefaultPackage.main(hello.kt:4)
Kotlin M5 , IntelliJ IDEA 12.0.3 .
, : Darcula . M5 (-). !foo(ArrayList) Kotlin foo(ArrayList<String?>?) , null, . , : - Kotlin ArrayList, foo(), ArrayList , . , : Kotlin generic- nullable, foo() foo(ArrayList?) .
Java- "" Kotlin, NPE, Kotlin , : - , Java- Kotlin-:
Exception in thread "main" java.lang.IllegalStateException: Method specified as non-null returned null: JavaClass.foo at _DefaultPackage.main(hello.kt:4)
Kotlin M5 , IntelliJ IDEA 12.0.3 .
, : Darcula . M5 (-). !Source: https://habr.com/ru/post/168265/
All Articles