diff --git a/plugins/kapt3/kapt3-compiler/test/org/jetbrains/kotlin/kapt3/test/AbstractKotlinKapt3Test.kt b/plugins/kapt3/kapt3-compiler/test/org/jetbrains/kotlin/kapt3/test/AbstractKotlinKapt3Test.kt index e64756c26f0..6bda5bdb9ff 100644 --- a/plugins/kapt3/kapt3-compiler/test/org/jetbrains/kotlin/kapt3/test/AbstractKotlinKapt3Test.kt +++ b/plugins/kapt3/kapt3-compiler/test/org/jetbrains/kotlin/kapt3/test/AbstractKotlinKapt3Test.kt @@ -332,7 +332,16 @@ open class AbstractClassFileToSourceStubConverterTest : AbstractKotlinKapt3Test( } } } - KotlinTestUtils.assertEqualsToFile(txtFile, actual) + + val irTxtFile = File(txtFile.parentFile, txtFile.nameWithoutExtension + "_ir.txt") + val expectedFile = + if (backend.isIR && irTxtFile.exists()) irTxtFile + else txtFile + KotlinTestUtils.assertEqualsToFile(expectedFile, actual) + + if (backend.isIR && txtFile.exists() && irTxtFile.exists() && txtFile.readText() == irTxtFile.readText()) { + fail("JVM and JVM_IR golden files are identical. Remove $irTxtFile.") + } } } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/dataClass.kt b/plugins/kapt3/kapt3-compiler/testData/converter/dataClass.kt index b1b72192c6f..0ecf8b8759f 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/dataClass.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/dataClass.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR - data class User(val firstName: String, val secondName: String, val age: Int) { fun procedure() {} } diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/dataClass_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/dataClass_ir.txt new file mode 100644 index 00000000000..14d9b47b116 --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/dataClass_ir.txt @@ -0,0 +1,71 @@ +import java.lang.System; + +@kotlin.Metadata() +public final class User { + @org.jetbrains.annotations.NotNull() + private final java.lang.String firstName = null; + @org.jetbrains.annotations.NotNull() + private final java.lang.String secondName = null; + private final int age = 0; + + public User(@org.jetbrains.annotations.NotNull() + java.lang.String firstName, @org.jetbrains.annotations.NotNull() + java.lang.String secondName, int age) { + super(); + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getFirstName() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getSecondName() { + return null; + } + + public final int getAge() { + return 0; + } + + public final void procedure() { + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String component1() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String component2() { + return null; + } + + public final int component3() { + return 0; + } + + @org.jetbrains.annotations.NotNull() + public final User copy(@org.jetbrains.annotations.NotNull() + java.lang.String firstName, @org.jetbrains.annotations.NotNull() + java.lang.String secondName, int age) { + return null; + } + + @java.lang.Override() + public boolean equals(@org.jetbrains.annotations.Nullable() + java.lang.Object other) { + return false; + } + + @java.lang.Override() + public int hashCode() { + return 0; + } + + @org.jetbrains.annotations.NotNull() + @java.lang.Override() + public java.lang.String toString() { + return null; + } +} diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses.kt b/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses.kt index 841b52326b4..f3325ae0896 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses.kt @@ -1,3 +1 @@ -// IGNORE_BACKEND: JVM_IR - inline class Cl(val a: String) diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses_ir.txt new file mode 100644 index 00000000000..88ae1debd1a --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/inlineClasses_ir.txt @@ -0,0 +1,32 @@ +import java.lang.System; + +@kotlin.Metadata() +@kotlin.jvm.JvmInline() +public final class Cl { + + public Cl() { + super(); + } + @org.jetbrains.annotations.NotNull() + private final java.lang.String a = null; + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getA() { + return null; + } + + @java.lang.Override() + public boolean equals(java.lang.Object other) { + return false; + } + + @java.lang.Override() + public int hashCode() { + return 0; + } + + @java.lang.Override() + public java.lang.String toString() { + return null; + } +} diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/innerClassesWithTypeParameters.kt b/plugins/kapt3/kapt3-compiler/testData/converter/innerClassesWithTypeParameters.kt index 96e01dbe455..090288b40c6 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/innerClassesWithTypeParameters.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/innerClassesWithTypeParameters.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR - class Test { private var a = FilterValueDelegate() private inner class FilterValueDelegate diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/innerClassesWithTypeParameters_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/innerClassesWithTypeParameters_ir.txt new file mode 100644 index 00000000000..a6bab645ca1 --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/innerClassesWithTypeParameters_ir.txt @@ -0,0 +1,73 @@ +import java.lang.System; + +@kotlin.Metadata() +public final class Test { + @org.jetbrains.annotations.NotNull() + private Test.FilterValueDelegate a; + + public Test() { + super(); + } + + @kotlin.Metadata() + final class FilterValueDelegate { + + public FilterValueDelegate() { + super(); + } + } +} + +//////////////////// + + +import java.lang.System; + +@kotlin.Metadata() +public final class Test2 { + + public Test2() { + super(); + } + + @kotlin.Metadata() + public final class FilterValueDelegate { + @org.jetbrains.annotations.NotNull() + private Test2.FilterValueDelegate.Filter2 a; + + public FilterValueDelegate() { + super(); + } + + @kotlin.Metadata() + public final class Filter2 { + + public Filter2() { + super(); + } + } + } +} + +//////////////////// + + +import java.lang.System; + +@kotlin.Metadata() +public final class Test3 { + @org.jetbrains.annotations.NotNull() + private Test3.FilterValueDelegate a; + + public Test3() { + super(); + } + + @kotlin.Metadata() + static final class FilterValueDelegate { + + public FilterValueDelegate() { + super(); + } + } +} diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt17567.kt b/plugins/kapt3/kapt3-compiler/testData/converter/kt17567.kt index d0ab32dcc23..e7fde5e2167 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt17567.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt17567.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR - package test internal class MutableEntry( diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt17567_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt17567_ir.txt new file mode 100644 index 00000000000..0f8c726b24b --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt17567_ir.txt @@ -0,0 +1,20 @@ +package test; + +import java.lang.System; + +@kotlin.Metadata() +public final class MutableEntry implements java.util.Map.Entry, kotlin.jvm.internal.markers.KMutableMap.Entry { + @org.jetbrains.annotations.NotNull() + private final java.util.Map internal = null; + private final K key = null; + + public MutableEntry(@org.jetbrains.annotations.NotNull() + java.util.Map internal, K key, V value) { + super(); + } + + @java.lang.Override() + public K getKey() { + return null; + } +} diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt19700.kt b/plugins/kapt3/kapt3-compiler/testData/converter/kt19700.kt index b8321126da8..898e5797912 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt19700.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt19700.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR - package test class Test { diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt19700_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt19700_ir.txt new file mode 100644 index 00000000000..acfd19eb947 --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt19700_ir.txt @@ -0,0 +1,25 @@ +package test; + +import java.lang.System; + +@kotlin.Metadata() +public abstract interface ListUpdateCallback { + + public abstract void onInserted(int position, int count); +} + +//////////////////// + +package test; + +import java.lang.System; + +@kotlin.Metadata() +public final class Test { + @org.jetbrains.annotations.NotNull() + private final test.ListUpdateCallback x = null; + + public Test() { + super(); + } +} diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt19750.kt b/plugins/kapt3/kapt3-compiler/testData/converter/kt19750.kt index 8c58cdf8274..91920949c79 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt19750.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt19750.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR - package test class Test { diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt19750_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt19750_ir.txt new file mode 100644 index 00000000000..b6fde0bbc0b --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt19750_ir.txt @@ -0,0 +1,28 @@ +package test; + +import java.lang.System; + +@kotlin.Metadata() +public final class Test { + @org.jetbrains.annotations.NotNull() + private final test.TypedListUpdateCallback x = null; + + public Test() { + super(); + } +} + +//////////////////// + +package test; + +import java.lang.System; + +@kotlin.Metadata() +public abstract interface TypedListUpdateCallback { + + public abstract void onInserted(@org.jetbrains.annotations.NotNull() + C position, @org.jetbrains.annotations.NotNull() + C count, @org.jetbrains.annotations.NotNull() + T item); +} diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt24272.kt b/plugins/kapt3/kapt3-compiler/testData/converter/kt24272.kt index 875eddc4d07..0e3c4995bab 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/kt24272.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt24272.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // STRICT class Foo(private val string: String) { diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/kt24272_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/kt24272_ir.txt new file mode 100644 index 00000000000..a89daf55ca5 --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/kt24272_ir.txt @@ -0,0 +1,42 @@ +import java.lang.System; + +@kotlin.Metadata() +public final class Foo { + @org.jetbrains.annotations.NotNull() + private final java.lang.String string = null; + @org.jetbrains.annotations.NotNull() + private final Foo.Bar bar = null; + + public Foo(@org.jetbrains.annotations.NotNull() + java.lang.String string) { + super(); + } + + @org.jetbrains.annotations.NotNull() + public final Foo.Bar getBar() { + return null; + } + + @kotlin.Metadata() + public static final class Bar { + @org.jetbrains.annotations.NotNull() + private final java.lang.String string = null; + @org.jetbrains.annotations.NotNull() + private final java.util.ArrayList bars = null; + + public Bar(@org.jetbrains.annotations.NotNull() + java.lang.String string) { + super(); + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getString() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.ArrayList getBars() { + return null; + } + } +} diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.kt b/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.kt index 4475dc36d9d..e757e33eed0 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // WITH_STDLIB interface Intf diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty_ir.txt new file mode 100644 index 00000000000..e409f2a65b1 --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty_ir.txt @@ -0,0 +1,51 @@ +import java.lang.System; + +@kotlin.Metadata() +public final class Foo { + @org.jetbrains.annotations.NotNull() + private final kotlin.Lazy foo$delegate = null; + @org.jetbrains.annotations.NotNull() + private final kotlin.Lazy bar$delegate = null; + @org.jetbrains.annotations.NotNull() + private final kotlin.Lazy baz$delegate = null; + @org.jetbrains.annotations.NotNull() + private final kotlin.Lazy generic1$delegate = null; + + public Foo() { + super(); + } + + private final java.lang.Runnable getFoo() { + return null; + } + + private final java.lang.Object getBar() { + return null; + } + + private final java.lang.Object getBaz() { + return null; + } + + private final GenericIntf getGeneric1() { + return null; + } +} + +//////////////////// + + +import java.lang.System; + +@kotlin.Metadata() +public abstract interface GenericIntf { +} + +//////////////////// + + +import java.lang.System; + +@kotlin.Metadata() +public abstract interface Intf { +}