Skip to content

Commit

Permalink
special handling for java property accessors override checking
Browse files Browse the repository at this point in the history
(cherry picked from commit 4785305)
  • Loading branch information
neetopia committed May 17, 2024
1 parent cd68e48 commit 31c5d7c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ class KSFunctionDeclarationImpl private constructor(internal val ktFunctionSymbo
}
recordLookupForPropertyOrMethod(this)
return analyze {
ktFunctionSymbol.getDirectlyOverriddenSymbols().firstOrNull()?.unwrapFakeOverrides?.toKSDeclaration()
if (ktFunctionSymbol is KtPropertyAccessorSymbol) {
(parentDeclaration as? KSPropertyDeclarationImpl)?.ktPropertySymbol
} else {
ktFunctionSymbol
}?.getDirectlyOverriddenSymbols()?.firstOrNull()?.unwrapFakeOverrides?.toKSDeclaration()
}?.also { recordLookupForPropertyOrMethod(it) }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.google.devtools.ksp.impl.symbol.kotlin

import com.google.devtools.ksp.closestClassDeclaration
import com.google.devtools.ksp.common.KSObjectCache
import com.google.devtools.ksp.common.impl.KSNameImpl
import com.google.devtools.ksp.impl.ResolverAAImpl
import com.google.devtools.ksp.impl.recordLookupForPropertyOrMethod
import com.google.devtools.ksp.impl.recordLookupWithSupertypes
import com.google.devtools.ksp.impl.symbol.kotlin.resolved.KSTypeReferenceResolvedImpl
import com.google.devtools.ksp.symbol.*
import org.jetbrains.kotlin.analysis.api.symbols.KtJavaFieldSymbol
Expand Down Expand Up @@ -44,12 +41,7 @@ class KSPropertyDeclarationJavaImpl private constructor(val ktJavaFieldSymbol: K
}

override fun findOverridee(): KSPropertyDeclaration? {
closestClassDeclaration()?.asStarProjectedType()?.let {
recordLookupWithSupertypes((it as KSTypeImpl).type)
}
recordLookupForPropertyOrMethod(this)
TODO("Not yet implemented")
// ?.also { recordLookupForPropertyOrMethod(it) }
return null
}

override fun asMemberOf(containing: KSType): KSType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ class KSPAATest : AbstractKSPAATest() {
runTest("../test-utils/testData/api/overridee/conflictingOverride.kt")
}

@Disabled
@TestMetadata("javaAccessor.kt")
@Test
fun testJavaAccessor() {
Expand Down

0 comments on commit 31c5d7c

Please sign in to comment.