mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #11637 from igfoo/igfoo/kotlin-1.8
Kotlin: Add 1.8 support
This commit is contained in:
@@ -46,6 +46,9 @@ sourceSets {
|
||||
|
||||
"utils/versions/v_1_7_20-Beta/createImplicitParameterDeclarationWithWrappedDescriptor.kt",
|
||||
"utils/versions/v_1_7_20-Beta/allOverriddenIncludingSelf.kt",
|
||||
|
||||
"utils/versions/v_1_8_0/ExperimentalCompilerApi.kt",
|
||||
"utils/versions/v_1_8_0/FirIncompatiblePluginAPI.kt",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ def version_string_to_tuple(version):
|
||||
return tuple([int(m.group(i)) for i in range(1, 4)] + [m.group(4)])
|
||||
|
||||
# Version number used by CI. It needs to be one of the versions in many_versions.
|
||||
ci_version = '1.7.20'
|
||||
ci_version = '1.8.0'
|
||||
|
||||
# Version numbers in the list need to be in semantically increasing order
|
||||
many_versions = [ '1.4.32', '1.5.0', '1.5.10', '1.5.20', '1.5.30', '1.6.0', '1.6.20', '1.7.0', '1.7.20' ]
|
||||
many_versions = [ '1.4.32', '1.5.0', '1.5.10', '1.5.20', '1.5.30', '1.6.0', '1.6.20', '1.7.0', '1.7.20', '1.8.0' ]
|
||||
|
||||
many_versions_tuples = [version_string_to_tuple(v) for v in many_versions]
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.github.codeql
|
||||
import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption
|
||||
import org.jetbrains.kotlin.compiler.plugin.CliOption
|
||||
import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor
|
||||
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.CompilerConfigurationKey
|
||||
|
||||
@OptIn(ExperimentalCompilerApi::class)
|
||||
class KotlinExtractorCommandLineProcessor : CommandLineProcessor {
|
||||
override val pluginId = "kotlin-extractor"
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
// For ComponentRegistrar
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.github.codeql
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
|
||||
import com.intellij.mock.MockProject
|
||||
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
|
||||
@OptIn(ExperimentalCompilerApi::class)
|
||||
class KotlinExtractorComponentRegistrar : ComponentRegistrar {
|
||||
override fun registerProjectComponents(
|
||||
project: MockProject,
|
||||
|
||||
@@ -1387,7 +1387,7 @@ open class KotlinFileExtractor(
|
||||
|
||||
private fun getNullabilityAnnotation(t: IrType, declOrigin: IrDeclarationOrigin, existingAnnotations: List<IrConstructorCall>, javaAnnotations: Collection<JavaAnnotation>?) =
|
||||
getNullabilityAnnotationName(t, declOrigin, existingAnnotations, javaAnnotations)?.let {
|
||||
pluginContext.referenceClass(it)?.let { annotationClass ->
|
||||
getClassByFqName(pluginContext, it)?.let { annotationClass ->
|
||||
annotationClass.owner.declarations.firstIsInstanceOrNull<IrConstructor>()?.let { annotationConstructor ->
|
||||
IrConstructorCallImpl.fromSymbolOwner(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, annotationConstructor.returnType, annotationConstructor.symbol, 0
|
||||
@@ -1709,6 +1709,10 @@ open class KotlinFileExtractor(
|
||||
when (b.kind) {
|
||||
IrSyntheticBodyKind.ENUM_VALUES -> tw.writeKtSyntheticBody(callable, 1)
|
||||
IrSyntheticBodyKind.ENUM_VALUEOF -> tw.writeKtSyntheticBody(callable, 2)
|
||||
else -> {
|
||||
// TODO: Support IrSyntheticBodyKind.ENUM_ENTRIES
|
||||
logger.errorElement("Unhandled synthetic body kind " + b.kind.javaClass, b)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2400,7 +2404,7 @@ open class KotlinFileExtractor(
|
||||
|
||||
private fun findTopLevelFunctionOrWarn(functionFilter: String, type: String, parameterTypes: Array<String>, warnAgainstElement: IrElement): IrFunction? {
|
||||
|
||||
val fn = pluginContext.referenceFunctions(FqName(functionFilter))
|
||||
val fn = getFunctionsByFqName(pluginContext, functionFilter)
|
||||
.firstOrNull { fnSymbol ->
|
||||
fnSymbol.owner.parentClassOrNull?.fqNameWhenAvailable?.asString() == type &&
|
||||
fnSymbol.owner.valueParameters.map { it.type.classFqName?.asString() }.toTypedArray() contentEquals parameterTypes
|
||||
@@ -2419,7 +2423,7 @@ open class KotlinFileExtractor(
|
||||
|
||||
private fun findTopLevelPropertyOrWarn(propertyFilter: String, type: String, warnAgainstElement: IrElement): IrProperty? {
|
||||
|
||||
val prop = pluginContext.referenceProperties(FqName(propertyFilter))
|
||||
val prop = getPropertiesByFqName(pluginContext, propertyFilter)
|
||||
.firstOrNull { it.owner.parentClassOrNull?.fqNameWhenAvailable?.asString() == type }
|
||||
?.owner
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ open class KotlinUsesExtractor(
|
||||
val globalExtensionState: KotlinExtractorGlobalState
|
||||
) {
|
||||
fun referenceExternalClass(name: String) =
|
||||
pluginContext.referenceClass(FqName(name))?.owner.also {
|
||||
getClassByFqName(pluginContext, FqName(name))?.owner.also {
|
||||
if (it == null)
|
||||
logger.warn("Unable to resolve external class $name")
|
||||
else
|
||||
@@ -118,7 +118,7 @@ open class KotlinUsesExtractor(
|
||||
}
|
||||
|
||||
fun getJavaEquivalentClass(c: IrClass) =
|
||||
getJavaEquivalentClassId(c)?.let { pluginContext.referenceClass(it.asSingleFqName()) }?.owner
|
||||
getJavaEquivalentClassId(c)?.let { getClassByFqName(pluginContext, it.asSingleFqName()) }?.owner
|
||||
|
||||
/**
|
||||
* Gets a KotlinFileExtractor based on this one, except it attributes locations to the file that declares the given class.
|
||||
@@ -328,7 +328,7 @@ open class KotlinUsesExtractor(
|
||||
return@getOrPut null
|
||||
}
|
||||
|
||||
val result = pluginContext.referenceClass(qualifiedName)?.owner
|
||||
val result = getClassByFqName(pluginContext, qualifiedName)?.owner
|
||||
if (result != null) {
|
||||
logger.info("Replaced synthetic class ${c.name} with its real equivalent")
|
||||
return@getOrPut result
|
||||
@@ -337,7 +337,7 @@ open class KotlinUsesExtractor(
|
||||
// The above doesn't work for (some) generated nested classes, such as R$id, which should be R.id
|
||||
val fqn = qualifiedName.asString()
|
||||
if (fqn.indexOf('$') >= 0) {
|
||||
val nested = pluginContext.referenceClass(FqName(fqn.replace('$', '.')))?.owner
|
||||
val nested = getClassByFqName(pluginContext, fqn.replace('$', '.'))?.owner
|
||||
if (nested != null) {
|
||||
logger.info("Replaced synthetic nested class ${c.name} with its real equivalent")
|
||||
return@getOrPut nested
|
||||
@@ -454,7 +454,7 @@ open class KotlinUsesExtractor(
|
||||
}
|
||||
|
||||
fun tryGetPair(arity: Int): Pair<IrClass, List<IrTypeArgument>?>? {
|
||||
val replaced = pluginContext.referenceClass(fqName)?.owner ?: return null
|
||||
val replaced = getClassByFqName(pluginContext, fqName)?.owner ?: return null
|
||||
return Pair(replaced, List(arity) { makeTypeProjection(pluginContext.irBuiltIns.anyNType, Variance.INVARIANT) })
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.jetbrains.kotlin.ir.declarations.IrPackageFragment
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.types.classOrNull
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import com.github.codeql.utils.*
|
||||
|
||||
class PrimitiveTypeMapping(val logger: Logger, val pluginContext: IrPluginContext) {
|
||||
fun getPrimitiveInfo(s: IrSimpleType) =
|
||||
@@ -25,7 +26,7 @@ class PrimitiveTypeMapping(val logger: Logger, val pluginContext: IrPluginContex
|
||||
)
|
||||
|
||||
private fun findClass(fqName: String, fallback: IrClass): IrClass {
|
||||
val symbol = pluginContext.referenceClass(FqName(fqName))
|
||||
val symbol = getClassByFqName(pluginContext, fqName)
|
||||
if(symbol == null) {
|
||||
logger.warn("Can't find $fqName")
|
||||
// Do the best we can
|
||||
|
||||
33
java/kotlin-extractor/src/main/kotlin/utils/GetByFqName.kt
Normal file
33
java/kotlin-extractor/src/main/kotlin/utils/GetByFqName.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.github.codeql.utils
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.extensions.FirIncompatiblePluginAPI
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
fun getClassByFqName(pluginContext: IrPluginContext, fqName: String): IrClassSymbol? {
|
||||
return getClassByFqName(pluginContext, FqName(fqName))
|
||||
}
|
||||
|
||||
fun getClassByFqName(pluginContext: IrPluginContext, fqName: FqName): IrClassSymbol? {
|
||||
@OptIn(FirIncompatiblePluginAPI::class)
|
||||
return pluginContext.referenceClass(fqName)
|
||||
}
|
||||
|
||||
fun getFunctionsByFqName(pluginContext: IrPluginContext, fqName: String): Collection<IrSimpleFunctionSymbol> {
|
||||
return getFunctionsByFqName(pluginContext, FqName(fqName))
|
||||
}
|
||||
|
||||
fun getFunctionsByFqName(pluginContext: IrPluginContext, fqName: FqName): Collection<IrSimpleFunctionSymbol> {
|
||||
@OptIn(FirIncompatiblePluginAPI::class)
|
||||
return pluginContext.referenceFunctions(fqName)
|
||||
}
|
||||
|
||||
fun getPropertiesByFqName(pluginContext: IrPluginContext, fqName: String): Collection<IrPropertySymbol> {
|
||||
return getPropertiesByFqName(pluginContext, FqName(fqName))
|
||||
}
|
||||
|
||||
fun getPropertiesByFqName(pluginContext: IrPluginContext, fqName: FqName): Collection<IrPropertySymbol> {
|
||||
@OptIn(FirIncompatiblePluginAPI::class)
|
||||
return pluginContext.referenceProperties(fqName)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.jetbrains.kotlin.compiler.plugin
|
||||
|
||||
@RequiresOptIn("This API is experimental. There are no stability guarantees for it")
|
||||
annotation class ExperimentalCompilerApi
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.jetbrains.kotlin.backend.common.extensions
|
||||
|
||||
@RequiresOptIn("This API is not available after FIR")
|
||||
annotation class FirIncompatiblePluginAPI
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.github.codeql
|
||||
|
||||
// The compiler provides the annotation class, so we don't need to do
|
||||
// anything
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.github.codeql
|
||||
|
||||
// The compiler provides the annotation class, so we don't need to do
|
||||
// anything
|
||||
@@ -146,25 +146,24 @@ test.kt:
|
||||
# 19| 1: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 20| 2: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 20| 1: [ArrayInit] {...}
|
||||
# 20| 1: [IntegerLiteral] 1
|
||||
# 21| 3: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [IntegerLiteral] 2
|
||||
# 21| 1: [ArrayInit] {...}
|
||||
# 21| 1: [IntegerLiteral] 1
|
||||
# 21| 2: [IntegerLiteral] 2
|
||||
# 22| 4: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [IntegerLiteral] 2
|
||||
# 0| 3: [IntegerLiteral] 3
|
||||
# 22| 1: [ArrayInit] {...}
|
||||
# 22| 1: [IntegerLiteral] 1
|
||||
# 22| 2: [IntegerLiteral] 2
|
||||
# 22| 3: [IntegerLiteral] 3
|
||||
# 23| 5: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [IntegerLiteral] 2
|
||||
# 0| 3: [IntegerLiteral] 3
|
||||
# 23| 1: [ArrayInit] {...}
|
||||
# 23| 1: [IntegerLiteral] 1
|
||||
# 23| 2: [IntegerLiteral] 2
|
||||
# 23| 3: [IntegerLiteral] 3
|
||||
# 17| 2: [Annotation] Ann1
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [Annotation] Ann2
|
||||
# 0| 1: [Annotation] Ann2
|
||||
# 0| 1: [StringLiteral] "Hello"
|
||||
# 0| 2: [TypeLiteral] String.class
|
||||
# 0| 0: [TypeAccess] String
|
||||
@@ -182,16 +181,17 @@ test.kt:
|
||||
# 0| 0: [TypeAccess] String
|
||||
# 0| 2: [TypeLiteral] int.class
|
||||
# 0| 0: [TypeAccess] int
|
||||
# 0| 3: [VarAccess] DayOfWeek.MONDAY
|
||||
# 0| -1: [TypeAccess] DayOfWeek
|
||||
# 17| 2: [IntegerLiteral] 1
|
||||
# 17| 3: [VarAccess] DayOfWeek.MONDAY
|
||||
# 17| -1: [TypeAccess] DayOfWeek
|
||||
# 18| 3: [Annotation] GenericAnnotation
|
||||
# 0| 1: [TypeLiteral] String.class
|
||||
# 0| 0: [TypeAccess] String
|
||||
# 0| 2: [ArrayInit] {...}
|
||||
# 0| 1: [TypeLiteral] String.class
|
||||
# 0| 0: [TypeAccess] String
|
||||
# 0| 2: [TypeLiteral] String.class
|
||||
# 0| 0: [TypeAccess] String
|
||||
# 18| 1: [TypeLiteral] String.class
|
||||
# 18| 0: [TypeAccess] String
|
||||
# 18| 2: [ArrayInit] {...}
|
||||
# 18| 1: [TypeLiteral] String.class
|
||||
# 18| 0: [TypeAccess] String
|
||||
# 18| 2: [TypeLiteral] String.class
|
||||
# 18| 0: [TypeAccess] String
|
||||
# 24| 4: [Annotation] AnnWithDefaults
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [StringLiteral] "hello"
|
||||
@@ -211,25 +211,24 @@ test.kt:
|
||||
# 29| 1: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 30| 2: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 30| 1: [ArrayInit] {...}
|
||||
# 30| 1: [IntegerLiteral] 1
|
||||
# 31| 3: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [IntegerLiteral] 2
|
||||
# 31| 1: [ArrayInit] {...}
|
||||
# 31| 1: [IntegerLiteral] 1
|
||||
# 31| 2: [IntegerLiteral] 2
|
||||
# 32| 4: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [IntegerLiteral] 2
|
||||
# 0| 3: [IntegerLiteral] 3
|
||||
# 32| 1: [ArrayInit] {...}
|
||||
# 32| 1: [IntegerLiteral] 1
|
||||
# 32| 2: [IntegerLiteral] 2
|
||||
# 32| 3: [IntegerLiteral] 3
|
||||
# 33| 5: [Annotation] VarargAnnotation
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [IntegerLiteral] 2
|
||||
# 0| 3: [IntegerLiteral] 3
|
||||
# 33| 1: [ArrayInit] {...}
|
||||
# 33| 1: [IntegerLiteral] 1
|
||||
# 33| 2: [IntegerLiteral] 2
|
||||
# 33| 3: [IntegerLiteral] 3
|
||||
# 27| 2: [Annotation] Ann1
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [Annotation] Ann2
|
||||
# 0| 1: [Annotation] Ann2
|
||||
# 0| 1: [StringLiteral] "Hello"
|
||||
# 0| 2: [TypeLiteral] String.class
|
||||
# 0| 0: [TypeAccess] String
|
||||
@@ -247,16 +246,17 @@ test.kt:
|
||||
# 0| 0: [TypeAccess] String
|
||||
# 0| 2: [TypeLiteral] int.class
|
||||
# 0| 0: [TypeAccess] int
|
||||
# 0| 3: [VarAccess] DayOfWeek.MONDAY
|
||||
# 0| -1: [TypeAccess] DayOfWeek
|
||||
# 27| 2: [IntegerLiteral] 1
|
||||
# 27| 3: [VarAccess] DayOfWeek.MONDAY
|
||||
# 27| -1: [TypeAccess] DayOfWeek
|
||||
# 28| 3: [Annotation] GenericAnnotation
|
||||
# 0| 1: [TypeLiteral] String.class
|
||||
# 0| 0: [TypeAccess] String
|
||||
# 0| 2: [ArrayInit] {...}
|
||||
# 0| 1: [TypeLiteral] String.class
|
||||
# 0| 0: [TypeAccess] String
|
||||
# 0| 2: [TypeLiteral] String.class
|
||||
# 0| 0: [TypeAccess] String
|
||||
# 28| 1: [TypeLiteral] String.class
|
||||
# 28| 0: [TypeAccess] String
|
||||
# 28| 2: [ArrayInit] {...}
|
||||
# 28| 1: [TypeLiteral] String.class
|
||||
# 28| 0: [TypeAccess] String
|
||||
# 28| 2: [TypeLiteral] String.class
|
||||
# 28| 0: [TypeAccess] String
|
||||
# 34| 4: [Annotation] AnnWithDefaults
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 0| 2: [StringLiteral] "hello"
|
||||
@@ -279,7 +279,7 @@ test.kt:
|
||||
# 40| 11: [Class] HasKotlinDeprecatedAnnotationUsedByJava
|
||||
#-----| -3: (Annotations)
|
||||
# 40| 1: [Annotation] Deprecated
|
||||
# 0| 1: [StringLiteral] "Kotlin deprecation message 1"
|
||||
# 40| 1: [StringLiteral] "Kotlin deprecation message 1"
|
||||
# 41| 1: [Constructor] HasKotlinDeprecatedAnnotationUsedByJava
|
||||
# 40| 5: [BlockStmt] { ... }
|
||||
# 40| 0: [SuperConstructorInvocationStmt] super(...)
|
||||
@@ -294,7 +294,7 @@ test.kt:
|
||||
# 46| 13: [Class] HasKotlinDeprecatedAnnotationUsedByKotlin
|
||||
#-----| -3: (Annotations)
|
||||
# 46| 1: [Annotation] Deprecated
|
||||
# 0| 1: [StringLiteral] "Kotlin deprecation message 2"
|
||||
# 46| 1: [StringLiteral] "Kotlin deprecation message 2"
|
||||
# 47| 1: [Constructor] HasKotlinDeprecatedAnnotationUsedByKotlin
|
||||
# 46| 5: [BlockStmt] { ... }
|
||||
# 46| 0: [SuperConstructorInvocationStmt] super(...)
|
||||
|
||||
@@ -32,7 +32,7 @@ with open('logs.csv', 'w', newline='') as f_out:
|
||||
j = json.loads(line)
|
||||
msg = j['message']
|
||||
msg = re.sub(r'(?<=Extraction for invocation TRAP file ).*[\\/]kt-db[\\/]trap[\\/]java[\\/]invocations[\\/]kotlin\..*\.trap', '<FILENAME>', msg)
|
||||
msg = re.sub('(?<=Kotlin version )[0-9.]+', '<VERSION>', msg)
|
||||
msg = re.sub('(?<=Kotlin version )[0-9.]+(-[a-zA-Z0-9.]+)?', '<VERSION>', msg)
|
||||
if msg.startswith('Peak memory: '):
|
||||
# Peak memory information varies from run to run, so just ignore it
|
||||
continue
|
||||
|
||||
@@ -2,11 +2,13 @@ package com.github.codeql
|
||||
|
||||
import com.intellij.mock.MockProject
|
||||
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
|
||||
import org.jetbrains.kotlin.backend.common.extensions.FirIncompatiblePluginAPI
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||
import org.jetbrains.kotlin.backend.common.ir.addDispatchReceiver
|
||||
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
||||
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||
@@ -35,6 +37,7 @@ import org.jetbrains.kotlin.ir.util.defaultType
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
@OptIn(ExperimentalCompilerApi::class)
|
||||
class TestComponentRegistrar : ComponentRegistrar {
|
||||
override fun registerProjectComponents(
|
||||
project: MockProject,
|
||||
@@ -188,6 +191,7 @@ class IrAdder : IrGenerationExtension {
|
||||
}
|
||||
|
||||
private fun addFunWithUnsafeCoerce(declaration: IrClass) {
|
||||
@OptIn(FirIncompatiblePluginAPI::class)
|
||||
val uintType = pluginContext.referenceClass(FqName("kotlin.UInt"))!!.owner.typeWith()
|
||||
declaration.declarations.add(pluginContext.irFactory.buildFun {
|
||||
name = Name.identifier("<fn>")
|
||||
@@ -264,6 +268,7 @@ class IrAdder : IrGenerationExtension {
|
||||
name = Name.identifier("start")
|
||||
origin = IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
|
||||
modality = Modality.FINAL
|
||||
@OptIn(FirIncompatiblePluginAPI::class)
|
||||
returnType = pluginContext.referenceClass(FqName("java.lang.Process"))!!.owner.defaultType
|
||||
}.apply {
|
||||
addDispatchReceiver { type = processBuilderStubType }
|
||||
|
||||
@@ -108,39 +108,39 @@ def.kt:
|
||||
# 0| 9: [VarAccess] ElementType.TYPE_USE
|
||||
# 0| -1: [TypeAccess] ElementType
|
||||
# 5| 3: [Annotation] Target
|
||||
# 0| 1: [ArrayInit] {...}
|
||||
# 0| 1: [VarAccess] AnnotationTarget.CLASS
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 2: [VarAccess] AnnotationTarget.ANNOTATION_CLASS
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 3: [VarAccess] AnnotationTarget.TYPE_PARAMETER
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 4: [VarAccess] AnnotationTarget.PROPERTY
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 5: [VarAccess] AnnotationTarget.FIELD
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 6: [VarAccess] AnnotationTarget.LOCAL_VARIABLE
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 7: [VarAccess] AnnotationTarget.VALUE_PARAMETER
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 8: [VarAccess] AnnotationTarget.CONSTRUCTOR
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 9: [VarAccess] AnnotationTarget.FUNCTION
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 10: [VarAccess] AnnotationTarget.PROPERTY_GETTER
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 11: [VarAccess] AnnotationTarget.PROPERTY_SETTER
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 12: [VarAccess] AnnotationTarget.TYPE
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 13: [VarAccess] AnnotationTarget.FILE
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 0| 14: [VarAccess] AnnotationTarget.TYPEALIAS
|
||||
# 0| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 1: [ArrayInit] {...}
|
||||
# 5| 1: [VarAccess] AnnotationTarget.CLASS
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 2: [VarAccess] AnnotationTarget.ANNOTATION_CLASS
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 3: [VarAccess] AnnotationTarget.TYPE_PARAMETER
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 4: [VarAccess] AnnotationTarget.PROPERTY
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 5: [VarAccess] AnnotationTarget.FIELD
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 6: [VarAccess] AnnotationTarget.LOCAL_VARIABLE
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 7: [VarAccess] AnnotationTarget.VALUE_PARAMETER
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 8: [VarAccess] AnnotationTarget.CONSTRUCTOR
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 9: [VarAccess] AnnotationTarget.FUNCTION
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 10: [VarAccess] AnnotationTarget.PROPERTY_GETTER
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 11: [VarAccess] AnnotationTarget.PROPERTY_SETTER
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 12: [VarAccess] AnnotationTarget.TYPE
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 13: [VarAccess] AnnotationTarget.FILE
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 5| 14: [VarAccess] AnnotationTarget.TYPEALIAS
|
||||
# 5| -1: [TypeAccess] AnnotationTarget
|
||||
# 21| 1: [Method] a
|
||||
#-----| 1: (Annotations)
|
||||
# 21| 1: [Annotation] JvmName
|
||||
# 0| 1: [StringLiteral] "a"
|
||||
# 21| 1: [StringLiteral] "a"
|
||||
# 21| 3: [TypeAccess] int
|
||||
# 23| 3: [Interface] Annot1k
|
||||
#-----| -3: (Annotations)
|
||||
@@ -201,21 +201,21 @@ def.kt:
|
||||
# 38| 6: [Class] Z
|
||||
#-----| -3: (Annotations)
|
||||
# 38| 1: [Annotation] Annot0k
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 38| 1: [IntegerLiteral] 1
|
||||
# 39| 2: [Annotation] Annot1k
|
||||
# 0| 1: [IntegerLiteral] 2
|
||||
# 0| 2: [StringLiteral] "ab"
|
||||
# 0| 3: [TypeLiteral] X.class
|
||||
# 0| 0: [TypeAccess] X
|
||||
# 0| 4: [VarAccess] Y.B
|
||||
# 0| -1: [TypeAccess] Y
|
||||
# 0| 5: [ArrayInit] {...}
|
||||
# 0| 1: [VarAccess] Y.C
|
||||
# 0| -1: [TypeAccess] Y
|
||||
# 0| 2: [VarAccess] Y.A
|
||||
# 0| -1: [TypeAccess] Y
|
||||
# 0| 6: [Annotation] Annot0k
|
||||
# 0| 4: [Annotation] Annot0k
|
||||
# 0| 1: [IntegerLiteral] 1
|
||||
# 39| 5: [VarAccess] Y.B
|
||||
# 39| -1: [TypeAccess] Y
|
||||
# 39| 6: [ArrayInit] {...}
|
||||
# 39| 1: [VarAccess] Y.C
|
||||
# 39| -1: [TypeAccess] Y
|
||||
# 39| 2: [VarAccess] Y.A
|
||||
# 39| -1: [TypeAccess] Y
|
||||
# 42| 1: [Constructor] Z
|
||||
#-----| 1: (Annotations)
|
||||
# 41| 1: [Annotation] Annot0k
|
||||
|
||||
@@ -36,16 +36,16 @@ annotationValues
|
||||
| def.kt:0:0:0:0 | Retention | def.kt:0:0:0:0 | RetentionPolicy.RUNTIME |
|
||||
| def.kt:0:0:0:0 | Retention | def.kt:0:0:0:0 | RetentionPolicy.RUNTIME |
|
||||
| def.kt:0:0:0:0 | Target | def.kt:0:0:0:0 | {...} |
|
||||
| def.kt:5:1:20:1 | Target | def.kt:0:0:0:0 | {...} |
|
||||
| def.kt:21:26:21:42 | JvmName | def.kt:0:0:0:0 | "a" |
|
||||
| def.kt:5:1:20:1 | Target | def.kt:5:9:5:30 | {...} |
|
||||
| def.kt:21:26:21:42 | JvmName | def.kt:21:39:21:41 | "a" |
|
||||
| def.kt:23:1:23:8 | Annot0k | def.kt:0:0:0:0 | 0 |
|
||||
| def.kt:38:1:38:17 | Annot0k | def.kt:0:0:0:0 | 1 |
|
||||
| def.kt:38:1:38:17 | Annot0k | def.kt:38:16:38:16 | 1 |
|
||||
| def.kt:39:1:39:40 | Annot1k | def.kt:0:0:0:0 | 2 |
|
||||
| def.kt:39:1:39:40 | Annot1k | def.kt:0:0:0:0 | "ab" |
|
||||
| def.kt:39:1:39:40 | Annot1k | def.kt:0:0:0:0 | Annot0k |
|
||||
| def.kt:39:1:39:40 | Annot1k | def.kt:0:0:0:0 | X.class |
|
||||
| def.kt:39:1:39:40 | Annot1k | def.kt:0:0:0:0 | Y.B |
|
||||
| def.kt:39:1:39:40 | Annot1k | def.kt:0:0:0:0 | {...} |
|
||||
| def.kt:39:1:39:40 | Annot1k | def.kt:39:14:39:16 | Y.B |
|
||||
| def.kt:39:1:39:40 | Annot1k | def.kt:39:23:39:39 | {...} |
|
||||
| def.kt:41:5:41:12 | Annot0k | def.kt:0:0:0:0 | 0 |
|
||||
| def.kt:45:1:45:8 | Annot0k | def.kt:0:0:0:0 | 0 |
|
||||
| def.kt:46:21:46:28 | Annot0k | def.kt:0:0:0:0 | 0 |
|
||||
|
||||
@@ -15,6 +15,7 @@ enumConstants
|
||||
| describeConstable |
|
||||
| equals |
|
||||
| finalize |
|
||||
| forEach |
|
||||
| getDeclaringClass |
|
||||
| hasMoreElements |
|
||||
| hashCode |
|
||||
@@ -23,8 +24,12 @@ enumConstants
|
||||
| noneOf |
|
||||
| of |
|
||||
| ordinal |
|
||||
| parallelStream |
|
||||
| range |
|
||||
| resolveConstantDesc |
|
||||
| spliterator |
|
||||
| stream |
|
||||
| toArray |
|
||||
| toString |
|
||||
| typeCheck |
|
||||
| usesEnum |
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
| kotlin.Byte | minus |
|
||||
| kotlin.Byte | plus |
|
||||
| kotlin.Byte | rangeTo |
|
||||
| kotlin.Byte | rangeUntil |
|
||||
| kotlin.Byte | rem |
|
||||
| kotlin.Byte | shortValue |
|
||||
| kotlin.Byte | times |
|
||||
|
||||
@@ -269,6 +269,11 @@ compGenerated
|
||||
| file://<external>/CharRange.class:0:0:0:0 | spliterator | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
| file://<external>/Class2.class:0:0:0:0 | getValue | Default property accessor |
|
||||
| file://<external>/Class2.class:0:0:0:0 | getValue | Default property accessor |
|
||||
| file://<external>/EnumEntries.class:0:0:0:0 | forEach | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
| file://<external>/EnumEntries.class:0:0:0:0 | parallelStream | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
| file://<external>/EnumEntries.class:0:0:0:0 | spliterator | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
| file://<external>/EnumEntries.class:0:0:0:0 | stream | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
| file://<external>/EnumEntries.class:0:0:0:0 | toArray | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
| file://<external>/IntProgression.class:0:0:0:0 | forEach | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
| file://<external>/IntProgression.class:0:0:0:0 | spliterator | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
| file://<external>/IntRange.class:0:0:0:0 | forEach | Forwarder for a Kotlin class inheriting an interface default method |
|
||||
|
||||
Reference in New Issue
Block a user