@@ -80,6 +80,7 @@ open class KotlinFileExtractor(
80
80
globalExtensionState : KotlinExtractorGlobalState ,
81
81
): KotlinUsesExtractor(logger, tw, dependencyCollector, externalClassExtractor, primitiveTypeMapping, pluginContext, globalExtensionState) {
82
82
83
+ val usesK2 = usesK2(pluginContext)
83
84
val metaAnnotationSupport = MetaAnnotationSupport (logger, pluginContext, this )
84
85
85
86
private inline fun <T > with (kind : String , element : IrElement , f : () -> T ): T {
@@ -166,22 +167,26 @@ open class KotlinFileExtractor(
166
167
else -> false
167
168
}
168
169
169
- @OptIn(ObsoleteDescriptorBasedAPI ::class )
170
- private fun isFake (d : IrDeclarationWithVisibility ): Boolean {
171
- val hasFakeVisibility = d.visibility.let { it is DelegatedDescriptorVisibility && it.delegate == Visibilities .InvisibleFake } || d.isFakeOverride
172
- if (hasFakeVisibility && ! isJavaBinaryObjectMethodRedeclaration(d))
173
- return true
170
+ private fun FunctionDescriptor.tryIsHiddenToOvercomeSignatureClash (d : IrFunction ): Boolean {
174
171
try {
175
- if ((d as ? IrFunction )?.descriptor?.isHiddenToOvercomeSignatureClash == true ) {
176
- return true
177
- }
172
+ return this .isHiddenToOvercomeSignatureClash
178
173
}
179
174
catch (e: NotImplementedError ) {
180
175
// `org.jetbrains.kotlin.ir.descriptors.IrBasedClassConstructorDescriptor.isHiddenToOvercomeSignatureClash` throws the exception
181
- logger.warnElement(" Couldn't query if element is fake, deciding it's not." , d, e)
176
+ // TODO: We need a replacement for this for Kotlin 2
177
+ if (! usesK2) {
178
+ logger.warnElement(" Couldn't query if element is fake, deciding it's not." , d, e)
179
+ }
182
180
return false
183
181
}
184
- return false
182
+ }
183
+
184
+ @OptIn(ObsoleteDescriptorBasedAPI ::class )
185
+ private fun isFake (d : IrDeclarationWithVisibility ): Boolean {
186
+ val hasFakeVisibility = d.visibility.let { it is DelegatedDescriptorVisibility && it.delegate == Visibilities .InvisibleFake } || d.isFakeOverride
187
+ if (hasFakeVisibility && ! isJavaBinaryObjectMethodRedeclaration(d))
188
+ return true
189
+ return (d as ? IrFunction )?.descriptor?.tryIsHiddenToOvercomeSignatureClash(d) == true
185
190
}
186
191
187
192
private fun shouldExtractDecl (declaration : IrDeclaration , extractPrivateMembers : Boolean ) =
0 commit comments