Skip to content

Commit 31c5d7c

Browse files
committed
special handling for java property accessors override checking
(cherry picked from commit 4785305)
1 parent cd68e48 commit 31c5d7c

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSFunctionDeclarationImpl.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ class KSFunctionDeclarationImpl private constructor(internal val ktFunctionSymbo
107107
}
108108
recordLookupForPropertyOrMethod(this)
109109
return analyze {
110-
ktFunctionSymbol.getDirectlyOverriddenSymbols().firstOrNull()?.unwrapFakeOverrides?.toKSDeclaration()
110+
if (ktFunctionSymbol is KtPropertyAccessorSymbol) {
111+
(parentDeclaration as? KSPropertyDeclarationImpl)?.ktPropertySymbol
112+
} else {
113+
ktFunctionSymbol
114+
}?.getDirectlyOverriddenSymbols()?.firstOrNull()?.unwrapFakeOverrides?.toKSDeclaration()
111115
}?.also { recordLookupForPropertyOrMethod(it) }
112116
}
113117

kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSPropertyDeclarationJavaImpl.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package com.google.devtools.ksp.impl.symbol.kotlin
22

3-
import com.google.devtools.ksp.closestClassDeclaration
43
import com.google.devtools.ksp.common.KSObjectCache
54
import com.google.devtools.ksp.common.impl.KSNameImpl
65
import com.google.devtools.ksp.impl.ResolverAAImpl
7-
import com.google.devtools.ksp.impl.recordLookupForPropertyOrMethod
8-
import com.google.devtools.ksp.impl.recordLookupWithSupertypes
96
import com.google.devtools.ksp.impl.symbol.kotlin.resolved.KSTypeReferenceResolvedImpl
107
import com.google.devtools.ksp.symbol.*
118
import org.jetbrains.kotlin.analysis.api.symbols.KtJavaFieldSymbol
@@ -44,12 +41,7 @@ class KSPropertyDeclarationJavaImpl private constructor(val ktJavaFieldSymbol: K
4441
}
4542

4643
override fun findOverridee(): KSPropertyDeclaration? {
47-
closestClassDeclaration()?.asStarProjectedType()?.let {
48-
recordLookupWithSupertypes((it as KSTypeImpl).type)
49-
}
50-
recordLookupForPropertyOrMethod(this)
51-
TODO("Not yet implemented")
52-
// ?.also { recordLookupForPropertyOrMethod(it) }
44+
return null
5345
}
5446

5547
override fun asMemberOf(containing: KSType): KSType {

test-utils/src/test/kotlin/com/google/devtools/ksp/test/KSPAATest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ class KSPAATest : AbstractKSPAATest() {
410410
runTest("../test-utils/testData/api/overridee/conflictingOverride.kt")
411411
}
412412

413-
@Disabled
414413
@TestMetadata("javaAccessor.kt")
415414
@Test
416415
fun testJavaAccessor() {

0 commit comments

Comments
 (0)