Do substitution of a type enhancement, not only lower and upper bounds
^KT-44439 Fixed
This commit is contained in:
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// 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: Task2.java
|
||||
|
||||
public class Task2 implements Task {
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
// FILE: Test.java
|
||||
|
||||
public class Test {
|
||||
<T extends Task> void register(Class<T> var2, Foo<? super T> var3) throws IllegalAccessException, InstantiationException {
|
||||
var3.execute(var2.newInstance());
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Foo.java
|
||||
|
||||
@NonNullApi
|
||||
public interface Foo<T> {
|
||||
void execute(T t);
|
||||
}
|
||||
|
||||
// FILE: Task.java
|
||||
|
||||
public interface Task {}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun main() {
|
||||
Test().register(Task2::class.java) { // before the fix, type parameter's type leaked here (type of `it` is `T`)
|
||||
it.foo()
|
||||
it.apply {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
@NonNullApi public interface Foo</*0*/ T : kotlin.Any!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun execute(/*0*/ t: T!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FILE}) @javax.annotation.Nonnull /* annotation class not found */ @javax.annotation.meta.TypeQualifierDefault(value = {ElementType.METHOD, ElementType.PARAMETER}) /* annotation class not found */ @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) public final annotation class NonNullApi : kotlin.Annotation {
|
||||
public constructor NonNullApi()
|
||||
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
|
||||
}
|
||||
|
||||
public interface Task {
|
||||
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
|
||||
}
|
||||
|
||||
public open class Task2 : Task {
|
||||
public constructor Task2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public/*package*/ open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
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/*package*/ open fun </*0*/ T : Task!> register(/*0*/ var2: java.lang.Class<T!>!, /*1*/ var3: Foo<in T!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user