[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,40 @@
|
||||
// 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> { null }
|
||||
.subscribe()
|
||||
|
||||
// In this case, we have not-null type enhancement
|
||||
// Warning: Type Mismatch: Required Boolean? found Nothing
|
||||
FromSupplier.fromSupplier5<Boolean> { null }
|
||||
.subscribe()
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public open class FromSupplier {
|
||||
public constructor FromSupplier()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public/*package*/ open fun </*0*/ @io.reactivex.rxjava3.annotations.NonNull T : kotlin.Any!> fromSupplier3(/*0*/ supplier: Supplier<out @io.reactivex.rxjava3.annotations.Nullable T!>!): Maybe<T!>!
|
||||
public/*package*/ open fun </*0*/ @io.reactivex.rxjava3.annotations.NonNull T : kotlin.Any!> fromSupplier5(/*0*/ @io.reactivex.rxjava3.annotations.NonNull supplier: @io.reactivex.rxjava3.annotations.NonNull Supplier<out @io.reactivex.rxjava3.annotations.Nullable T!>!): Maybe<T!>!
|
||||
}
|
||||
|
||||
public abstract class Maybe</*0*/ T : kotlin.Any!> {
|
||||
public constructor Maybe</*0*/ T : kotlin.Any!>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun subscribe(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@FunctionalInterface /* annotation class not found */ public interface Supplier</*0*/ @io.reactivex.rxjava3.annotations.NonNull T : kotlin.Any!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun get(): T!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user