Fix deserialization exception for DNN types from Java
useCorrectedNullabilityForTypeParameters = true only might lead to something becomes a DNN when otherwise it wasn't. It seems safe to use it here, since if compiler has generated DNN, then it's OK to assume that it checked necessary conditions, and it's likely that it had useCorrectedNullabilityForTypeParameters = true as well, there. Anyway, it looks saner than having an exception here. Also, we assume here that metadata leading to exception might only be generated with ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated LF (at least, we don't have contradicting evidences), thus it's mostly a preparations in case we decide to enable ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated in 1.9. ^KT-55357 Fixed ^KT-55388 Related ^KT-36770 Related
This commit is contained in:
committed by
Space Team
parent
9e8e5c5a36
commit
fd7559893e
@@ -0,0 +1,29 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
// ISSUE: KT-55357
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface J {
|
||||
@NotNull
|
||||
<T> T foo();
|
||||
}
|
||||
|
||||
// FILE: JImpl.java
|
||||
public class JImpl implements J {
|
||||
public <T> T foo() {
|
||||
return (T) "OK";
|
||||
}
|
||||
}
|
||||
// FILE: a.kt
|
||||
class C(val x: J) : J by x
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: a.kt
|
||||
|
||||
fun box(): String {
|
||||
return C(JImpl()).foo<String>()
|
||||
}
|
||||
Reference in New Issue
Block a user