Build type enhancement properly, by taking into account both bounds of the original flexible type
^KT-44420 Fixed
This commit is contained in:
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// FIR_IDENTICAL
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
// WITH_REFLECT
|
||||
|
||||
// FILE: NonNullApi.java
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE, ElementType.PACKAGE})
|
||||
@javax.annotation.Nonnull
|
||||
@javax.annotation.meta.TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER})
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface NonNullApi { }
|
||||
|
||||
// FILE: Foo.java
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@NonNullApi
|
||||
public class Foo<E> {
|
||||
public Foo(Collection<? extends E> c) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun test() {
|
||||
val collection: Collection<Int> = listOf(1, 2, 3)
|
||||
Foo(collection)
|
||||
}
|
||||
Reference in New Issue
Block a user