question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`getJavaWildcard` does not account for overrides

See original GitHub issue

When a java source overrides a kotlin file, inherited functions should also inherit the variance even when the overrider’s type deos not require it (e.g. it is final)

repro test: https://github.com/yigit/ksp/commit/a2b4324a0d50258a75e204237254f8c3d8188b89

Inputs:

// FILE: javaOverridesKotlin.kt
package main
interface BaseKotlinOverriddenByJava<T> {
    fun receiveReturnT(t: T): T
    fun receiveReturnTList(t: List<T>): List<T>
}

interface KotlinOverriddenByKotlinOpen : BaseKotlinOverriddenByJava<Number> {
}
interface KotlinOverriddenByKotlinFinal : BaseKotlinOverriddenByJava<String> {
}
// FILE: main/JavaOverridesKotlinOpen.java
package main;
import java.util.List;
public interface JavaOverridesKotlinOpen extends BaseKotlinOverriddenByJava<Number> {
}
// FILE: main/JavaOverridesKotlinFinal.java
package main;
import java.util.List;
public interface JavaOverridesKotlinFinal extends BaseKotlinOverriddenByJava<String> {
}

the signature of receiveReturnTList as member of JavaOverridesKotlinFinal (or KotlinOverriddenByKotlinFinal) still needs to return out variance for the String type parameter.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
SteinerOkcommented, Feb 1, 2022

@yigit I created issue and attached sample project: https://issuetracker.google.com/issues/217210973

0reactions
yigitcommented, Jan 31, 2022

Looks like I have the same issue with room + ksp with base interface for DAO`s

Do you still have this problem with room 2.4.1? We couldn’t use the KSP API but implemented a custom one in room. If it is still not working for your case, it would be great to have a bug report so we can fix it in room. 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Provide APIs to resolve positional types for parameters #717
Specifically, parameters of methods might include variance based on the declaration or the overridee. There are also JvmSuppressWildcards ...
Read more >
React App and Chrome DevTools local overrides not working?
I have tried to do local overrides through the chrome dev tools on other non react sites, there it is working. Am I...
Read more >
Using Local Overrides in DevTools | A Faster Web
Quickly and easily experiment on remote sites with Chrome's new overrides feature.
Read more >
Override doesn't get invoked - Oracle Communities
I've been trying to get a simple override to work. I used S_PurchaseOrder as a template.
Read more >
Web Rating Overrides are not functioning after FortiOS upgrade
instead, the categories provided by Fortiguard are still used. I noticed that the ref (Reference) count for each override in the table is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found