diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 5282e0d17bd..08775e3b6d6 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.AbstractDataFlowValueRenderingTest import org.jetbrains.kotlin.addImport.AbstractAddImportTest import org.jetbrains.kotlin.addImportAlias.AbstractAddImportAliasTest import org.jetbrains.kotlin.allopen.AbstractBytecodeListingTestForAllOpen +import org.jetbrains.kotlin.allopen.AbstractIrBytecodeListingTestForAllOpen import org.jetbrains.kotlin.android.parcel.AbstractParcelBoxTest import org.jetbrains.kotlin.android.parcel.AbstractParcelBytecodeListingTest import org.jetbrains.kotlin.android.parcel.AbstractParcelIrBoxTest @@ -1755,6 +1756,9 @@ fun main(args: Array) { testClass { model("bytecodeListing", extension = "kt") } + testClass { + model("bytecodeListing", extension = "kt") + } } testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 index 25a09538437..3fc0ba7f9dc 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.generators.tests import org.jetbrains.kotlin.AbstractDataFlowValueRenderingTest import org.jetbrains.kotlin.addImport.AbstractAddImportTest import org.jetbrains.kotlin.allopen.AbstractBytecodeListingTestForAllOpen +import org.jetbrains.kotlin.allopen.AbstractIrBytecodeListingTestForAllOpen import org.jetbrains.kotlin.android.parcel.AbstractParcelBytecodeListingTest import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBoxTest import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBytecodeShapeTest @@ -1181,6 +1182,9 @@ fun main(args: Array) { testClass { model("bytecodeListing", extension = "kt") } + testClass { + model("bytecodeListing", extension = "kt") + } } testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 index f1313162a98..76a2b12d706 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as42 @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.generators.tests import org.jetbrains.kotlin.AbstractDataFlowValueRenderingTest import org.jetbrains.kotlin.addImport.AbstractAddImportTest import org.jetbrains.kotlin.allopen.AbstractBytecodeListingTestForAllOpen +import org.jetbrains.kotlin.allopen.AbstractIrBytecodeListingTestForAllOpen import org.jetbrains.kotlin.android.parcel.AbstractParcelBytecodeListingTest import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBoxTest import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBytecodeShapeTest @@ -1109,6 +1110,9 @@ fun main(args: Array) { testClass { model("bytecodeListing", extension = "kt") } + testClass { + model("bytecodeListing", extension = "kt") + } } testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { diff --git a/plugins/allopen/allopen-cli/test/org/jetbrains/kotlin/allopen/AbstractBytecodeListingTestForAllOpen.kt b/plugins/allopen/allopen-cli/test/org/jetbrains/kotlin/allopen/AbstractBytecodeListingTestForAllOpen.kt index 1a32c417983..d2f9fee43d0 100644 --- a/plugins/allopen/allopen-cli/test/org/jetbrains/kotlin/allopen/AbstractBytecodeListingTestForAllOpen.kt +++ b/plugins/allopen/allopen-cli/test/org/jetbrains/kotlin/allopen/AbstractBytecodeListingTestForAllOpen.kt @@ -19,14 +19,20 @@ package org.jetbrains.kotlin.allopen import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.codegen.AbstractBytecodeListingTest import org.jetbrains.kotlin.extensions.DeclarationAttributeAltererExtension +import org.jetbrains.kotlin.test.TargetBackend abstract class AbstractBytecodeListingTestForAllOpen : AbstractBytecodeListingTest() { override fun setupEnvironment(environment: KotlinCoreEnvironment) { val annotations = AbstractAllOpenDeclarationAttributeAltererExtension.ANNOTATIONS_FOR_TESTS + - AllOpenCommandLineProcessor.SUPPORTED_PRESETS.flatMap { it.value } + AllOpenCommandLineProcessor.SUPPORTED_PRESETS.flatMap { it.value } DeclarationAttributeAltererExtension.registerExtension( - environment.project, - CliAllOpenDeclarationAttributeAltererExtension(annotations)) + environment.project, + CliAllOpenDeclarationAttributeAltererExtension(annotations) + ) } -} \ No newline at end of file +} + +abstract class AbstractIrBytecodeListingTestForAllOpen : AbstractBytecodeListingTestForAllOpen() { + override val backend = TargetBackend.JVM_IR +} diff --git a/plugins/allopen/allopen-cli/test/org/jetbrains/kotlin/allopen/IrBytecodeListingTestForAllOpenGenerated.java b/plugins/allopen/allopen-cli/test/org/jetbrains/kotlin/allopen/IrBytecodeListingTestForAllOpenGenerated.java new file mode 100644 index 00000000000..8de3846a346 --- /dev/null +++ b/plugins/allopen/allopen-cli/test/org/jetbrains/kotlin/allopen/IrBytecodeListingTestForAllOpenGenerated.java @@ -0,0 +1,96 @@ +/* + * Copyright 2010-2021 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.allopen; + +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.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("plugins/allopen/allopen-cli/testData/bytecodeListing") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class IrBytecodeListingTestForAllOpenGenerated extends AbstractIrBytecodeListingTestForAllOpen { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBytecodeListing() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/allopen/allopen-cli/testData/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("allOpenOnNotClasses.kt") + public void testAllOpenOnNotClasses() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/allOpenOnNotClasses.kt"); + } + + @TestMetadata("alreadyOpen.kt") + public void testAlreadyOpen() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/alreadyOpen.kt"); + } + + @TestMetadata("anonymousObject.kt") + public void testAnonymousObject() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/anonymousObject.kt"); + } + + @TestMetadata("explicitFinal.kt") + public void testExplicitFinal() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/explicitFinal.kt"); + } + + @TestMetadata("metaAnnotation.kt") + public void testMetaAnnotation() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/metaAnnotation.kt"); + } + + @TestMetadata("nestedInner.kt") + public void testNestedInner() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/nestedInner.kt"); + } + + @TestMetadata("noAllOpen.kt") + public void testNoAllOpen() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/noAllOpen.kt"); + } + + @TestMetadata("privateMembers.kt") + public void testPrivateMembers() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/privateMembers.kt"); + } + + @TestMetadata("sealed.kt") + public void testSealed() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/sealed.kt"); + } + + @TestMetadata("severalAllOpen.kt") + public void testSeveralAllOpen() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/severalAllOpen.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/simple.kt"); + } + + @TestMetadata("springAnnotations.kt") + public void testSpringAnnotations() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/springAnnotations.kt"); + } + + @TestMetadata("superClassAnnotation.kt") + public void testSuperClassAnnotation() throws Exception { + runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/superClassAnnotation.kt"); + } +} diff --git a/plugins/allopen/allopen-cli/testData/bytecodeListing/allOpenOnNotClasses_ir.txt b/plugins/allopen/allopen-cli/testData/bytecodeListing/allOpenOnNotClasses_ir.txt new file mode 100644 index 00000000000..576fcfe7086 --- /dev/null +++ b/plugins/allopen/allopen-cli/testData/bytecodeListing/allOpenOnNotClasses_ir.txt @@ -0,0 +1,43 @@ +@AllOpen +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class AllOpen { + // source: 'allOpenOnNotClasses.kt' +} + +@AllOpen +@kotlin.Metadata +public final enum class Enum { + // source: 'allOpenOnNotClasses.kt' + private synthetic final static field $VALUES: Enum[] + private synthetic final static method $values(): Enum[] + static method (): void + private method (p0: java.lang.String, p1: int): void + public static method valueOf(p0: java.lang.String): Enum + public static method values(): Enum[] +} + +@AllOpen +@kotlin.Metadata +public interface Intf { + // source: 'allOpenOnNotClasses.kt' +} + +@kotlin.Metadata +public final class MyClass { + // source: 'allOpenOnNotClasses.kt' + private @AllOpen @org.jetbrains.annotations.NotNull field prop: java.lang.String + public method (): void + public final @AllOpen @org.jetbrains.annotations.NotNull method getProp(): java.lang.String + public final @AllOpen method method(): void + public final @AllOpen method setProp(@org.jetbrains.annotations.NotNull p0: java.lang.String): void +} + +@AllOpen +@kotlin.Metadata +public final class Obj { + // source: 'allOpenOnNotClasses.kt' + public final static @org.jetbrains.annotations.NotNull field INSTANCE: Obj + static method (): void + private method (): void +} diff --git a/plugins/allopen/allopen-cli/testData/bytecodeListing/anonymousObject_ir.txt b/plugins/allopen/allopen-cli/testData/bytecodeListing/anonymousObject_ir.txt new file mode 100644 index 00000000000..b89d4464db7 --- /dev/null +++ b/plugins/allopen/allopen-cli/testData/bytecodeListing/anonymousObject_ir.txt @@ -0,0 +1,36 @@ +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class AllOpen { + // source: 'anonymousObject.kt' +} + +@kotlin.Metadata +public final class Test$a$1 { + // source: 'anonymousObject.kt' + enclosing method Test.()V + inner (anonymous) class Test$a$1 + method (): void + public method run(): void +} + +@kotlin.Metadata +public final class Test$b$1 { + // source: 'anonymousObject.kt' + enclosing method Test.b()V + inner (anonymous) class Test$b$1 + method (): void + public method run(): void +} + +@AllOpen +@kotlin.Metadata +public class Test { + // source: 'anonymousObject.kt' + private final @org.jetbrains.annotations.NotNull field a: java.lang.Runnable + inner (anonymous) class Test$a$1 + inner (anonymous) class Test$b$1 + public method (): void + private final static method b$lambda-0(): void + public method b(): void + public @org.jetbrains.annotations.NotNull method getA(): java.lang.Runnable +} diff --git a/plugins/allopen/allopen-cli/testData/bytecodeListing/privateMembers_ir.txt b/plugins/allopen/allopen-cli/testData/bytecodeListing/privateMembers_ir.txt new file mode 100644 index 00000000000..03f08be40e7 --- /dev/null +++ b/plugins/allopen/allopen-cli/testData/bytecodeListing/privateMembers_ir.txt @@ -0,0 +1,24 @@ +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class AllOpen { + // source: 'privateMembers.kt' +} + +@AllOpen +@kotlin.Metadata +final class Test { + // source: 'privateMembers.kt' + private final @org.jetbrains.annotations.NotNull field internalProp: java.lang.String + private final @org.jetbrains.annotations.NotNull field privateProp: java.lang.String + private final @org.jetbrains.annotations.NotNull field protectedProp: java.lang.String + private final @org.jetbrains.annotations.NotNull field publicProp: java.lang.String + public method (): void + public @org.jetbrains.annotations.NotNull method getInternalProp$test_module(): java.lang.String + protected @org.jetbrains.annotations.NotNull method getProtectedProp(): java.lang.String + public @org.jetbrains.annotations.NotNull method getPublicProp(): java.lang.String + public method internalMethod$test_module(): void + private final method privateMethod(): void + private final method privateTailrecMethod(): void + protected method protectedMethod(): void + public method publicMethod(): void +}