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:
+8
@@ -0,0 +1,8 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
static String notNull() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
fun test() {
|
||||
val s = <selection>J.notNull()</selection>
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
fun test() {
|
||||
val s = s()
|
||||
}
|
||||
|
||||
private fun s(): String = J.notNull()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class J {
|
||||
@Nullable
|
||||
static String nullable() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
fun test() {
|
||||
val s = <selection>J.nullable()</selection>
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
fun test() {
|
||||
val s = s()
|
||||
}
|
||||
|
||||
private fun s(): String? = J.nullable()
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class J {
|
||||
static String unknown() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// SUGGESTED_NAMES: s, getS
|
||||
// SUGGESTED_RETURN_TYPES: kotlin.String?, kotlin.String
|
||||
fun test() {
|
||||
val s = <selection>J.unknown()</selection>
|
||||
}
|
||||
+7
@@ -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()
|
||||
Reference in New Issue
Block a user