KT-7695 Java to Kotlin converter incorrectly generates a cast to non-nullable type
#KT-7695 Fixed
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
private String foo(Object o, boolean b) {
|
||||
if (b) return (String) o;
|
||||
return "";
|
||||
}
|
||||
|
||||
void bar() {
|
||||
if (foo(null, true) == null) {
|
||||
System.out.println("null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
private fun foo(o: Any?, b: Boolean): String? {
|
||||
if (b) return o as String?
|
||||
return ""
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
if (foo(null, true) == null) {
|
||||
println("null")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user