For internal methods "getInternalProp" in a module named "lib-xyz",
- Kotlin compiler jvm name is: getInternalProp$lib_xyz.
- KSP2 getJvmName returned: getInternalProp$lib-xyn.
Notice "-" is a java identifier, so kotlin compiler sanitize it here https://github.com/JetBrains/kotlin/blob/684e1b86eec86497829abcd2f1523ba9b5645bb4/analysis/light-classes-base/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt#L199
Not sanitizing a java identifier and generating code with java identifier in method call would cause
(1) mismatch with real jvm name so fail to call the method
(2) fail with things like
error: not a statement
MyClass.INSTANCE.getInternalProp$lib-xyn
Notice this new since kotlin 2.1.0. I did not have this problem in 2.0.20-1.0.24
Repro
acejingbo@44f014d
run KSPAATest.testMangledNames
see it fail with
(Sorry i couldn't create a counter example in ksp1 test, as KSP1 test use - for target platform)
For internal methods "getInternalProp" in a module named "lib-xyz",
Notice "-" is a java identifier, so kotlin compiler sanitize it here https://github.com/JetBrains/kotlin/blob/684e1b86eec86497829abcd2f1523ba9b5645bb4/analysis/light-classes-base/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt#L199
Not sanitizing a java identifier and generating code with java identifier in method call would cause
(1) mismatch with real jvm name so fail to call the method
(2) fail with things like
Notice this new since kotlin 2.1.0. I did not have this problem in 2.0.20-1.0.24
Repro
acejingbo@44f014d
run KSPAATest.testMangledNames
see it fail with
(Sorry i couldn't create a counter example in ksp1 test, as KSP1 test use - for target platform)