[kotlinp] Split :tools:kotlinp into "common" and "jvm" subprojects

The "common" subproject keeps only backend-neutral logic and depends
only on :kotlinx-metadata library. It takes the name of the former
project - :tools:kotlinp

The "jvm" subproject depends on the "common" one and also depends
on :kotlinx-metadata-jvm. It gets the new name - :tools:kotlinp-jvm

There is a lot of touched files in this commit. The majority of them
is just moved files (tests, test data, etc).

Only the following files were actually modified:
  .space/CODEOWNERS
  build.gradle.kts
  libraries/tools/abi-comparator/build.gradle.kts
  libraries/tools/kotlinp/build.gradle.kts
  libraries/tools/kotlinp/jvm/build.gradle.kts
  plugins/kapt3/kapt3-compiler/build.gradle.kts
  settings.gradle

 ^KT-62340
This commit is contained in:
Dmitriy Dolovov
2024-02-08 21:32:02 +01:00
committed by Space Team
parent eec76865a7
commit d30efdb001
89 changed files with 151 additions and 133 deletions
@@ -0,0 +1,64 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
description = "kotlinp-jvm"
plugins {
kotlin("jvm")
id("jps-compatible")
}
val kotlinpAsmVersion = "9.0"
val shadows by configurations.creating
dependencies {
compileOnly(project(":kotlinx-metadata"))
compileOnly(project(":kotlinx-metadata-jvm"))
api(project(":tools:kotlinp"))
implementation("org.jetbrains.intellij.deps:asm-all:$kotlinpAsmVersion")
testApi(intellijCore())
testCompileOnly(project(":kotlinx-metadata"))
testCompileOnly(project(":kotlinx-metadata-jvm"))
testImplementation(libs.junit4)
testImplementation(projectTests(":compiler:tests-common"))
testImplementation(projectTests(":generators:test-generator"))
testRuntimeOnly(project(":kotlinx-metadata-jvm"))
shadows(project(":kotlinx-metadata-jvm"))
shadows("org.jetbrains.intellij.deps:asm-all:$kotlinpAsmVersion")
}
sourceSets {
"main" { projectDefault() }
"test" { projectDefault() }
}
projectTest {
workingDir = rootDir
}
val generateTests by generator("org.jetbrains.kotlin.kotlinp.test.GenerateKotlinpTestsKt")
val shadowJar by task<ShadowJar> {
archiveClassifier.set("shadow")
archiveVersion.set("")
configurations = listOf(shadows)
from(mainSourceSet.output)
manifest {
attributes["Main-Class"] = "org.jetbrains.kotlin.kotlinp.Main"
}
}
tasks {
"assemble" {
dependsOn(shadowJar)
}
"test" {
// These dependencies are needed because ForTestCompileRuntime loads jars from dist
dependsOn(rootProject.tasks.named("dist"))
}
}
@@ -0,0 +1,201 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp
import kotlinx.metadata.*
import kotlinx.metadata.jvm.*
class JvmKotlinp(settings: Settings) : Kotlinp(settings) {
fun printClassFile(classFile: KotlinClassMetadata): String = printString {
when (classFile) {
is KotlinClassMetadata.Class -> renderClass(classFile.kmClass, this)
is KotlinClassMetadata.FileFacade -> renderPackage(classFile.kmPackage, this)
is KotlinClassMetadata.SyntheticClass -> renderSyntheticClass(classFile, this)
is KotlinClassMetadata.MultiFileClassFacade -> renderMultiFileClassFacade(classFile, this)
is KotlinClassMetadata.MultiFileClassPart -> renderMultiFileClassPart(classFile, this)
is KotlinClassMetadata.Unknown -> appendLine("unknown file")
}
}
@OptIn(UnstableMetadataApi::class)
fun printModuleFile(metadata: KotlinModuleMetadata?): String = printString {
if (metadata != null) renderModuleFile(metadata, this)
else appendLine("unsupported file")
}
private fun renderSyntheticClass(clazz: KotlinClassMetadata.SyntheticClass, printer: Printer): Unit = with(printer) {
if (clazz.isLambda) {
appendLine("lambda {")
withIndent {
val lambda = clazz.kmLambda ?: throw KotlinpException("Synthetic class $clazz is not a lambda")
renderFunction(lambda.function, printer)
}
appendLine("}")
} else {
appendLine("synthetic class")
}
}
private fun renderMultiFileClassFacade(clazz: KotlinClassMetadata.MultiFileClassFacade, printer: Printer): Unit = with(printer) {
appendLine("multi-file class {")
withIndent {
for (part in clazz.partClassNames) {
appendCommentedLine(part)
}
}
appendLine("}")
}
private fun renderMultiFileClassPart(clazz: KotlinClassMetadata.MultiFileClassPart, printer: Printer) {
renderPackage(clazz.kmPackage, printer) {
printer.appendCommentedLine("facade: ", clazz.facadeClassName)
}
}
@OptIn(UnstableMetadataApi::class)
fun renderModuleFile(metadata: KotlinModuleMetadata, printer: Printer): Unit = with(printer) {
appendLine("module {")
withIndent {
val module = metadata.kmModule
module.packageParts.forEach { (fqName, kmPackageParts) ->
val presentableFqName = fqName.ifEmpty { "<root>" }
appendLine("package ", presentableFqName, " {")
withIndent {
for (fileFacade in kmPackageParts.fileFacades) {
appendLine(fileFacade)
}
for ((multiFileClassPart, facade) in kmPackageParts.multiFileClassParts) {
appendLine(multiFileClassPart, " (", facade, ")")
}
}
appendLine("}")
}
if (module.optionalAnnotationClasses.isNotEmpty()) {
appendLine()
appendCommentedLine("Optional annotations")
appendLine()
module.optionalAnnotationClasses.forEach { renderClass(it, printer) }
}
}
appendLine("}")
}
override fun getAnnotations(typeParameter: KmTypeParameter) = typeParameter.annotations
override fun getAnnotations(type: KmType) = type.annotations
override fun sortConstructors(constructors: List<KmConstructor>) = constructors.sortedBy { it.signature.toString() }
override fun sortFunctions(functions: List<KmFunction>) = functions.sortedBy { it.signature.toString() }
override fun sortProperties(properties: List<KmProperty>) = properties.sortedBy { it.getterSignature?.toString() ?: it.name }
override fun Printer.appendSignatures(constructor: KmConstructor) {
constructor.signature?.let {
appendCommentedLine("signature: ", it)
}
}
override fun Printer.appendSignatures(function: KmFunction) {
function.signature?.let {
appendCommentedLine("signature: ", it)
}
}
override fun Printer.appendSignatures(property: KmProperty) {
property.fieldSignature?.let {
appendCommentedLine("field: ", it)
}
property.getterSignature?.let {
appendCommentedLine("getter: ", it)
}
property.setterSignature?.let {
appendCommentedLine("setter: ", it)
}
}
override fun Printer.appendCustomAttributes(property: KmProperty) {
property.syntheticMethodForAnnotations?.let {
appendCommentedLine("synthetic method for annotations: ", it)
}
property.syntheticMethodForDelegate?.let {
appendCommentedLine("synthetic method for delegate: ", it)
}
if (property.isMovedFromInterfaceCompanion) {
appendCommentedLine("is moved from interface companion")
}
}
override fun Printer.appendOrigin(clazz: KmClass) {
clazz.anonymousObjectOriginName?.let {
appendCommentedLine("anonymous object origin: ", it)
}
}
override fun Printer.appendOrigin(function: KmFunction) {
function.lambdaClassOriginName?.let {
appendCommentedLine("lambda class origin: ", it)
}
}
override fun Printer.appendCustomAttributes(clazz: KmClass) {
appendExtensions(clazz.localDelegatedProperties, clazz.moduleName)
if (clazz.hasMethodBodiesInInterface) {
appendLine()
appendCommentedLine("has method bodies in interface")
}
if (clazz.isCompiledInCompatibilityMode) {
appendLine()
appendCommentedLine("is compiled in compatibility mode")
}
}
override fun Printer.appendCustomAttributes(pkg: KmPackage) {
appendExtensions(pkg.localDelegatedProperties, pkg.moduleName)
}
private fun Printer.appendExtensions(localDelegatedProperties: List<KmProperty>, moduleName: String?) {
localDelegatedProperties.sortIfNeeded(::sortProperties).forEachIndexed { index, property ->
appendLine()
appendCommentedLine("local delegated property #", index)
// Comment all uncommented lines to not make it look like these properties are declared here
printString { renderProperty(property, this) }
.lineSequence()
.filter { it.isNotBlank() }
.forEach { appendCommentedLine(it) }
}
if (settings.isVerbose) {
moduleName?.let {
appendLine()
appendCommentedLine("module name: ", it)
}
}
}
override fun Printer.appendEnumEntries(clazz: KmClass) {
clazz.enumEntries.forEach { enumEntry ->
appendLine()
appendLine(enumEntry, ",")
}
}
override fun Printer.appendCompileTimeConstant(property: KmProperty): Printer {
return append("...")
}
override fun isRaw(type: KmType) = type.isRaw
override fun renderFlexibleTypeUpperBound(flexibleTypeUpperBound: KmFlexibleTypeUpperBound): String? {
@Suppress("DEPRECATION_ERROR")
return if (flexibleTypeUpperBound.typeFlexibilityId == JvmTypeExtensionVisitor.PLATFORM_TYPE_ID)
printString { appendType(flexibleTypeUpperBound.type) }
else
null
}
}
@@ -0,0 +1,8 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp
class KotlinpException(message: String) : RuntimeException(message)
@@ -0,0 +1,94 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp
import kotlinx.metadata.jvm.UnstableMetadataApi
import java.io.File
import java.io.IOException
import kotlin.system.exitProcess
object Main {
private fun run(args: Array<String>) {
val paths = arrayListOf<String>()
var verbose = false
var sort = false
var i = 0
while (true) {
val arg = args.getOrNull(i++) ?: break
if (arg == "-help" || arg == "-h") {
printUsageAndExit()
} else if (arg == "-sort") {
sort = true
} else if (arg == "-verbose") {
verbose = true
} else if (arg == "-version") {
printVersionAndExit()
} else if (arg.startsWith("-")) {
throw KotlinpException("unsupported argument: $arg")
} else {
paths.add(arg)
}
}
val kotlinp = JvmKotlinp(Settings(isVerbose = verbose, sortDeclarations = sort))
for (path in paths) {
val file = File(path)
if (!file.exists()) throw KotlinpException("file does not exist: $path")
val text = try {
when (file.extension) {
"class" -> kotlinp.printClassFile(readMetadata(readClassFile(file)))
"kotlin_module" -> @OptIn(UnstableMetadataApi::class) kotlinp.printModuleFile(readModuleFile(file))
else -> throw KotlinpException("only .class and .kotlin_module files are supported")
}
} catch (e: IOException) {
throw KotlinpException("I/O operation failed: ${e.message}")
}
print(text)
}
if (paths.isEmpty()) {
throw KotlinpException("no files specified")
}
}
@JvmStatic
fun main(args: Array<String>) {
try {
run(args)
} catch (e: KotlinpException) {
System.err.println("error: " + e.message)
exitProcess(1)
}
}
private fun printUsageAndExit() {
println(
"""kotlinp: print Kotlin declarations in the given class file.
Usage: kotlinp <options> <classes>
where possible options include:
-sort Sort declarations in the output by signature and/or name
-verbose Display information in more detail, minimizing ambiguities but worsening readability
-version Display Kotlin version
-help (-h) Print a synopsis of options
"""
)
exitProcess(0)
}
private fun printVersionAndExit() {
// TODO: get version from manifest
val version = "@snapshot@"
println("Kotlin version " + version + " (JRE " + System.getProperty("java.runtime.version") + ")")
exitProcess(0)
}
}
@@ -0,0 +1,93 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp
import kotlinx.metadata.jvm.KotlinClassMetadata
import kotlinx.metadata.jvm.KotlinModuleMetadata
import kotlinx.metadata.jvm.Metadata
import kotlinx.metadata.jvm.UnstableMetadataApi
import org.jetbrains.org.objectweb.asm.*
import java.io.File
import java.io.FileInputStream
fun ClassReader.readKotlinClassHeader(): Metadata? {
var header: Metadata? = null
try {
val metadataDesc = Type.getDescriptor(Metadata::class.java)
accept(object : ClassVisitor(Opcodes.API_VERSION) {
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? =
if (desc == metadataDesc) readMetadataVisitor { header = it }
else null
}, ClassReader.SKIP_CODE or ClassReader.SKIP_DEBUG or ClassReader.SKIP_FRAMES)
} catch (e: Exception) {
return null
}
return header
}
private fun readMetadataVisitor(output: (Metadata) -> Unit): AnnotationVisitor =
object : AnnotationVisitor(Opcodes.API_VERSION) {
var kind: Int? = null
var metadataVersion: IntArray? = null
var data1: Array<String>? = null
var data2: Array<String>? = null
var extraString: String? = null
var packageName: String? = null
var extraInt: Int? = null
override fun visit(name: String?, value: Any?) {
when (name) {
"k" -> kind = value as? Int
"mv" -> metadataVersion = value as? IntArray
"xs" -> extraString = value as? String
"xi" -> extraInt = value as? Int
"pn" -> packageName = value as? String
}
}
override fun visitArray(name: String?): AnnotationVisitor? =
when (name) {
"d1" -> stringArrayVisitor { data1 = it }
"d2" -> stringArrayVisitor { data2 = it }
else -> null
}
private fun stringArrayVisitor(output: (Array<String>) -> Unit): AnnotationVisitor {
return object : AnnotationVisitor(Opcodes.API_VERSION) {
val strings = mutableListOf<String>()
override fun visit(name: String?, value: Any?) {
(value as? String)?.let(strings::add)
}
override fun visitEnd() {
output(strings.toTypedArray())
}
}
}
override fun visitEnd() {
output(Metadata(kind, metadataVersion, data1, data2, extraString, packageName, extraInt))
}
}
internal fun readClassFile(file: File): Metadata {
return ClassReader(FileInputStream(file)).readKotlinClassHeader() ?: throw KotlinpException("file is not a Kotlin class file: $file")
}
internal fun readMetadata(metadata: Metadata): KotlinClassMetadata {
return try {
KotlinClassMetadata.readLenient(metadata)
} catch (e: IllegalArgumentException) {
throw KotlinpException("inconsistent Kotlin metadata: ${e.message}")
}
}
@OptIn(UnstableMetadataApi::class)
internal fun readModuleFile(file: File): KotlinModuleMetadata? =
runCatching { KotlinModuleMetadata.read(file.readBytes()) }.getOrNull()
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp.test
abstract class AbstractK1KotlinpTest : AbstractKotlinpTest() {
override fun useK2() = false
}
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp.test
abstract class AbstractK2KotlinpTest: AbstractKotlinpTest() {
override fun useK2() = true
}
@@ -0,0 +1,24 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp.test
import org.jetbrains.kotlin.test.TestCaseWithTmpdir
import java.io.File
abstract class AbstractKotlinpTest : TestCaseWithTmpdir() {
abstract fun useK2(): Boolean
protected fun doTest(fileName: String) {
compareAllFiles(
File(fileName),
testRootDisposable,
tmpdir,
compareWithTxt = true,
readWriteAndCompare = true,
useK2 = useK2()
)
}
}
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp.test
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
fun main(args: Array<String>) {
System.setProperty("java.awt.headless", "true")
generateTestGroupSuite(args) {
testGroup("libraries/tools/kotlinp/jvm/test", "libraries/tools/kotlinp/jvm/testData") {
testClass<AbstractK1KotlinpTest> {
model("")
}
testClass<AbstractK2KotlinpTest> {
model("", pattern = "^(.*)\\.kts?$")
}
}
}
}
@@ -0,0 +1,217 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp.test;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.kotlinp.jvm.test.GenerateKotlinpTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("libraries/tools/kotlinp/jvm/testData")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class K1KotlinpTestGenerated extends AbstractK1KotlinpTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTestData() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("libraries/tools/kotlinp/jvm/testData"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("Annotations.kt")
public void testAnnotations() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Annotations.kt");
}
@TestMetadata("Constants.kt")
public void testConstants() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Constants.kt");
}
@TestMetadata("ContextReceivers.kt")
public void testContextReceivers() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/ContextReceivers.kt");
}
@TestMetadata("Contracts.kt")
public void testContracts() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Contracts.kt");
}
@TestMetadata("Delegation.kt")
public void testDelegation() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Delegation.kt");
}
@TestMetadata("EnumEntries.kt")
public void testEnumEntries() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/EnumEntries.kt");
}
@TestMetadata("FunInterface.kt")
public void testFunInterface() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/FunInterface.kt");
}
@TestMetadata("IntersectionTypeInLambdaLiteralAndDelegatedProperty.kt")
public void testIntersectionTypeInLambdaLiteralAndDelegatedProperty() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/IntersectionTypeInLambdaLiteralAndDelegatedProperty.kt");
}
@TestMetadata("Lambda.kt")
public void testLambda() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Lambda.kt");
}
@TestMetadata("LocalDelegatedProperties.kt")
public void testLocalDelegatedProperties() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/LocalDelegatedProperties.kt");
}
@TestMetadata("MultiFileClass.kt")
public void testMultiFileClass() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/MultiFileClass.kt");
}
@TestMetadata("NestedClasses.kt")
public void testNestedClasses() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/NestedClasses.kt");
}
@TestMetadata("NotEnumWithEnumEntriesEnabled.kt")
public void testNotEnumWithEnumEntriesEnabled() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/NotEnumWithEnumEntriesEnabled.kt");
}
@TestMetadata("OptionalAnnotation.kt")
public void testOptionalAnnotation() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/OptionalAnnotation.kt");
}
@TestMetadata("PlatformType.kt")
public void testPlatformType() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/PlatformType.kt");
}
@TestMetadata("Properties.kt")
public void testProperties() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Properties.kt");
}
@TestMetadata("SimpleClass.kt")
public void testSimpleClass() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/SimpleClass.kt");
}
@TestMetadata("SimplePackage.kt")
public void testSimplePackage() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/SimplePackage.kt");
}
@TestMetadata("SyntheticClass.kt")
public void testSyntheticClass() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/SyntheticClass.kt");
}
@TestMetadata("TypeAlias.kt")
public void testTypeAlias() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/TypeAlias.kt");
}
@TestMetadata("TypeParameters.kt")
public void testTypeParameters() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/TypeParameters.kt");
}
@TestMetadata("ValueClass.kt")
public void testValueClass() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/ValueClass.kt");
}
@TestMetadata("VarargInAnnotation.kt")
public void testVarargInAnnotation() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/VarargInAnnotation.kt");
}
@TestMetadata("VersionRequirement.kt")
public void testVersionRequirement() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/VersionRequirement.kt");
}
@TestMetadata("libraries/tools/kotlinp/jvm/testData/jvmDefault")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class JvmDefault extends AbstractK1KotlinpTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("All.kt")
public void testAll() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/jvmDefault/All.kt");
}
@TestMetadata("AllCompatibility.kt")
public void testAllCompatibility() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/jvmDefault/AllCompatibility.kt");
}
public void testAllFilesPresentInJvmDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("libraries/tools/kotlinp/jvm/testData/jvmDefault"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("withCompatibility.kt")
public void testWithCompatibility() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/jvmDefault/withCompatibility.kt");
}
@TestMetadata("withoutCompatibility.kt")
public void testWithoutCompatibility() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/jvmDefault/withoutCompatibility.kt");
}
}
@TestMetadata("libraries/tools/kotlinp/jvm/testData/localClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LocalClasses extends AbstractK1KotlinpTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLocalClasses() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("libraries/tools/kotlinp/jvm/testData/localClasses"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("AnonymousObject.kt")
public void testAnonymousObject() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/localClasses/AnonymousObject.kt");
}
@TestMetadata("DeepInnerLocalChain.kt")
public void testDeepInnerLocalChain() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/localClasses/DeepInnerLocalChain.kt");
}
@TestMetadata("LocalClassInConstructor.kt")
public void testLocalClassInConstructor() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/localClasses/LocalClassInConstructor.kt");
}
@TestMetadata("LocalClassInSignature.kt")
public void testLocalClassInSignature() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/localClasses/LocalClassInSignature.kt");
}
}
}
@@ -0,0 +1,222 @@
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp.test;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.kotlinp.jvm.test.GenerateKotlinpTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("libraries/tools/kotlinp/jvm/testData")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class K2KotlinpTestGenerated extends AbstractK2KotlinpTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTestData() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("libraries/tools/kotlinp/jvm/testData"), Pattern.compile("^(.*)\\.kts?$"), null, true);
}
@TestMetadata("Annotations.kt")
public void testAnnotations() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Annotations.kt");
}
@TestMetadata("Constants.kt")
public void testConstants() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Constants.kt");
}
@TestMetadata("ContextReceivers.kt")
public void testContextReceivers() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/ContextReceivers.kt");
}
@TestMetadata("Contracts.kt")
public void testContracts() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Contracts.kt");
}
@TestMetadata("Delegation.kt")
public void testDelegation() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Delegation.kt");
}
@TestMetadata("EnumEntries.kt")
public void testEnumEntries() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/EnumEntries.kt");
}
@TestMetadata("FunInterface.kt")
public void testFunInterface() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/FunInterface.kt");
}
@TestMetadata("IntersectionTypeInLambdaLiteralAndDelegatedProperty.kt")
public void testIntersectionTypeInLambdaLiteralAndDelegatedProperty() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/IntersectionTypeInLambdaLiteralAndDelegatedProperty.kt");
}
@TestMetadata("Lambda.kt")
public void testLambda() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Lambda.kt");
}
@TestMetadata("LocalDelegatedProperties.kt")
public void testLocalDelegatedProperties() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/LocalDelegatedProperties.kt");
}
@TestMetadata("MultiFileClass.kt")
public void testMultiFileClass() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/MultiFileClass.kt");
}
@TestMetadata("NestedClasses.kt")
public void testNestedClasses() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/NestedClasses.kt");
}
@TestMetadata("NotEnumWithEnumEntriesEnabled.kt")
public void testNotEnumWithEnumEntriesEnabled() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/NotEnumWithEnumEntriesEnabled.kt");
}
@TestMetadata("OptionalAnnotation.kt")
public void testOptionalAnnotation() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/OptionalAnnotation.kt");
}
@TestMetadata("PlatformType.kt")
public void testPlatformType() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/PlatformType.kt");
}
@TestMetadata("Properties.kt")
public void testProperties() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/Properties.kt");
}
@TestMetadata("scriptSimple.kts")
public void testScriptSimple() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/scriptSimple.kts");
}
@TestMetadata("SimpleClass.kt")
public void testSimpleClass() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/SimpleClass.kt");
}
@TestMetadata("SimplePackage.kt")
public void testSimplePackage() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/SimplePackage.kt");
}
@TestMetadata("SyntheticClass.kt")
public void testSyntheticClass() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/SyntheticClass.kt");
}
@TestMetadata("TypeAlias.kt")
public void testTypeAlias() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/TypeAlias.kt");
}
@TestMetadata("TypeParameters.kt")
public void testTypeParameters() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/TypeParameters.kt");
}
@TestMetadata("ValueClass.kt")
public void testValueClass() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/ValueClass.kt");
}
@TestMetadata("VarargInAnnotation.kt")
public void testVarargInAnnotation() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/VarargInAnnotation.kt");
}
@TestMetadata("VersionRequirement.kt")
public void testVersionRequirement() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/VersionRequirement.kt");
}
@TestMetadata("libraries/tools/kotlinp/jvm/testData/jvmDefault")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class JvmDefault extends AbstractK2KotlinpTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("All.kt")
public void testAll() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/jvmDefault/All.kt");
}
@TestMetadata("AllCompatibility.kt")
public void testAllCompatibility() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/jvmDefault/AllCompatibility.kt");
}
public void testAllFilesPresentInJvmDefault() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("libraries/tools/kotlinp/jvm/testData/jvmDefault"), Pattern.compile("^(.*)\\.kts?$"), null, true);
}
@TestMetadata("withCompatibility.kt")
public void testWithCompatibility() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/jvmDefault/withCompatibility.kt");
}
@TestMetadata("withoutCompatibility.kt")
public void testWithoutCompatibility() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/jvmDefault/withoutCompatibility.kt");
}
}
@TestMetadata("libraries/tools/kotlinp/jvm/testData/localClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LocalClasses extends AbstractK2KotlinpTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInLocalClasses() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("libraries/tools/kotlinp/jvm/testData/localClasses"), Pattern.compile("^(.*)\\.kts?$"), null, true);
}
@TestMetadata("AnonymousObject.kt")
public void testAnonymousObject() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/localClasses/AnonymousObject.kt");
}
@TestMetadata("DeepInnerLocalChain.kt")
public void testDeepInnerLocalChain() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/localClasses/DeepInnerLocalChain.kt");
}
@TestMetadata("LocalClassInConstructor.kt")
public void testLocalClassInConstructor() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/localClasses/LocalClassInConstructor.kt");
}
@TestMetadata("LocalClassInSignature.kt")
public void testLocalClassInSignature() throws Exception {
runTest("libraries/tools/kotlinp/jvm/testData/localClasses/LocalClassInSignature.kt");
}
}
}
@@ -0,0 +1,55 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp.test
import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import org.jetbrains.kotlin.test.util.KtTestUtil
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import java.io.File
@RunWith(Parameterized::class)
class KotlinpCompilerTestDataTest(private val file: File) {
private class TestDisposable : Disposable {
override fun dispose() {}
}
@Test
fun doTest() {
val tmpdir = KtTestUtil.tmpDirForTest(this::class.java.simpleName, file.nameWithoutExtension)
val disposable = TestDisposable()
try {
compareAllFiles(file, disposable, tmpdir, compareWithTxt = false, readWriteAndCompare = true, useK2 = false)
} finally {
Disposer.dispose(disposable)
}
}
companion object {
@JvmStatic
@Parameterized.Parameters(name = "{0}")
fun computeTestDataFiles(): Collection<Array<*>> {
val baseDirs = listOf(
"compiler/testData/loadJava/compiledKotlin",
"compiler/testData/loadJava/compiledKotlinWithStdlib",
"compiler/testData/serialization/builtinsSerializer"
)
return mutableListOf<Array<*>>().apply {
for (baseDir in baseDirs) {
for (file in File(baseDir).walkTopDown()) {
if (file.extension == "kt") {
add(arrayOf(file))
}
}
}
}
}
}
}
@@ -0,0 +1,132 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.kotlinp.test
import com.intellij.openapi.Disposable
import junit.framework.TestCase.assertEquals
import kotlinx.metadata.jvm.KotlinClassMetadata
import kotlinx.metadata.jvm.KotlinModuleMetadata
import kotlinx.metadata.jvm.UnstableMetadataApi
import org.jetbrains.kotlin.checkers.setupLanguageVersionSettingsForCompilerTests
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.jvm.compiler.AbstractLoadJavaTest
import org.jetbrains.kotlin.kotlinp.Settings
import org.jetbrains.kotlin.kotlinp.JvmKotlinp
import org.jetbrains.kotlin.kotlinp.readClassFile
import org.jetbrains.kotlin.kotlinp.readModuleFile
import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.test.util.KtTestUtil
import java.io.File
import kotlin.test.fail
private const val IGNORE_K1_DIRECTIVE = "// IGNORE K1"
private const val IGNORE_K2_DIRECTIVE = "// IGNORE K2"
fun compareAllFiles(
file: File,
disposable: Disposable,
tmpdir: File,
compareWithTxt: Boolean,
readWriteAndCompare: Boolean,
useK2: Boolean,
) {
val directive = if (useK2) IGNORE_K2_DIRECTIVE else IGNORE_K1_DIRECTIVE
val isMuted = InTextDirectivesUtils.findStringWithPrefixes(file.readText(), directive) != null
try {
compileAndPrintAllFiles(file, disposable, tmpdir, compareWithTxt, readWriteAndCompare, useK2)
} catch (e: Throwable) {
if (isMuted) return
throw e
}
if (isMuted) {
throw AssertionError("Looks like this test can be unmuted. Remove the \"$directive\" directive.")
}
}
private fun compileAndPrintAllFiles(
file: File,
disposable: Disposable,
tmpdir: File,
compareWithTxt: Boolean,
readWriteAndCompare: Boolean,
useK2: Boolean,
) {
val main = StringBuilder()
val afterNodes = StringBuilder()
val kotlinp = JvmKotlinp(Settings(isVerbose = true, sortDeclarations = true))
@OptIn(UnstableMetadataApi::class)
compile(file, disposable, tmpdir, useK2) { outputFile ->
when (outputFile.extension) {
"kotlin_module" -> {
val moduleFile = readModuleFile(outputFile)!!
val transformedWithNodes = KotlinModuleMetadata.read(moduleFile.write())
for ((sb, moduleFileToRender) in listOf(
main to moduleFile, afterNodes to transformedWithNodes
)) {
sb.appendFileName(outputFile.relativeTo(tmpdir))
sb.append(kotlinp.printModuleFile(moduleFileToRender))
}
}
"class" -> {
val metadata = readClassFile(outputFile)
val classFile = KotlinClassMetadata.readStrict(metadata)
val classFile2 = KotlinClassMetadata.readStrict(classFile.write())
for ((sb, classFileToRender) in listOf(
main to classFile, afterNodes to classFile2
)) {
sb.appendFileName(outputFile.relativeTo(tmpdir))
sb.append(kotlinp.printClassFile(classFileToRender))
}
}
else -> fail("Unknown file: $outputFile")
}
}
if (compareWithTxt) {
val defaultTxtFile = File(file.path.replace(".kts?".toRegex(), ".txt"))
val firTxtFile = File(file.path.replace(".kts?".toRegex(), ".fir.txt"))
val txtFile = if (useK2 && firTxtFile.exists()) firTxtFile else defaultTxtFile
KotlinTestUtils.assertEqualsToFile(txtFile, main.toString())
}
if (readWriteAndCompare && InTextDirectivesUtils.findStringWithPrefixes(file.readText(), "// NO_READ_WRITE_COMPARE") == null) {
assertEquals("Metadata is different after transformation with nodes.", main.toString(), afterNodes.toString())
}
}
private fun compile(file: File, disposable: Disposable, tmpdir: File, useK2: Boolean, forEachOutputFile: (File) -> Unit) {
val content = file.readText()
val configuration = KotlinTestUtils.newConfiguration(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK)
configuration.put(JVMConfigurationKeys.IR, true)
configuration.put(CommonConfigurationKeys.USE_FIR, useK2)
AbstractLoadJavaTest.updateConfigurationWithDirectives(content, configuration)
val environment = KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
setupLanguageVersionSettingsForCompilerTests(content, environment)
val ktFile = KtTestUtil.createFile(file.name, content, environment.project)
GenerationUtils.compileFileTo(ktFile, environment, tmpdir)
for (outputFile in tmpdir.walkTopDown().sortedBy { it.nameWithoutExtension }) {
if (outputFile.isFile) {
forEachOutputFile(outputFile)
}
}
}
private fun StringBuilder.appendFileName(file: File) {
appendLine("// ${file.invariantSeparatorsPath}")
appendLine("// ------------------------------------------")
}
+186
View File
@@ -0,0 +1,186 @@
// A.class
// ------------------------------------------
public final annotation class A : kotlin/Annotation {
// signature: <init>(ZCBSIFJDLkotlin/UInt;Lkotlin/UByte;Lkotlin/UShort;Lkotlin/ULong;Lkotlin/UInt;Lkotlin/UByte;Lkotlin/UShort;Lkotlin/ULong;[Z[C[B[S[I[F[J[DLjava/lang/String;Lkotlin/annotation/AnnotationTarget;Lkotlin/reflect/KClass;Lkotlin/reflect/KClass;LB;Lkotlin/Array;Lkotlin/Array;Lkotlin/Array;Lkotlin/Array;)V
public constructor(z: kotlin/Boolean, c: kotlin/Char, b: kotlin/Byte, s: kotlin/Short, i: kotlin/Int, f: kotlin/Float, j: kotlin/Long, d: kotlin/Double, ui: kotlin/UInt, ub: kotlin/UByte, us: kotlin/UShort, ul: kotlin/ULong, ui_max: kotlin/UInt, ub_max: kotlin/UByte, us_max: kotlin/UShort, ul_max: kotlin/ULong, za: kotlin/BooleanArray, ca: kotlin/CharArray, ba: kotlin/ByteArray, sa: kotlin/ShortArray, ia: kotlin/IntArray, fa: kotlin/FloatArray, ja: kotlin/LongArray, da: kotlin/DoubleArray, str: kotlin/String, enum: kotlin/annotation/AnnotationTarget, klass: kotlin/reflect/KClass<*>, klass2: kotlin/reflect/KClass<*>, anno: B, stra: kotlin/Array<kotlin/String>, ka: kotlin/Array<kotlin/reflect/KClass<*>>, ea: kotlin/Array<kotlin/annotation/AnnotationTarget>, aa: kotlin/Array<B>)
// getter: aa()[LB;
public final val aa: kotlin/Array<B>
public final get
// getter: anno()LB;
public final val anno: B
public final get
// getter: b()B
public final val b: kotlin/Byte
public final get
// getter: ba()[B
public final val ba: kotlin/ByteArray
public final get
// getter: c()C
public final val c: kotlin/Char
public final get
// getter: ca()[C
public final val ca: kotlin/CharArray
public final get
// getter: d()D
public final val d: kotlin/Double
public final get
// getter: da()[D
public final val da: kotlin/DoubleArray
public final get
// getter: ea()[Lkotlin/annotation/AnnotationTarget;
public final val ea: kotlin/Array<kotlin/annotation/AnnotationTarget>
public final get
// getter: enum()Lkotlin/annotation/AnnotationTarget;
public final val enum: kotlin/annotation/AnnotationTarget
public final get
// getter: f()F
public final val f: kotlin/Float
public final get
// getter: fa()[F
public final val fa: kotlin/FloatArray
public final get
// getter: i()I
public final val i: kotlin/Int
public final get
// getter: ia()[I
public final val ia: kotlin/IntArray
public final get
// getter: j()J
public final val j: kotlin/Long
public final get
// getter: ja()[J
public final val ja: kotlin/LongArray
public final get
// getter: ka()[Ljava/lang/Class;
public final val ka: kotlin/Array<kotlin/reflect/KClass<*>>
public final get
// getter: klass()Ljava/lang/Class;
public final val klass: kotlin/reflect/KClass<*>
public final get
// getter: klass2()Ljava/lang/Class;
public final val klass2: kotlin/reflect/KClass<*>
public final get
// getter: s()S
public final val s: kotlin/Short
public final get
// getter: sa()[S
public final val sa: kotlin/ShortArray
public final get
// getter: str()Ljava/lang/String;
public final val str: kotlin/String
public final get
// getter: stra()[Ljava/lang/String;
public final val stra: kotlin/Array<kotlin/String>
public final get
// getter: ub()B
public final val ub: kotlin/UByte
public final get
// getter: ub_max()B
public final val ub_max: kotlin/UByte
public final get
// getter: ui()I
public final val ui: kotlin/UInt
public final get
// getter: ui_max()I
public final val ui_max: kotlin/UInt
public final get
// getter: ul()J
public final val ul: kotlin/ULong
public final get
// getter: ul_max()J
public final val ul_max: kotlin/ULong
public final get
// getter: us()S
public final val us: kotlin/UShort
public final get
// getter: us_max()S
public final val us_max: kotlin/UShort
public final get
// getter: z()Z
public final val z: kotlin/Boolean
public final get
// getter: za()[Z
public final val za: kotlin/BooleanArray
public final get
// module name: test-module
}
// B.class
// ------------------------------------------
public final annotation class B : kotlin/Annotation {
// signature: <init>(Ljava/lang/String;)V
public constructor(value: kotlin/String)
// getter: value()Ljava/lang/String;
public final val value: kotlin/String
public final get
// module name: test-module
}
// C.class
// ------------------------------------------
public final class C : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: parameterTypeAnnotation(Ljava/lang/Object;)Ljava/lang/Object;
public final fun parameterTypeAnnotation(p: @JvmNamed(value = "Q_Q") kotlin/Any): kotlin/Any
// signature: returnTypeAnnotation()V
public final fun returnTypeAnnotation(): @A(z = true, c = 'x', b = 1.toByte(), s = 42.toShort(), i = 42424242, f = -2.72f, j = 239239239239239L, d = 3.14, ui = 1u, ub = 255.toUByte(), us = 3.toUShort(), ul = 4uL, ui_max = 4294967295u, ub_max = 255.toUByte(), us_max = 65535.toUShort(), ul_max = 18446744073709551615uL, za = [true], ca = ['\''], ba = [1.toByte()], sa = [42.toShort()], ia = [42424242], fa = [-2.72f], ja = [239239239239239L], da = [3.14], str = "aba\ncaba'\"\t\u0001\u0002ꙮ", enum = kotlin/annotation/AnnotationTarget.CLASS, klass = C::class, klass2 = kotlin/IntArray::class, anno = B(value = "aba\ncaba'\"\t\u0001\u0002ꙮ"), stra = ["lmao"], ka = [kotlin/Double::class, kotlin/Unit::class, kotlin/LongArray::class, kotlin/Array<kotlin/String::class>], ea = [kotlin/annotation/AnnotationTarget.TYPEALIAS, kotlin/annotation/AnnotationTarget.FIELD], aa = [B(value = "2"), B(value = "3")]) kotlin/Unit
// module name: test-module
}
// JvmNamed.class
// ------------------------------------------
public final annotation class JvmNamed : kotlin/Annotation {
// signature: <init>(Ljava/lang/String;)V
public constructor(value: kotlin/String)
// getter: uglyJvmName()Ljava/lang/String;
public final val value: kotlin/String
public final /* non-default */ get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
+86
View File
@@ -0,0 +1,86 @@
// IGNORE K2
// ^ KT-63631 K2: constant value of UByte.MAX_VALUE is incorrectly serialized to metadata
import kotlin.reflect.KClass
@Target(AnnotationTarget.TYPE)
annotation class A(
val z: Boolean,
val c: Char,
val b: Byte,
val s: Short,
val i: Int,
val f: Float,
val j: Long,
val d: Double,
val ui: UInt,
val ub: UByte,
val us: UShort,
val ul: ULong,
val ui_max: UInt,
val ub_max: UByte,
val us_max: UShort,
val ul_max: ULong,
val za: BooleanArray,
val ca: CharArray,
val ba: ByteArray,
val sa: ShortArray,
val ia: IntArray,
val fa: FloatArray,
val ja: LongArray,
val da: DoubleArray,
val str: String,
val enum: AnnotationTarget,
val klass: KClass<*>,
val klass2: KClass<*>,
val anno: B,
val stra: Array<String>,
val ka: Array<KClass<*>>,
val ea: Array<AnnotationTarget>,
val aa: Array<B>
)
annotation class B(val value: String)
@Target(AnnotationTarget.TYPE)
annotation class JvmNamed(@get:JvmName("uglyJvmName") val value: String)
class C {
fun returnTypeAnnotation(): @A(
true,
'x',
1.toByte(),
42.toShort(),
42424242,
-2.72f,
239239239239239L,
3.14,
1u,
0xFFu,
3u,
4uL,
0xFFFF_FFFFu,
UByte.MAX_VALUE,
0xFF_FFu,
18446744073709551615u,
[true],
['\''],
[1.toByte()],
[42.toShort()],
[42424242],
[-2.72f],
[239239239239239L],
[3.14],
"aba\ncaba'\"\t\u0001\u0002\uA66E",
AnnotationTarget.CLASS,
C::class,
IntArray::class,
B(value = "aba\ncaba'\"\t\u0001\u0002\uA66E"),
["lmao"],
[Double::class, Unit::class, LongArray::class, Array<String>::class],
[AnnotationTarget.TYPEALIAS, AnnotationTarget.FIELD],
[B("2"), B(value = "3")]
) Unit {}
fun parameterTypeAnnotation(p: @JvmNamed("Q_Q") Any): Any = p
}
+202
View File
@@ -0,0 +1,202 @@
// A.class
// ------------------------------------------
public final annotation class A : kotlin/Annotation {
// signature: <init>(ZCBSIFJDLkotlin/UInt;Lkotlin/UByte;Lkotlin/UShort;Lkotlin/ULong;Lkotlin/UInt;Lkotlin/UByte;Lkotlin/UShort;Lkotlin/ULong;[Z[C[B[S[I[F[J[DLjava/lang/String;Lkotlin/annotation/AnnotationTarget;Lkotlin/reflect/KClass;Lkotlin/reflect/KClass;LB;Lkotlin/Array;Lkotlin/Array;Lkotlin/Array;Lkotlin/Array;)V
public constructor(z: kotlin/Boolean, c: kotlin/Char, b: kotlin/Byte, s: kotlin/Short, i: kotlin/Int, f: kotlin/Float, j: kotlin/Long, d: kotlin/Double, ui: kotlin/UInt, ub: kotlin/UByte, us: kotlin/UShort, ul: kotlin/ULong, ui_max: kotlin/UInt, ub_max: kotlin/UByte, us_max: kotlin/UShort, ul_max: kotlin/ULong, za: kotlin/BooleanArray, ca: kotlin/CharArray, ba: kotlin/ByteArray, sa: kotlin/ShortArray, ia: kotlin/IntArray, fa: kotlin/FloatArray, ja: kotlin/LongArray, da: kotlin/DoubleArray, str: kotlin/String, enum: kotlin/annotation/AnnotationTarget, klass: kotlin/reflect/KClass<*>, klass2: kotlin/reflect/KClass<*>, anno: B, stra: kotlin/Array<kotlin/String>, ka: kotlin/Array<kotlin/reflect/KClass<*>>, ea: kotlin/Array<kotlin/annotation/AnnotationTarget>, aa: kotlin/Array<B>)
// getter: aa()[LB;
public final val aa: kotlin/Array<B>
public final get
// getter: anno()LB;
public final val anno: B
public final get
// getter: b()B
public final val b: kotlin/Byte
public final get
// getter: ba()[B
public final val ba: kotlin/ByteArray
public final get
// getter: c()C
public final val c: kotlin/Char
public final get
// getter: ca()[C
public final val ca: kotlin/CharArray
public final get
// getter: d()D
public final val d: kotlin/Double
public final get
// getter: da()[D
public final val da: kotlin/DoubleArray
public final get
// getter: ea()[Lkotlin/annotation/AnnotationTarget;
public final val ea: kotlin/Array<kotlin/annotation/AnnotationTarget>
public final get
// getter: enum()Lkotlin/annotation/AnnotationTarget;
public final val enum: kotlin/annotation/AnnotationTarget
public final get
// getter: f()F
public final val f: kotlin/Float
public final get
// getter: fa()[F
public final val fa: kotlin/FloatArray
public final get
// getter: i()I
public final val i: kotlin/Int
public final get
// getter: ia()[I
public final val ia: kotlin/IntArray
public final get
// getter: j()J
public final val j: kotlin/Long
public final get
// getter: ja()[J
public final val ja: kotlin/LongArray
public final get
// getter: ka()[Ljava/lang/Class;
public final val ka: kotlin/Array<kotlin/reflect/KClass<*>>
public final get
// getter: klass()Ljava/lang/Class;
public final val klass: kotlin/reflect/KClass<*>
public final get
// getter: klass2()Ljava/lang/Class;
public final val klass2: kotlin/reflect/KClass<*>
public final get
// getter: s()S
public final val s: kotlin/Short
public final get
// getter: sa()[S
public final val sa: kotlin/ShortArray
public final get
// getter: str()Ljava/lang/String;
public final val str: kotlin/String
public final get
// getter: stra()[Ljava/lang/String;
public final val stra: kotlin/Array<kotlin/String>
public final get
// requires compiler version 1.4.30 (level=ERROR)
// requires language version 1.4.0 (level=ERROR)
// getter: ub()B
public final val ub: kotlin/UByte
public final get
// requires compiler version 1.4.30 (level=ERROR)
// requires language version 1.4.0 (level=ERROR)
// getter: ub_max()B
public final val ub_max: kotlin/UByte
public final get
// requires compiler version 1.4.30 (level=ERROR)
// requires language version 1.4.0 (level=ERROR)
// getter: ui()I
public final val ui: kotlin/UInt
public final get
// requires compiler version 1.4.30 (level=ERROR)
// requires language version 1.4.0 (level=ERROR)
// getter: ui_max()I
public final val ui_max: kotlin/UInt
public final get
// requires compiler version 1.4.30 (level=ERROR)
// requires language version 1.4.0 (level=ERROR)
// getter: ul()J
public final val ul: kotlin/ULong
public final get
// requires compiler version 1.4.30 (level=ERROR)
// requires language version 1.4.0 (level=ERROR)
// getter: ul_max()J
public final val ul_max: kotlin/ULong
public final get
// requires compiler version 1.4.30 (level=ERROR)
// requires language version 1.4.0 (level=ERROR)
// getter: us()S
public final val us: kotlin/UShort
public final get
// requires compiler version 1.4.30 (level=ERROR)
// requires language version 1.4.0 (level=ERROR)
// getter: us_max()S
public final val us_max: kotlin/UShort
public final get
// getter: z()Z
public final val z: kotlin/Boolean
public final get
// getter: za()[Z
public final val za: kotlin/BooleanArray
public final get
// module name: test-module
}
// B.class
// ------------------------------------------
public final annotation class B : kotlin/Annotation {
// signature: <init>(Ljava/lang/String;)V
public constructor(value: kotlin/String)
// getter: value()Ljava/lang/String;
public final val value: kotlin/String
public final get
// module name: test-module
}
// C.class
// ------------------------------------------
public final class C : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: parameterTypeAnnotation(Ljava/lang/Object;)Ljava/lang/Object;
public final fun parameterTypeAnnotation(p: @JvmNamed(value = "Q_Q") kotlin/Any): kotlin/Any
// signature: returnTypeAnnotation()V
public final fun returnTypeAnnotation(): @A(z = true, c = 'x', b = 1.toByte(), s = 42.toShort(), i = 42424242, f = -2.72f, j = 239239239239239L, d = 3.14, ui = 1u, ub = 255.toUByte(), us = 3.toUShort(), ul = 4uL, ui_max = 4294967295u, ub_max = 255.toUByte(), us_max = 65535.toUShort(), ul_max = 18446744073709551615uL, za = [true], ca = ['\''], ba = [1.toByte()], sa = [42.toShort()], ia = [42424242], fa = [-2.72f], ja = [239239239239239L], da = [3.14], str = "aba\ncaba'\"\t\u0001\u0002ꙮ", enum = kotlin/annotation/AnnotationTarget.CLASS, klass = C::class, klass2 = kotlin/IntArray::class, anno = B(value = "aba\ncaba'\"\t\u0001\u0002ꙮ"), stra = ["lmao"], ka = [kotlin/Double::class, kotlin/Unit::class, kotlin/LongArray::class, kotlin/Array<kotlin/String::class>], ea = [kotlin/annotation/AnnotationTarget.TYPEALIAS, kotlin/annotation/AnnotationTarget.FIELD], aa = [B(value = "2"), B(value = "3")]) kotlin/Unit
// module name: test-module
}
// JvmNamed.class
// ------------------------------------------
public final annotation class JvmNamed : kotlin/Annotation {
// signature: <init>(Ljava/lang/String;)V
public constructor(value: kotlin/String)
// getter: uglyJvmName()Ljava/lang/String;
public final val value: kotlin/String
public final get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
+8
View File
@@ -0,0 +1,8 @@
class A {
val constantString: String = "OK"
val constantInt: Int = 12
val constantDouble: Double = 1.0
val constantNull: String? = null
}
const val four = 2 + 2
+46
View File
@@ -0,0 +1,46 @@
// A.class
// ------------------------------------------
public final class A : kotlin/Any {
// signature: <init>()V
public constructor()
// field: constantDouble:D
// getter: getConstantDouble()D
public final val constantDouble: kotlin/Double /* = ... */
public final get
// field: constantInt:I
// getter: getConstantInt()I
public final val constantInt: kotlin/Int /* = ... */
public final get
// field: constantNull:Ljava/lang/String;
// getter: getConstantNull()Ljava/lang/String;
public final val constantNull: kotlin/String?
public final get
// field: constantString:Ljava/lang/String;
// getter: getConstantString()Ljava/lang/String;
public final val constantString: kotlin/String /* = ... */
public final get
// module name: test-module
}
// ConstantsKt.class
// ------------------------------------------
package {
// field: four:I
public final const val four: kotlin/Int /* = ... */
public final get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
ConstantsKt
}
}
@@ -0,0 +1,11 @@
// !LANGUAGE: +ContextReceivers
interface A
interface B
context(A) class C {
context(B) fun f() {}
}
context(A) fun g() {}
context(B) val h: Int get() = 42
@@ -0,0 +1,48 @@
// A.class
// ------------------------------------------
public abstract interface A : kotlin/Any {
// module name: test-module
}
// B.class
// ------------------------------------------
public abstract interface B : kotlin/Any {
// module name: test-module
}
// C.class
// ------------------------------------------
context(A)
public final class C : kotlin/Any {
// signature: <init>(LA;)V
public constructor()
// signature: f(LB;)V
context(B)
public final fun f(): kotlin/Unit
// module name: test-module
}
// ContextReceiversKt.class
// ------------------------------------------
package {
// signature: g(LA;)V
context(A)
public final fun g(): kotlin/Unit
// getter: getH(LB;)I
context(B)
public final val h: kotlin/Int
public final /* non-default */ get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
ContextReceiversKt
}
}
+66
View File
@@ -0,0 +1,66 @@
@file:OptIn(ExperimentalContracts::class)
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.contracts.ExperimentalContracts
fun returnsTrue(condition: Boolean) {
contract {
returns(true) implies (condition)
}
}
fun returnsNull(condition: Boolean) {
contract {
returns(null) implies (condition)
}
}
fun returnsNotNull(condition: Boolean) {
contract {
returnsNotNull() implies (condition)
}
}
fun Any?.receiverIsNotNull(): Boolean {
contract {
returns(true) implies (this@receiverIsNotNull != null)
}
return this != null
}
inline fun callsInPlaceAtMostOnce(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
}
}
inline fun callsInPlaceUnknown(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.UNKNOWN)
}
}
fun conjunction(a: Boolean, b: Boolean, c: Boolean) {
contract {
returns() implies (a && !b && c)
}
}
fun disjunction(a: Boolean, b: Boolean, c: Boolean) {
contract {
returns() implies (a || !b || c)
}
}
fun complexBoolean(a: Any?, b: Any?, c: Any?, d: Any?) {
contract {
returns() implies ((a != null && c != null) || (b == null && d != null))
}
}
fun negatedIsAndConjunction(a: Any?, b: Boolean, c: Any?) {
contract {
returns() implies (a !is List<*> && b && c == null)
}
}
+75
View File
@@ -0,0 +1,75 @@
// ContractsKt.class
// ------------------------------------------
package {
// requires compiler version 1.3.50 (level=ERROR)
// signature: callsInPlaceAtMostOnce(Lkotlin/jvm/functions/Function0;)V
public final inline fun callsInPlaceAtMostOnce(block: kotlin/Function0<kotlin/Unit>): kotlin/Unit
contract {
callsInPlace(p#1, InvocationKind.AT_MOST_ONCE)
}
// requires compiler version 1.3.50 (level=ERROR)
// signature: callsInPlaceUnknown(Lkotlin/jvm/functions/Function0;)V
public final inline fun callsInPlaceUnknown(block: kotlin/Function0<kotlin/Unit>): kotlin/Unit
contract {
callsInPlace(p#1)
}
// signature: complexBoolean(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
public final fun complexBoolean(a: kotlin/Any?, b: kotlin/Any?, c: kotlin/Any?, d: kotlin/Any?): kotlin/Unit
contract {
returns() implies ((p#1 != null && p#3 != null) || (p#2 == null && p#4 != null))
}
// signature: conjunction(ZZZ)V
public final fun conjunction(a: kotlin/Boolean, b: kotlin/Boolean, c: kotlin/Boolean): kotlin/Unit
contract {
returns() implies (p#1 && p#2 && p#3)
}
// signature: disjunction(ZZZ)V
public final fun disjunction(a: kotlin/Boolean, b: kotlin/Boolean, c: kotlin/Boolean): kotlin/Unit
contract {
returns() implies (p#1 || p#2 || p#3)
}
// signature: negatedIsAndConjunction(Ljava/lang/Object;ZLjava/lang/Object;)V
public final fun negatedIsAndConjunction(a: kotlin/Any?, b: kotlin/Boolean, c: kotlin/Any?): kotlin/Unit
contract {
returns() implies (p#1 !is kotlin/collections/List<*> && p#2 && p#3 == null)
}
// signature: receiverIsNotNull(Ljava/lang/Object;)Z
public final fun kotlin/Any?.receiverIsNotNull(): kotlin/Boolean
contract {
returns(true) implies (p#0 != null)
}
// signature: returnsNotNull(Z)V
public final fun returnsNotNull(condition: kotlin/Boolean): kotlin/Unit
contract {
returnsNotNull() implies (p#1)
}
// signature: returnsNull(Z)V
public final fun returnsNull(condition: kotlin/Boolean): kotlin/Unit
contract {
returns(null) implies (p#1)
}
// signature: returnsTrue(Z)V
public final fun returnsTrue(condition: kotlin/Boolean): kotlin/Unit
contract {
returns(true) implies (p#1)
}
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
ContractsKt
}
}
+7
View File
@@ -0,0 +1,7 @@
interface I {
fun foo()
}
class A(i: I): I by i {
}
+25
View File
@@ -0,0 +1,25 @@
// A.class
// ------------------------------------------
public final class A : I {
// signature: <init>(LI;)V
public constructor(i: I)
// signature: foo()V
public open /* delegation */ fun foo(): kotlin/Unit
// module name: test-module
}
// I.class
// ------------------------------------------
public abstract interface I : kotlin/Any {
// signature: foo()V
public abstract fun foo(): kotlin/Unit
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
+5
View File
@@ -0,0 +1,5 @@
// !LANGUAGE: +EnumEntries
enum class MyEnum {
ONE, TWO
}
+19
View File
@@ -0,0 +1,19 @@
// MyEnum.class
// ------------------------------------------
public final enum class MyEnum : kotlin/Enum<MyEnum> {
// signature: <init>(Ljava/lang/String;I)V
private constructor()
ONE,
TWO,
// module name: test-module
// has Enum.entries
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
+3
View File
@@ -0,0 +1,3 @@
fun interface F {
fun String.f(x: Int)
}
+13
View File
@@ -0,0 +1,13 @@
// F.class
// ------------------------------------------
public abstract fun interface F : kotlin/Any {
// signature: f(Ljava/lang/String;I)V
public abstract fun kotlin/String.f(x: kotlin/Int): kotlin/Unit
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,24 @@
interface A
interface B
class Inv<T>(e: T)
fun <S> intersection(x: Inv<in S>, y: Inv<in S>): S = TODO()
fun <K> use(k: K, f: K.(K) -> K) {}
fun <K> useNested(k: K, f: Inv<K>.(Inv<K>) -> Inv<K>) {}
fun <T> createDelegate(f: () -> T): Delegate<T> = Delegate()
class Delegate<T> {
operator fun getValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>): T = TODO()
operator fun setValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>, value: T) {}
}
fun test(a: Inv<A>, b: Inv<B>) {
val intersectionType = intersection(a, b)
use(intersectionType) { intersectionType }
useNested(intersectionType) { Inv(intersectionType) }
var d by createDelegate { intersectionType }
}
@@ -0,0 +1,75 @@
// A.class
// ------------------------------------------
public abstract interface A : kotlin/Any {
// module name: test-module
}
// B.class
// ------------------------------------------
public abstract interface B : kotlin/Any {
// module name: test-module
}
// Delegate.class
// ------------------------------------------
public final class Delegate<T#0 /* T */> : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: getValue(Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
public final operator fun getValue(thisRef: kotlin/Any?, property: kotlin/reflect/KProperty<*>): T#0
// signature: setValue(Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V
public final operator fun setValue(thisRef: kotlin/Any?, property: kotlin/reflect/KProperty<*>, value: T#0): kotlin/Unit
// module name: test-module
}
// IntersectionTypeInLambdaLiteralAndDelegatedPropertyKt.class
// ------------------------------------------
package {
// signature: createDelegate(Lkotlin/jvm/functions/Function0;)LDelegate;
public final fun <T#0 /* T */> createDelegate(f: kotlin/Function0<T#0>): Delegate<T#0>
// signature: intersection(LInv;LInv;)Ljava/lang/Object;
public final fun <T#0 /* S */> intersection(x: Inv<in T#0>, y: Inv<in T#0>): T#0
// signature: test(LInv;LInv;)V
public final fun test(a: Inv<A>, b: Inv<B>): kotlin/Unit
// signature: use(Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)V
public final fun <T#0 /* K */> use(k: T#0, f: @kotlin/ExtensionFunctionType kotlin/Function2<T#0, T#0, T#0>): kotlin/Unit
// signature: useNested(Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)V
public final fun <T#0 /* K */> useNested(k: T#0, f: @kotlin/ExtensionFunctionType kotlin/Function2<Inv<T#0>, Inv<T#0>, Inv<T#0>>): kotlin/Unit
// local delegated property #0
// local final /* delegated */ var d: kotlin/Any
// local final get
// local final set
// module name: test-module
}
// IntersectionTypeInLambdaLiteralAndDelegatedPropertyKt$test$1.class
// ------------------------------------------
synthetic class
// IntersectionTypeInLambdaLiteralAndDelegatedPropertyKt$test$2.class
// ------------------------------------------
synthetic class
// Inv.class
// ------------------------------------------
public final class Inv<T#0 /* T */> : kotlin/Any {
// signature: <init>(Ljava/lang/Object;)V
public constructor(e: T#0)
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
IntersectionTypeInLambdaLiteralAndDelegatedPropertyKt
}
}
+4
View File
@@ -0,0 +1,4 @@
fun test() {
val f = {}
val g = fun Unit.(s: IntArray?, t: Set<Double>): String { return "" }
}
+16
View File
@@ -0,0 +1,16 @@
// LambdaKt.class
// ------------------------------------------
package {
// signature: test()V
public final fun test(): kotlin/Unit
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
LambdaKt
}
}
@@ -0,0 +1,30 @@
import kotlin.reflect.KProperty
class Delegate<T>(val value: T? = null) {
operator fun getValue(instance: Any?, property: KProperty<*>): T = value!!
}
val nonLocal by Delegate<String>()
val init0 = run {
val local1 by Delegate<Double>()
val local2 by Delegate<Any>()
}
val init1 = run {
val local3 by Delegate<CharSequence?>()
}
class Class {
init {
val local4 by Delegate<Array<String>>()
}
fun f() {
val local5 by Delegate<List<Unit>?>()
fun g() {
val local6 by Delegate<Int>()
}
}
}
@@ -0,0 +1,81 @@
// Class.class
// ------------------------------------------
public final class Class : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: f()V
public final fun f(): kotlin/Unit
// local delegated property #0
// local final /* delegated */ val local4: kotlin/Array<kotlin/String>
// local final get
// local delegated property #1
// local final /* delegated */ val local5: kotlin/collections/List<kotlin/Unit>?
// local final get
// local delegated property #2
// local final /* delegated */ val local6: kotlin/Int
// local final get
// module name: test-module
}
// Delegate.class
// ------------------------------------------
public final class Delegate<T#0 /* T */> : kotlin/Any {
// signature: <init>(Ljava/lang/Object;)V
public constructor(value: T#0? /* = ... */)
// signature: getValue(Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
public final operator fun getValue(instance: kotlin/Any?, property: kotlin/reflect/KProperty<*>): T#0
// field: value:Ljava/lang/Object;
// getter: getValue()Ljava/lang/Object;
public final val value: T#0?
public final get
// module name: test-module
}
// LocalDelegatedPropertiesKt.class
// ------------------------------------------
package {
// field: init0:Lkotlin/Unit;
// getter: getInit0()Lkotlin/Unit;
public final val init0: kotlin/Unit
public final get
// field: init1:Lkotlin/Unit;
// getter: getInit1()Lkotlin/Unit;
public final val init1: kotlin/Unit
public final get
// field: nonLocal$delegate:LDelegate;
// getter: getNonLocal()Ljava/lang/String;
public final /* delegated */ val nonLocal: kotlin/String
public final /* non-default */ get
// local delegated property #0
// local final /* delegated */ val local1: kotlin/Double
// local final get
// local delegated property #1
// local final /* delegated */ val local2: kotlin/Any
// local final get
// local delegated property #2
// local final /* delegated */ val local3: kotlin/CharSequence?
// local final get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
LocalDelegatedPropertiesKt
}
}
@@ -0,0 +1,5 @@
@file:JvmMultifileClass
@file:JvmName("File")
package test
const val x = 42
+23
View File
@@ -0,0 +1,23 @@
// test/File.class
// ------------------------------------------
multi-file class {
// test/File__MultiFileClassKt
}
// test/File__MultiFileClassKt.class
// ------------------------------------------
package {
// facade: test/File
// field: x:I
public final const val x: kotlin/Int /* = ... */
public final get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package test {
test/File__MultiFileClassKt (test/File)
}
}
+16
View File
@@ -0,0 +1,16 @@
interface A {
interface B {
interface C
}
companion object D {
enum class E {
E1,
E2,
}
sealed class F {
class G : F()
}
}
}
+80
View File
@@ -0,0 +1,80 @@
// A.class
// ------------------------------------------
public abstract interface A : kotlin/Any {
// companion object: D
// nested class: B
// nested class: D
// module name: test-module
}
// A$B.class
// ------------------------------------------
public abstract interface A.B : kotlin/Any {
// nested class: C
// module name: test-module
}
// A$B$C.class
// ------------------------------------------
public abstract interface A.B.C : kotlin/Any {
// module name: test-module
}
// A$D.class
// ------------------------------------------
public final companion object A.D : kotlin/Any {
// signature: <init>()V
private constructor()
// nested class: E
// nested class: F
// module name: test-module
}
// A$D$E.class
// ------------------------------------------
public final enum class A.D.E : kotlin/Enum<A.D.E> {
// signature: <init>(Ljava/lang/String;I)V
private constructor()
E1,
E2,
// module name: test-module
// has Enum.entries
}
// A$D$F.class
// ------------------------------------------
public sealed class A.D.F : kotlin/Any {
// signature: <init>()V
protected constructor()
// nested class: G
// sealed subclass: A.D.F.G
// module name: test-module
}
// A$D$F$G.class
// ------------------------------------------
public final class A.D.F.G : A.D.F {
// signature: <init>()V
public constructor()
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,5 @@
// !LANGUAGE: +EnumEntries
class UsualClass {
fun foo() {}
}
@@ -0,0 +1,16 @@
// UsualClass.class
// ------------------------------------------
public final class UsualClass : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: foo()V
public final fun foo(): kotlin/Unit
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,29 @@
// IGNORE K2
// ^ KT-62931 K2: extra class files for @OptionalExpectation marked annotations
// !LANGUAGE: +MultiPlatformProjects
// !OPT_IN: kotlin.ExperimentalMultiplatform
// NO_READ_WRITE_COMPARE
package test
@OptionalExpectation
expect annotation class A(val x: Int)
@OptionalExpectation
expect annotation class B(val a: Array<String>)
@OptionalExpectation
expect annotation class C()
@OptionalExpectation
expect annotation class D()
actual annotation class D actual constructor()
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
@A(42)
@B(["OK", ""])
@C
@D()
fun ok() {}
@@ -0,0 +1,55 @@
// test/D.class
// ------------------------------------------
public final annotation class test/D : kotlin/Annotation {
// signature: <init>()V
public constructor()
// module name: test-module
}
// test/OptionalAnnotationKt.class
// ------------------------------------------
package {
// signature: ok()V
public final fun ok(): kotlin/Unit
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package test {
test/OptionalAnnotationKt
}
// Optional annotations
public final expect annotation class test/A : kotlin/Annotation {
// signature: <init>(I)V
public constructor(x: kotlin/Int)
public final expect val x: kotlin/Int
public final get
// module name: main
}
public final expect annotation class test/B : kotlin/Annotation {
// signature: <init>(Lkotlin/Array;)V
public constructor(a: kotlin/Array<kotlin/String>)
public final expect val a: kotlin/Array<kotlin/String>
public final get
// module name: main
}
public final expect annotation class test/C : kotlin/Annotation {
// signature: <init>()V
public constructor()
// module name: main
}
}
+7
View File
@@ -0,0 +1,7 @@
import java.io.File
class PlatformType {
fun nullability() = File(".").absoluteFile
fun mutability() = File(".").toURI().toURL().openConnection().headerFields
}
+19
View File
@@ -0,0 +1,19 @@
// PlatformType.class
// ------------------------------------------
public final class PlatformType : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: mutability()Ljava/util/Map;
public final fun mutability(): kotlin/collections/MutableMap<kotlin/String!, kotlin/collections/MutableList<kotlin/String!>..kotlin/collections/List<kotlin/String!>?>..kotlin/collections/Map<kotlin/String!, kotlin/collections/MutableList<kotlin/String!>..kotlin/collections/List<kotlin/String!>?>?
// signature: nullability()Ljava/io/File;
public final fun nullability(): java/io/File!
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
+14
View File
@@ -0,0 +1,14 @@
class C(val constructorParam: String = "") {
val getterOnlyVal: Double get() = 0.0
var accessorOnlyVar: Int
get() = 1
set(value) {}
var withBackingField: String = "42"
val <T : Number> T.delegated: List<Nothing> by null
val withOptimizedDelegate by C::getterOnlyVal
operator fun Nothing?.getValue(x: Any?, y: Any?) = emptyList<Nothing>()
}
+48
View File
@@ -0,0 +1,48 @@
// C.class
// ------------------------------------------
public final class C : kotlin/Any {
// signature: <init>(Ljava/lang/String;)V
public constructor(constructorParam: kotlin/String /* = ... */)
// signature: getValue(Ljava/lang/Void;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/List;
public final operator fun kotlin/Nothing?.getValue(x: kotlin/Any?, y: kotlin/Any?): kotlin/collections/List<kotlin/Nothing>
// getter: getAccessorOnlyVar()I
// setter: setAccessorOnlyVar(I)V
public final var accessorOnlyVar: kotlin/Int
public final /* non-default */ get
public final /* non-default */ set(value: kotlin/Int)
// field: constructorParam:Ljava/lang/String;
// getter: getConstructorParam()Ljava/lang/String;
public final val constructorParam: kotlin/String
public final get
// getter: getDelegated(Ljava/lang/Number;)Ljava/util/List;
// synthetic method for delegate: getDelegated$delegate(LC;Ljava/lang/Number;)Ljava/lang/Object;
public final /* delegated */ val <T#0 /* T */ : kotlin/Number> T#0.delegated: kotlin/collections/List<kotlin/Nothing>
public final /* non-default */ get
// getter: getGetterOnlyVal()D
public final val getterOnlyVal: kotlin/Double
public final /* non-default */ get
// field: withBackingField:Ljava/lang/String;
// getter: getWithBackingField()Ljava/lang/String;
// setter: setWithBackingField(Ljava/lang/String;)V
public final var withBackingField: kotlin/String
public final get
public final set
// getter: getWithOptimizedDelegate()D
// synthetic method for delegate: getWithOptimizedDelegate$delegate(LC;)Ljava/lang/Object;
public final /* delegated */ val withOptimizedDelegate: kotlin/Double
public final /* non-default */ get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
+15
View File
@@ -0,0 +1,15 @@
// IGNORE K2
class SimpleClass<in A>(val p: Int = 42) {
constructor(s: Array<String?>?) : this(s?.size ?: 0)
var x: Long = p.toLong()
external get
@JvmName("SET_X") set
internal fun <U : A, V, A> A.f(vararg z: Map<V, U?>): Set<*> where V : A {
error("")
}
protected suspend inline fun <reified T> g(crossinline a: () -> A, noinline b: suspend () -> T) {}
}
+34
View File
@@ -0,0 +1,34 @@
// SimpleClass.class
// ------------------------------------------
public final class SimpleClass<in T#0 /* A */> : kotlin/Any {
// signature: <init>(I)V
public constructor(p: kotlin/Int /* = ... */)
// signature: <init>([Ljava/lang/String;)V
public /* secondary */ constructor(s: kotlin/Array<kotlin/String?>?)
// signature: f$test_module(Ljava/lang/Object;[Ljava/util/Map;)Ljava/util/Set;
internal final fun <T#1 /* U */ : T#3, T#2 /* V */ : T#3, T#3 /* A */> T#3.f(vararg z: kotlin/collections/Map<T#2, T#1?> /* kotlin/Array<out kotlin/collections/Map<T#2, T#1?>> */): kotlin/collections/Set<*>
// signature: g(Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
protected final inline suspend fun <reified T#1 /* T */> g(crossinline a: kotlin/Function0<T#0>, noinline b: suspend kotlin/Function1<kotlin/coroutines/Continuation<T#1>, kotlin/Any?>): kotlin/Unit
// field: p:I
// getter: getP()I
public final val p: kotlin/Int
public final get
// field: x:J
// getter: getX()J
// setter: SET_X(J)V
public final var x: kotlin/Long
public final /* non-default */ external get
public final /* non-default */ set(<set-?>: kotlin/Long)
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,22 @@
// SimplePackageKt.class
// ------------------------------------------
package {
// signature: topLevelFun(Ljava/lang/Object;)Lkotlin/reflect/KClass;
internal final inline fun <reified T#0 /* X */ : kotlin/Any> topLevelFun(x: T#0): kotlin/reflect/KClass<T#0>
// field: topLevelProp:Ljava/lang/String;
// getter: getTopLevelProp()Ljava/lang/String;
public final var topLevelProp: kotlin/String?
public final get
private final /* non-default */ set(value: kotlin/String?)
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
SimplePackageKt
}
}
+4
View File
@@ -0,0 +1,4 @@
internal inline fun <reified X : Any> topLevelFun(x: X) = X::class
var topLevelProp: String? = null
private set
+22
View File
@@ -0,0 +1,22 @@
// SimplePackageKt.class
// ------------------------------------------
package {
// signature: topLevelFun(Ljava/lang/Object;)Lkotlin/reflect/KClass;
internal final inline fun <reified T#0 /* X */ : kotlin/Any> topLevelFun(x: T#0): kotlin/reflect/KClass<T#0>
// field: topLevelProp:Ljava/lang/String;
// getter: getTopLevelProp()Ljava/lang/String;
public final var topLevelProp: kotlin/String?
public final get
private final /* non-default */ set(<set-?>: kotlin/String?)
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
SimplePackageKt
}
}
@@ -0,0 +1,7 @@
fun f(a: AnnotationTarget): String? {
return when (a) {
AnnotationTarget.FUNCTION -> "1"
AnnotationTarget.PROPERTY -> "2"
else -> null
}
}
+19
View File
@@ -0,0 +1,19 @@
// SyntheticClassKt.class
// ------------------------------------------
package {
// signature: f(Lkotlin/annotation/AnnotationTarget;)Ljava/lang/String;
public final fun f(a: kotlin/annotation/AnnotationTarget): kotlin/String?
// module name: test-module
}
// SyntheticClassKt$WhenMappings.class
// ------------------------------------------
synthetic class
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
SyntheticClassKt
}
}
+17
View File
@@ -0,0 +1,17 @@
// TypeAliasKt.class
// ------------------------------------------
package {
public typealias F<T#0 /* T */, T#1 /* U */> = kotlin/collections/Map<T#0, kotlin/Function1<java/lang/StringBuilder /* = kotlin/text/StringBuilder^ */, T#1?>> /* = kotlin/collections/Map<T#0, kotlin/Function1<java/lang/StringBuilder /* = kotlin/text/StringBuilder^ */, T#1?>> */
public typealias G<T#0 /* S */> = kotlin/collections/Map<kotlin/collections/List<T#0>, kotlin/Function1<java/lang/StringBuilder /* = kotlin/text/StringBuilder^ */, kotlin/collections/Set<T#0>?>> /* = F^<kotlin/collections/List<T#0>, kotlin/collections/Set<T#0>> */ /* = kotlin/collections/Map<kotlin/collections/List<T#0>, kotlin/Function1<java/lang/StringBuilder /* = kotlin/text/StringBuilder^ */, kotlin/collections/Set<T#0>?>> */
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
TypeAliasKt
}
}
+3
View File
@@ -0,0 +1,3 @@
typealias F<T, U> = Map<T, (StringBuilder) -> U?>
typealias G<S> = F<List<S>, Set<S>>
+17
View File
@@ -0,0 +1,17 @@
// TypeAliasKt.class
// ------------------------------------------
package {
public typealias F<T#0 /* T */, T#1 /* U */> = kotlin/collections/Map<T#0, kotlin/Function1<kotlin/text/StringBuilder^, T#1?>> /* = kotlin/collections/Map<T#0, kotlin/Function1<java/lang/StringBuilder /* = kotlin/text/StringBuilder^ */, T#1?>> */
public typealias G<T#0 /* S */> = F^<kotlin/collections/List<T#0>, kotlin/collections/Set<T#0>> /* = kotlin/collections/Map<kotlin/collections/List<T#0>, kotlin/Function1<java/lang/StringBuilder /* = kotlin/text/StringBuilder^ */, kotlin/collections/Set<T#0>?>> */
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
TypeAliasKt
}
}
+19
View File
@@ -0,0 +1,19 @@
class A<T> {
fun <T> a(t: T) {}
fun <U> f(m: Map.Entry<T, U>) {}
inner class B<U, V : U> {
fun <T, U> b(t: T, u: U & Any, v: V) where T : Comparable<T>, T : Cloneable {}
fun bb(t: T) {}
inner class C<T, U> {
fun <T, U> c(t: T?, u: U?) {}
fun cc(t: T?, u: U?) {}
fun z(c: A<Int>.B<Any, Byte>.C<Unit, Long>) {}
}
}
}
+57
View File
@@ -0,0 +1,57 @@
// A.class
// ------------------------------------------
public final class A<T#0 /* T */> : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: a(Ljava/lang/Object;)V
public final fun <T#1 /* T */> a(t: T#1): kotlin/Unit
// signature: f(Ljava/util/Map$Entry;)V
public final fun <T#1 /* U */> f(m: kotlin/collections/Map.Entry<T#0, T#1>): kotlin/Unit
// nested class: B
// module name: test-module
}
// A$B.class
// ------------------------------------------
public final inner class A.B<T#1 /* U */, T#2 /* V */ : T#1> : kotlin/Any {
// signature: <init>(LA;)V
public constructor()
// requires language version 1.7.0 (level=ERROR)
// signature: b(Ljava/lang/Comparable;Ljava/lang/Object;Ljava/lang/Object;)V
public final fun <T#3 /* T */ : kotlin/Comparable<T#3> & kotlin/Cloneable, T#4 /* U */> b(t: T#3, u: T#4 & Any, v: T#2): kotlin/Unit
// signature: bb(Ljava/lang/Object;)V
public final fun bb(t: T#0): kotlin/Unit
// nested class: C
// module name: test-module
}
// A$B$C.class
// ------------------------------------------
public final inner class A.B.C<T#3 /* T */, T#4 /* U */> : kotlin/Any {
// signature: <init>(LA$B;)V
public constructor()
// signature: c(Ljava/lang/Object;Ljava/lang/Object;)V
public final fun <T#5 /* T */, T#6 /* U */> c(t: T#5?, u: T#6?): kotlin/Unit
// signature: cc(Ljava/lang/Object;Ljava/lang/Object;)V
public final fun cc(t: T#3?, u: T#4?): kotlin/Unit
// signature: z(LA$B$C;)V
public final fun z(c: A<kotlin/Int>.B<kotlin/Any, kotlin/Byte>.C<kotlin/Unit, kotlin/Long>): kotlin/Unit
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
+8
View File
@@ -0,0 +1,8 @@
@JvmInline
value class A(private val i: Int?)
@JvmInline
value class B(private val f: suspend () -> Unit)
@JvmInline
value class Z(val s: String)
+83
View File
@@ -0,0 +1,83 @@
// A.class
// ------------------------------------------
public final value class A : kotlin/Any {
// signature: constructor-impl(Ljava/lang/Integer;)Ljava/lang/Integer;
public constructor(i: kotlin/Int?)
// signature: equals-impl(Ljava/lang/Integer;Ljava/lang/Object;)Z
public open /* synthesized */ operator fun equals(other: kotlin/Any?): kotlin/Boolean
// signature: hashCode-impl(Ljava/lang/Integer;)I
public open /* synthesized */ fun hashCode(): kotlin/Int
// signature: toString-impl(Ljava/lang/Integer;)Ljava/lang/String;
public open /* synthesized */ fun toString(): kotlin/String
// field: i:Ljava/lang/Integer;
private final val i: kotlin/Int?
private final get
// underlying property: i
// underlying type: kotlin/Int?
// module name: test-module
}
// B.class
// ------------------------------------------
public final value class B : kotlin/Any {
// signature: constructor-impl(Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1;
public constructor(f: suspend kotlin/Function1<kotlin/coroutines/Continuation<kotlin/Unit>, kotlin/Any?>)
// signature: equals-impl(Lkotlin/jvm/functions/Function1;Ljava/lang/Object;)Z
public open /* synthesized */ operator fun equals(other: kotlin/Any?): kotlin/Boolean
// signature: hashCode-impl(Lkotlin/jvm/functions/Function1;)I
public open /* synthesized */ fun hashCode(): kotlin/Int
// signature: toString-impl(Lkotlin/jvm/functions/Function1;)Ljava/lang/String;
public open /* synthesized */ fun toString(): kotlin/String
// field: f:Lkotlin/jvm/functions/Function1;
private final val f: suspend kotlin/Function1<kotlin/coroutines/Continuation<kotlin/Unit>, kotlin/Any?>
private final get
// underlying property: f
// underlying type: suspend kotlin/Function1<kotlin/coroutines/Continuation<kotlin/Unit>, kotlin/Any?>
// module name: test-module
}
// Z.class
// ------------------------------------------
public final value class Z : kotlin/Any {
// signature: constructor-impl(Ljava/lang/String;)Ljava/lang/String;
public constructor(s: kotlin/String)
// signature: equals-impl(Ljava/lang/String;Ljava/lang/Object;)Z
public open /* synthesized */ operator fun equals(other: kotlin/Any?): kotlin/Boolean
// signature: hashCode-impl(Ljava/lang/String;)I
public open /* synthesized */ fun hashCode(): kotlin/Int
// signature: toString-impl(Ljava/lang/String;)Ljava/lang/String;
public open /* synthesized */ fun toString(): kotlin/String
// field: s:Ljava/lang/String;
// getter: getS()Ljava/lang/String;
public final val s: kotlin/String
public final get
// underlying property: s
// underlying type: kotlin/String
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,41 @@
import kotlin.reflect.KClass
@Target(AnnotationTarget.TYPE)
annotation class AnnoString(vararg val value: String)
@Target(AnnotationTarget.TYPE)
annotation class AnnoInt(vararg val value: Int)
enum class A { V1, V2 }
@Target(AnnotationTarget.TYPE)
annotation class AnnoEnum(vararg val value: A)
@Target(AnnotationTarget.TYPE)
annotation class AnnoKClass(vararg val value: KClass<*>)
@Target(AnnotationTarget.TYPE)
annotation class AnnoAnnotation(vararg val value: AnnoString)
fun annoStringVararg0(): @AnnoString() Unit {}
fun annoStringVararg1(): @AnnoString("OK") Unit {}
fun annoStringVararg2(): @AnnoString("OK", "OK2") Unit {}
fun annoIntVararg0(): @AnnoInt() Unit {}
fun annoIntVararg1(): @AnnoInt(0) Unit {}
fun annoIntVararg2(): @AnnoInt(0, 1) Unit {}
fun annoEnumVararg0(): @AnnoEnum() Unit {}
fun annoEnumVararg1(): @AnnoEnum(A.V1) Unit {}
fun annoEnumVararg2(): @AnnoEnum(A.V1, A.V2) Unit {}
fun annoKClassVararg0(): @AnnoKClass() Unit {}
fun annoKClassVararg1(): @AnnoKClass(AnnoString::class) Unit {}
fun annoKClassVararg2(): @AnnoKClass(AnnoString::class, AnnoInt::class) Unit {}
fun annoAnnotationVararg0(): @AnnoAnnotation() Unit {}
fun annoAnnotationVararg1(): @AnnoAnnotation(AnnoString()) Unit {}
fun annoAnnotationVararg2(): @AnnoAnnotation(AnnoString("OK"), AnnoString("OK1", "OK2")) Unit {}
fun annoArrayVararg0(): @AnnoString(*arrayOf()) Unit {}
fun annoArrayVararg1(): @AnnoString(*arrayOf("OK")) Unit {}
fun annoArrayVararg2(): @AnnoString(*arrayOf("OK", "OK2")) Unit {}
@@ -0,0 +1,147 @@
// A.class
// ------------------------------------------
public final enum class A : kotlin/Enum<A> {
// signature: <init>(Ljava/lang/String;I)V
private constructor()
V1,
V2,
// module name: test-module
// has Enum.entries
}
// AnnoAnnotation.class
// ------------------------------------------
public final annotation class AnnoAnnotation : kotlin/Annotation {
// signature: <init>(Lkotlin/Array;)V
public constructor(vararg value: AnnoString /* kotlin/Array<out AnnoString> */)
// getter: value()[LAnnoString;
public final val value: kotlin/Array<out AnnoString>
public final get
// module name: test-module
}
// AnnoEnum.class
// ------------------------------------------
public final annotation class AnnoEnum : kotlin/Annotation {
// signature: <init>(Lkotlin/Array;)V
public constructor(vararg value: A /* kotlin/Array<out A> */)
// getter: value()[LA;
public final val value: kotlin/Array<out A>
public final get
// module name: test-module
}
// AnnoInt.class
// ------------------------------------------
public final annotation class AnnoInt : kotlin/Annotation {
// signature: <init>([I)V
public constructor(vararg value: kotlin/Int /* kotlin/IntArray */)
// getter: value()[I
public final val value: kotlin/IntArray
public final get
// module name: test-module
}
// AnnoKClass.class
// ------------------------------------------
public final annotation class AnnoKClass : kotlin/Annotation {
// signature: <init>(Lkotlin/Array;)V
public constructor(vararg value: kotlin/reflect/KClass<*> /* kotlin/Array<out kotlin/reflect/KClass<*>> */)
// getter: value()[Ljava/lang/Class;
public final val value: kotlin/Array<out kotlin/reflect/KClass<*>>
public final get
// module name: test-module
}
// AnnoString.class
// ------------------------------------------
public final annotation class AnnoString : kotlin/Annotation {
// signature: <init>(Lkotlin/Array;)V
public constructor(vararg value: kotlin/String /* kotlin/Array<out kotlin/String> */)
// getter: value()[Ljava/lang/String;
public final val value: kotlin/Array<out kotlin/String>
public final get
// module name: test-module
}
// VarargInAnnotationKt.class
// ------------------------------------------
package {
// signature: annoAnnotationVararg0()V
public final fun annoAnnotationVararg0(): @AnnoAnnotation(value = []) kotlin/Unit
// signature: annoAnnotationVararg1()V
public final fun annoAnnotationVararg1(): @AnnoAnnotation(value = [AnnoString(value = [])]) kotlin/Unit
// signature: annoAnnotationVararg2()V
public final fun annoAnnotationVararg2(): @AnnoAnnotation(value = [AnnoString(value = ["OK"]), AnnoString(value = ["OK1", "OK2"])]) kotlin/Unit
// signature: annoArrayVararg0()V
public final fun annoArrayVararg0(): @AnnoString(value = []) kotlin/Unit
// signature: annoArrayVararg1()V
public final fun annoArrayVararg1(): @AnnoString(value = ["OK"]) kotlin/Unit
// signature: annoArrayVararg2()V
public final fun annoArrayVararg2(): @AnnoString(value = ["OK", "OK2"]) kotlin/Unit
// signature: annoEnumVararg0()V
public final fun annoEnumVararg0(): @AnnoEnum(value = []) kotlin/Unit
// signature: annoEnumVararg1()V
public final fun annoEnumVararg1(): @AnnoEnum(value = [A.V1]) kotlin/Unit
// signature: annoEnumVararg2()V
public final fun annoEnumVararg2(): @AnnoEnum(value = [A.V1, A.V2]) kotlin/Unit
// signature: annoIntVararg0()V
public final fun annoIntVararg0(): @AnnoInt(value = []) kotlin/Unit
// signature: annoIntVararg1()V
public final fun annoIntVararg1(): @AnnoInt(value = [0]) kotlin/Unit
// signature: annoIntVararg2()V
public final fun annoIntVararg2(): @AnnoInt(value = [0, 1]) kotlin/Unit
// signature: annoKClassVararg0()V
public final fun annoKClassVararg0(): @AnnoKClass(value = []) kotlin/Unit
// signature: annoKClassVararg1()V
public final fun annoKClassVararg1(): @AnnoKClass(value = [AnnoString::class]) kotlin/Unit
// signature: annoKClassVararg2()V
public final fun annoKClassVararg2(): @AnnoKClass(value = [AnnoString::class, AnnoInt::class]) kotlin/Unit
// signature: annoStringVararg0()V
public final fun annoStringVararg0(): @AnnoString(value = []) kotlin/Unit
// signature: annoStringVararg1()V
public final fun annoStringVararg1(): @AnnoString(value = ["OK"]) kotlin/Unit
// signature: annoStringVararg2()V
public final fun annoStringVararg2(): @AnnoString(value = ["OK", "OK2"]) kotlin/Unit
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
VarargInAnnotationKt
}
}
@@ -0,0 +1,19 @@
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package test
import kotlin.internal.RequireKotlin
import kotlin.internal.RequireKotlinVersionKind
@RequireKotlin("1.2", "Klass must not be used!", DeprecationLevel.WARNING, RequireKotlinVersionKind.API_VERSION)
class Klass
class Konstructor @RequireKotlin("42.0", "Konstructor must not be used!", DeprecationLevel.WARNING, RequireKotlinVersionKind.LANGUAGE_VERSION, 42) constructor()
@RequireKotlin("1.1", level = DeprecationLevel.HIDDEN, versionKind = RequireKotlinVersionKind.API_VERSION, errorCode = 314)
typealias Typealias = String
@RequireKotlin("1.2.40", level = DeprecationLevel.ERROR, versionKind = RequireKotlinVersionKind.COMPILER_VERSION)
fun function() {}
@RequireKotlin("1.3", "property must not be used!")
val property = ""
@@ -0,0 +1,47 @@
// test/Klass.class
// ------------------------------------------
// requires API version 1.2.0 (level=WARNING, message="Klass must not be used!")
public final class test/Klass : kotlin/Any {
// signature: <init>()V
public constructor()
// module name: test-module
}
// test/Konstructor.class
// ------------------------------------------
public final class test/Konstructor : kotlin/Any {
// requires language version 42.0.0 (level=WARNING, errorCode=42, message="Konstructor must not be used!")
// signature: <init>()V
public constructor()
// module name: test-module
}
// test/VersionRequirementKt.class
// ------------------------------------------
package {
// requires compiler version 1.2.40 (level=ERROR)
// signature: function()V
public final fun function(): kotlin/Unit
// requires language version 1.3.0 (level=ERROR, message="property must not be used!")
// field: property:Ljava/lang/String;
// getter: getProperty()Ljava/lang/String;
// synthetic method for annotations: getProperty$annotations()V
public final val property: kotlin/String /* = ... */
public final get
// requires API version 1.1.0 (level=HIDDEN, errorCode=314)
public typealias Typealias = kotlin/String /* = kotlin/String */
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package test {
test/VersionRequirementKt
}
}
+12
View File
@@ -0,0 +1,12 @@
// !JVM_DEFAULT_MODE: all
interface A {
fun f() {}
fun g()
}
interface B : A {
override fun g() {}
}
class C : B
+40
View File
@@ -0,0 +1,40 @@
// A.class
// ------------------------------------------
// requires compiler version 1.4.0 (level=ERROR)
public abstract interface A : kotlin/Any {
// signature: f()V
public open fun f(): kotlin/Unit
// signature: g()V
public abstract fun g(): kotlin/Unit
// module name: test-module
// has method bodies in interface
}
// B.class
// ------------------------------------------
// requires compiler version 1.4.0 (level=ERROR)
public abstract interface B : A {
// signature: g()V
public open fun g(): kotlin/Unit
// module name: test-module
// has method bodies in interface
}
// C.class
// ------------------------------------------
public final class C : B {
// signature: <init>()V
public constructor()
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,12 @@
// !JVM_DEFAULT_MODE: all-compatibility
interface A {
fun f() {}
fun g()
}
interface B : A {
override fun g() {}
}
class C : B
@@ -0,0 +1,48 @@
// A.class
// ------------------------------------------
public abstract interface A : kotlin/Any {
// signature: f()V
public open fun f(): kotlin/Unit
// signature: g()V
public abstract fun g(): kotlin/Unit
// module name: test-module
// has method bodies in interface
// is compiled in compatibility mode
}
// A$DefaultImpls.class
// ------------------------------------------
synthetic class
// B.class
// ------------------------------------------
public abstract interface B : A {
// signature: g()V
public open fun g(): kotlin/Unit
// module name: test-module
// has method bodies in interface
// is compiled in compatibility mode
}
// B$DefaultImpls.class
// ------------------------------------------
synthetic class
// C.class
// ------------------------------------------
public final class C : B {
// signature: <init>()V
public constructor()
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,8 @@
// !JVM_DEFAULT_MODE: all
@JvmDefaultWithCompatibility
interface A {
fun f() {}
}
@JvmDefaultWithCompatibility
interface B : A
@@ -0,0 +1,35 @@
// A.class
// ------------------------------------------
// requires compiler version 1.4.0 (level=ERROR)
public abstract interface A : kotlin/Any {
// signature: f()V
public open fun f(): kotlin/Unit
// module name: test-module
// has method bodies in interface
// is compiled in compatibility mode
}
// A$DefaultImpls.class
// ------------------------------------------
synthetic class
// B.class
// ------------------------------------------
// requires compiler version 1.4.0 (level=ERROR)
public abstract interface B : A {
// module name: test-module
// has method bodies in interface
// is compiled in compatibility mode
}
// B$DefaultImpls.class
// ------------------------------------------
synthetic class
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,7 @@
// !JVM_DEFAULT_MODE: all-compatibility
@JvmDefaultWithoutCompatibility
interface A {
fun f() {}
}
interface B : A
@@ -0,0 +1,28 @@
// A.class
// ------------------------------------------
public abstract interface A : kotlin/Any {
// signature: f()V
public open fun f(): kotlin/Unit
// module name: test-module
// has method bodies in interface
}
// B.class
// ------------------------------------------
public abstract interface B : A {
// module name: test-module
// has method bodies in interface
// is compiled in compatibility mode
}
// B$DefaultImpls.class
// ------------------------------------------
synthetic class
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,3 @@
fun test() = object : Runnable {
override fun run() { }
}
@@ -0,0 +1,25 @@
// AnonymousObjectKt.class
// ------------------------------------------
package {
// signature: test()Ljava/lang/Runnable;
public final fun test(): java/lang/Runnable
// module name: test-module
}
// AnonymousObjectKt$test$1.class
// ------------------------------------------
local final class .AnonymousObjectKt$test$1 : java/lang/Runnable {
// signature: run()V
public open fun run(): kotlin/Unit
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
AnonymousObjectKt
}
}
@@ -0,0 +1,21 @@
fun test() {
class Local {
inner class Inner {
val prop = object {
fun foo() {
fun bar() {
class DeepLocal {
inner class Deepest {
fun local(): Local = Local()
fun inner(): Inner = Inner()
fun deep(): DeepLocal = DeepLocal()
fun deepest(): Deepest? = Deepest()
}
}
}
}
}
}
}
}
@@ -0,0 +1,82 @@
// DeepInnerLocalChainKt.class
// ------------------------------------------
package {
// signature: test()V
public final fun test(): kotlin/Unit
// module name: test-module
}
// DeepInnerLocalChainKt$test$Local.class
// ------------------------------------------
local final class .DeepInnerLocalChainKt$test$Local : kotlin/Any {
// signature: <init>()V
public constructor()
// nested class: Inner
// module name: test-module
}
// DeepInnerLocalChainKt$test$Local$Inner.class
// ------------------------------------------
local final inner class .DeepInnerLocalChainKt$test$Local.Inner : kotlin/Any {
// signature: <init>(LDeepInnerLocalChainKt$test$Local;)V
public constructor()
// field: prop:LDeepInnerLocalChainKt$test$Local$Inner$prop$1;
// getter: getProp()LDeepInnerLocalChainKt$test$Local$Inner$prop$1;
public final val prop: .DeepInnerLocalChainKt$test$Local$Inner$prop$1
public final get
// module name: test-module
}
// DeepInnerLocalChainKt$test$Local$Inner$prop$1.class
// ------------------------------------------
local final class .DeepInnerLocalChainKt$test$Local$Inner$prop$1 : kotlin/Any {
// signature: foo()V
public final fun foo(): kotlin/Unit
// module name: test-module
}
// DeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal.class
// ------------------------------------------
local final class .DeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal : kotlin/Any {
// signature: <init>(LDeepInnerLocalChainKt$test$Local;)V
public constructor()
// nested class: Deepest
// module name: test-module
}
// DeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal$Deepest.class
// ------------------------------------------
local final inner class .DeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal.Deepest : kotlin/Any {
// signature: <init>(LDeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal;)V
public constructor()
// signature: deep()LDeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal;
public final fun deep(): .DeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal
// signature: deepest()LDeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal$Deepest;
public final fun deepest(): .DeepInnerLocalChainKt$test$Local$Inner$prop$1$foo$bar$DeepLocal.Deepest?
// signature: inner()LDeepInnerLocalChainKt$test$Local$Inner;
public final fun inner(): .DeepInnerLocalChainKt$test$Local.Inner
// signature: local()LDeepInnerLocalChainKt$test$Local;
public final fun local(): .DeepInnerLocalChainKt$test$Local
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
DeepInnerLocalChainKt
}
}
@@ -0,0 +1,36 @@
// A.class
// ------------------------------------------
public final class A : kotlin/Any {
// signature: <init>()V
public constructor()
// module name: test-module
}
// A$L.class
// ------------------------------------------
local final class .A$L<T#0 /* T */> : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: x(LA$L;)V
public final fun x(l: .A$L<.A.L.I>): kotlin/Unit
// nested class: I
// module name: test-module
}
// A$L$I.class
// ------------------------------------------
local final inner class .A.L.I : kotlin/Any {
// signature: <init>(LA$L;)V
public constructor()
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,9 @@
class A {
init {
class L<T> {
inner class I
fun x(l: L<I>) {}
}
}
}
@@ -0,0 +1,36 @@
// A.class
// ------------------------------------------
public final class A : kotlin/Any {
// signature: <init>()V
public constructor()
// module name: test-module
}
// A$L.class
// ------------------------------------------
local final class .A$L<T#0 /* T */> : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: x(LA$L;)V
public final fun x(l: .A$L<.A$L<T#0>.I>): kotlin/Unit
// nested class: I
// module name: test-module
}
// A$L$I.class
// ------------------------------------------
local final inner class .A$L.I : kotlin/Any {
// signature: <init>(LA$L;)V
public constructor()
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}
@@ -0,0 +1,11 @@
fun test() {
open class Local {
fun param(l: Local) {}
val returnType: Local = this
fun Local.receiver() = this
fun <T : Local, U : T> generic(t: T): U = null!!
}
}
@@ -0,0 +1,39 @@
// LocalClassInSignatureKt.class
// ------------------------------------------
package {
// signature: test()V
public final fun test(): kotlin/Unit
// module name: test-module
}
// LocalClassInSignatureKt$test$Local.class
// ------------------------------------------
local open class .LocalClassInSignatureKt$test$Local : kotlin/Any {
// signature: <init>()V
public constructor()
// signature: generic(LLocalClassInSignatureKt$test$Local;)LLocalClassInSignatureKt$test$Local;
public final fun <T#0 /* T */ : .LocalClassInSignatureKt$test$Local, T#1 /* U */ : T#0> generic(t: T#0): T#1
// signature: param(LLocalClassInSignatureKt$test$Local;)V
public final fun param(l: .LocalClassInSignatureKt$test$Local): kotlin/Unit
// signature: receiver(LLocalClassInSignatureKt$test$Local;)LLocalClassInSignatureKt$test$Local;
public final fun .LocalClassInSignatureKt$test$Local.receiver(): .LocalClassInSignatureKt$test$Local
// field: returnType:LLocalClassInSignatureKt$test$Local;
// getter: getReturnType()LLocalClassInSignatureKt$test$Local;
public final val returnType: .LocalClassInSignatureKt$test$Local
public final get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
package <root> {
LocalClassInSignatureKt
}
}
+9
View File
@@ -0,0 +1,9 @@
val a = 42
class A(val p: String)
fun A.foo() = p
class B<T>(val v: T & Any)
+52
View File
@@ -0,0 +1,52 @@
// ScriptSimple.class
// ------------------------------------------
public final class ScriptSimple {
// signature: foo(LScriptSimple$A;)Ljava/lang/String;
public final fun A.foo(): kotlin/String
// field: a:I
// getter: getA()I
public final val a: kotlin/Int /* = ... */
public final get
// nested class: A
// nested class: B
// module name: test-module
}
// ScriptSimple$A.class
// ------------------------------------------
public final class A : kotlin/Any {
// signature: <init>(Ljava/lang/String;)V
public constructor(p: kotlin/String)
// field: p:Ljava/lang/String;
// getter: getP()Ljava/lang/String;
public final val p: kotlin/String
public final get
// module name: test-module
}
// ScriptSimple$B.class
// ------------------------------------------
public final class B<T#0 /* T */> : kotlin/Any {
// requires language version 1.7.0 (level=ERROR)
// signature: <init>(Ljava/lang/Object;)V
public constructor(v: T#0 & Any)
// requires language version 1.7.0 (level=ERROR)
// field: v:Ljava/lang/Object;
// getter: getV()Ljava/lang/Object;
public final val v: T#0 & Any
public final get
// module name: test-module
}
// META-INF/test-module.kotlin_module
// ------------------------------------------
module {
}