`Resolver.overrides()` returns false when Java method overrides both Kotlin property and function
- Dominant language
- Kotlin
- Stars
- 3.5k
- Forks
- 415
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 53
Description
In KSP2, `Resolver.overrides(overrider, overridee, containingClass)` incorrectly returns `false` when checking whether a Java getter method overrides a Kotlin interface function if the containing class also implements a Kotlin interface property with a matching getter.
---
## Repro Steps
### 1. Source Files
```kotlin
// JavaSubject.java
public class JavaSubject implements KtFunctionInterface, KtPropertyInterface {
@Override
public String getFoo() {
return "";
}
}
// KtFunctionInterface.kt
interface KtFunctionInterface {
fun getFoo(): String
}
// KtPropertyInterface.kt
interface KtPropertyInterface {
val foo: String
}
```
### 2. Processor Logic (MyProcessor.kt)
```kotlin
val javaSubject = resolver.getClassDeclarationByName(resolver.getKSNameFromString("JavaSubject"))!!
val ktFunctionInterface = resolver.getClassDeclarationByName(resolver.getKSNameFromString("KtFunctionInterface"))!!
val ktPropertyInterface = resolver.getClassDeclarationByName(resolver.getKSNameFromString("KtPropertyInterface"))!!
val javaGetFoo = javaSubject.getDeclaredFunctions().first { it.simpleName.asString() == "getFoo" }
val ktFunction = ktFunctionInterface.getAllFunctions().first { it.simpleName.asString() == "getFoo" }
val ktProperty = ktPropertyInterface.getAllProperties().first { it.simpleName.asString() == "foo" }
println("overrides(javaGetFoo, ktFunction, javaSubject) = ${resolver.overrides(javaGetFoo, ktFunction, javaSubject)}")
println("overrides(javaGetFoo, ktProperty, javaSubject) = ${resolver.overrides(javaGetFoo, ktProperty, javaSubject)}")
```
## Output
```
// Actual
overrides(javaGetFoo, ktFunction, javaSubject) = false
overrides(javaGetFoo, ktProperty, javaSubject) = true
// Expected
overrides(javaGetFoo, ktFunction, javaSubject) = true
overrides(javaGetFoo, ktProperty, javaSubject) = true
```
Contributor guide
Assessment
This issue has not been assessed yet.