Skip to content

Commit

Permalink
fix jvm name for annotation values
Browse files Browse the repository at this point in the history
  • Loading branch information
neetopia committed Feb 13, 2024
1 parent b8a1a1a commit 42df0ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ class ResolverAAImpl(

// TODO: handle @JvmName annotations, mangled names
override fun getJvmName(accessor: KSPropertyAccessor): String? {
if (accessor.receiver.closestClassDeclaration()?.classKind == ClassKind.ANNOTATION_CLASS) {
return accessor.receiver.simpleName.asString()
}
val prefix = if (accessor is KSPropertyGetter) {
"get"
} else {
Expand Down
3 changes: 3 additions & 0 deletions test-utils/testData/api/mangledNames.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
// inlineReturningFun -> inlineReturningFun-HRn7Rpw
// internalInlineReceivingFun -> internalInlineReceivingFun-E03SJzc$mainModule
// internalInlineReturningFun -> internalInlineReturningFun-HRn7Rpw$mainModule
// mainPackage.Anno -> declarations
// get-a -> a
// mainPackage.AbstractKotlinClass -> declarations
// get-abstractVar -> getAbstractVar
// set-abstractVar -> setAbstractVar
Expand Down Expand Up @@ -151,6 +153,7 @@ class Foo {
internal fun internalInlineReturningFun(): Inline1 = TODO()
}

annotation class Anno(val a: String)
abstract class AbstractKotlinClass {
abstract var abstractVar:String
abstract val abstractVal:String
Expand Down

0 comments on commit 42df0ec

Please sign in to comment.