Kotlin interop: reporting wrong type for inner classes appearing in Kotlin method types
See original GitHub issueCompiler version
3.0.0-RC2
Minimized code
I’m working with a library that is written in kotlin, and running into a compilation error on 3.0.0-RC2 that doesn’t happen on 2.13.5. The decompiled .class file looks like:
public abstract class VerificationResult {
public static final class Ok extends VerificationResult {...}
public static final class Failed extends VerificationResult {...}
...
}
and then there is a method on another class like:
public void displayFailures(@NotNull List<Failed> failures)
I then get this compiler error when calling the method:
Output
[error] 16 | verifier.displayFailures(List(failed).asJava)
[error] | ^^^^^^^^^^^^^^^^^^^
[error] |Found: java.util.List[au.com.dius.pact.provider.VerificationResult.Failed]
[error] |Required: java.util.List[au.com.dius.pact.provider.VerificationResult$Failed]
Expectation
Should compile.
Issue Analytics
- State:
- Created 2 years ago
- Comments:35 (26 by maintainers)
Top Results From Across the Web
Calling Java from Kotlin
Kotlin is designed with Java interoperability in mind. ... When you call methods on variables of platform types, Kotlin does not issue nullability...
Read more >Accessing static inner class defined in Java, through derived ...
In Kotlin, nested types and companion objects are not automatically inherited. ... Nested::class // Error: 'Nested' unresolved.
Read more >Chapter 6. The Kotlin type system - Kotlin in Action
This chapter covers. Nullable types and syntax for dealing with null s; Primitive types and their correspondence to the Java types; Kotlin collections...
Read more >Kotlin style guide | Android Developers
Like other programming style guides, the issues covered span not only aesthetic issues of formatting, but other types of conventions or coding standards...
Read more >Using Kotlin Code from Java - InformIT
Here, you define an extension function that facilitates showing toast messages on Android and use @JvmName to provide a more descriptive name ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Found it: https://github.com/scala/scala/pull/5822
Thanks for stepping up!