-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
ea33e72
commit d61cef0
Showing
6 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
.../tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
compiler/testData/codegen/box/javaInterop/delegationToJavaDnn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>() | ||
} |
6 changes: 6 additions & 0 deletions
6
...new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...w/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters