@@ -217,7 +217,8 @@ open class KotlinFileExtractor(
217
217
is IrField -> {
218
218
val parentId = useDeclarationParent(getFieldParent(declaration), false )?.cast<DbReftype >()
219
219
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)
221
222
}
222
223
Unit
223
224
}
@@ -496,7 +497,7 @@ open class KotlinFileExtractor(
496
497
private fun replaceKotlinDeprecatedAnnotation (annotations : List <IrConstructorCall >): List <IrConstructorCall > {
497
498
val shouldReplace =
498
499
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 }
500
501
val jldConstructor = javaLangDeprecatedConstructor
501
502
if (! shouldReplace || jldConstructor == null )
502
503
return annotations
@@ -508,10 +509,7 @@ open class KotlinFileExtractor(
508
509
}
509
510
510
511
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 }
515
513
val replacedAnnotations =
516
514
if (origin == IrDeclarationOrigin .IR_EXTERNAL_JAVA_DECLARATION_STUB )
517
515
replaceKotlinDeprecatedAnnotation(annotations)
0 commit comments