@@ -217,7 +217,8 @@ open class KotlinFileExtractor(
217217 is IrField -> {
218218 val parentId = useDeclarationParent(getFieldParent(declaration), false )?.cast<DbReftype >()
219219 if (parentId != null ) {
220- extractField(declaration, parentId, extractFunctionBodies)
220+ // For consistency with the Java extractor, enum entries get type accesses only if we're extracting from .kt source (i.e., when `extractFunctionBodies` is set)
221+ extractField(declaration, parentId, extractAnnotationEnumTypeAccesses = extractFunctionBodies)
221222 }
222223 Unit
223224 }
@@ -496,7 +497,7 @@ open class KotlinFileExtractor(
496497 private fun replaceKotlinDeprecatedAnnotation (annotations : List <IrConstructorCall >): List <IrConstructorCall > {
497498 val shouldReplace =
498499 annotations.any { (it.type as ? IrSimpleType )?.classFqName?.asString() == " kotlin.Deprecated" } &&
499- annotations.none { ( it.type as ? IrSimpleType )?.classFqName?.asString() == " java.lang.Deprecated " }
500+ annotations.none { it.type.classOrNull == javaLangDeprecated?.symbol }
500501 val jldConstructor = javaLangDeprecatedConstructor
501502 if (! shouldReplace || jldConstructor == null )
502503 return annotations
@@ -508,10 +509,7 @@ open class KotlinFileExtractor(
508509 }
509510
510511 private fun extractAnnotations (c : IrAnnotationContainer , annotations : List <IrConstructorCall >, parent : Label <out DbExprparent >, extractEnumTypeAccesses : Boolean ) {
511- val origin = when (c) {
512- is IrDeclaration -> c.origin
513- else -> null
514- }
512+ val origin = (c as ? IrDeclaration )?.origin ? : run { logger.warn(" Unexpected annotation container: $c " ); return }
515513 val replacedAnnotations =
516514 if (origin == IrDeclarationOrigin .IR_EXTERNAL_JAVA_DECLARATION_STUB )
517515 replaceKotlinDeprecatedAnnotation(annotations)
0 commit comments