Extraction Engine: Suggest both bounds for nullability-flexible types without nullability annotations. Do not omit return type if inferred one is flexible

#KT-6837 Fixed
This commit is contained in:
Alexey Sedunov
2015-05-25 14:42:55 +03:00
parent 72205540d6
commit 58ef7f2691
24 changed files with 221 additions and 37 deletions
@@ -0,0 +1,8 @@
import org.jetbrains.annotations.NotNull;
public class J {
@NotNull
static String notNull() {
return "";
}
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
// SUGGESTED_NAMES: s, getS
fun test() {
val s = <selection>J.notNull()</selection>
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// SUGGESTED_NAMES: s, getS
fun test() {
val s = s()
}
private fun s(): String = J.notNull()
@@ -0,0 +1,8 @@
import org.jetbrains.annotations.Nullable;
public class J {
@Nullable
static String nullable() {
return null;
}
}
@@ -0,0 +1,4 @@
// SUGGESTED_NAMES: s, getS
fun test() {
val s = <selection>J.nullable()</selection>
}
@@ -0,0 +1,6 @@
// SUGGESTED_NAMES: s, getS
fun test() {
val s = s()
}
private fun s(): String? = J.nullable()
@@ -0,0 +1,5 @@
public class J {
static String unknown() {
return "";
}
}
@@ -0,0 +1,5 @@
// SUGGESTED_NAMES: s, getS
// SUGGESTED_RETURN_TYPES: kotlin.String?, kotlin.String
fun test() {
val s = <selection>J.unknown()</selection>
}
@@ -0,0 +1,7 @@
// SUGGESTED_NAMES: s, getS
// SUGGESTED_RETURN_TYPES: kotlin.String?, kotlin.String
fun test() {
val s = s()
}
private fun s(): String? = J.unknown()