Kotlin 2.4.0: Fix bazel formatting, change-note category, and internal query style

- Fix BUILD.bazel formatting (buildifier line wrapping)
- Fix change-note category: 'deprecation' -> 'deprecated'
- Replace unsafe list casts with filterIsInstance to satisfy
  the possiblyThrowingExpressions internal query

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anders Fugmann
2026-06-08 16:19:10 +02:00
parent 557f904e22
commit c11d82737a
3 changed files with 9 additions and 8 deletions

View File

@@ -114,8 +114,11 @@ kt_javac_options(
"cp $(execpath %s) $(RULEDIR)/%s/%s" % (source, v, target)
for source, target in _resources
] + (
["cp $(execpath %s) $(RULEDIR)/%s/%s" % (_compiler_plugin_registrar_service[0], v, _compiler_plugin_registrar_service[1])]
if not version_less(v, "2.4.0") else []
["cp $(execpath %s) $(RULEDIR)/%s/%s" % (
_compiler_plugin_registrar_service[0],
v,
_compiler_plugin_registrar_service[1],
)] if not version_less(v, "2.4.0") else []
)),
),
kt_jvm_library(

View File

@@ -86,15 +86,13 @@ val IrMemberAccessExpression<*>.codeQlTypeArgumentsCount: Int
fun IrMemberAccessExpression<*>.codeQlGetTypeArgument(index: Int): IrType? = typeArguments[index]
// addAnnotations compat: in 2.4.0, addAnnotations expects List<IrAnnotation>
// IrAnnotation extends IrConstructorCall, so we cast
@Suppress("UNCHECKED_CAST")
// IrConstructorCall implements IrAnnotation in 2.4.0, so filterIsInstance is identity
fun IrType.codeQlAddAnnotations(annotations: List<IrConstructorCall>): IrType =
addAnnotations(annotations as List<IrAnnotation>)
addAnnotations(annotations.filterIsInstance<IrAnnotation>())
// IrMutableAnnotationContainer.annotations setter: in 2.4.0, expects List<IrAnnotation>
@Suppress("UNCHECKED_CAST")
fun codeQlSetAnnotations(container: org.jetbrains.kotlin.ir.declarations.IrMutableAnnotationContainer, annotations: List<IrConstructorCall>) {
container.annotations = annotations as List<IrAnnotation>
container.annotations = annotations.filterIsInstance<IrAnnotation>()
}
// IrFunction: set dispatch receiver parameter

View File

@@ -1,4 +1,4 @@
---
category: deprecation
category: deprecated
---
* Kotlin versions below 2.0.0 are no longer supported for analysis. The minimum supported version is now Kotlin 2.0.0.