[FE 1.0] Don't expand type enhancement
Actually shallow type enhancement is primary, it's more specific ^KT-50734 Fixed
This commit is contained in:
committed by
teamcity
parent
59b92c02b4
commit
6c994787b3
@@ -0,0 +1,41 @@
|
||||
|
||||
// FILE: Supplier.java
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.annotations.Nullable;
|
||||
|
||||
// Shown from RxJava for reference
|
||||
@FunctionalInterface
|
||||
public interface Supplier<@NonNull T> {
|
||||
T get() throws Throwable;
|
||||
}
|
||||
|
||||
// FILE: Maybe.java
|
||||
public abstract class Maybe<T> {
|
||||
public final void subscribe() {}
|
||||
}
|
||||
|
||||
// FILE: FromSupplier.java
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.annotations.Nullable;
|
||||
|
||||
public class FromSupplier {
|
||||
static <@NonNull T> Maybe<T> fromSupplier3(Supplier<? extends @Nullable T> supplier) {
|
||||
return null;
|
||||
}
|
||||
static <@NonNull T> Maybe<T> fromSupplier5(@NonNull Supplier<? extends @Nullable T> supplier) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
// No Warning
|
||||
// In this case, we have nullable type enhancement
|
||||
FromSupplier.fromSupplier3<Boolean> { <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!> }
|
||||
.subscribe()
|
||||
|
||||
// In this case, we have not-null type enhancement
|
||||
// Warning: Type Mismatch: Required Boolean? found Nothing
|
||||
FromSupplier.fromSupplier5<Boolean> { <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!> }
|
||||
.subscribe()
|
||||
}
|
||||
Reference in New Issue
Block a user