Support loading Java records

^KT-43677 In Progress
This commit is contained in:
Denis.Zharkov
2020-11-23 16:02:26 +03:00
parent f25b7672a7
commit 513f7177ca
45 changed files with 688 additions and 61 deletions
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.descriptors.runtime.structure
import org.jetbrains.kotlin.load.java.structure.JavaClass
import org.jetbrains.kotlin.load.java.structure.JavaClassifierType
import org.jetbrains.kotlin.load.java.structure.JavaRecordComponent
import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
@@ -96,6 +97,9 @@ class ReflectJavaClass(
.map(::ReflectJavaConstructor)
.toList()
override val recordComponents: Collection<JavaRecordComponent>
get() = emptyList()
override fun hasDefaultConstructor() = false // any default constructor is returned by constructors
override val lightClassOriginKind: LightClassOriginKind?
@@ -114,6 +118,10 @@ class ReflectJavaClass(
override val isEnum: Boolean
get() = klass.isEnum
// TODO: Support reflect
override val isRecord: Boolean
get() = false
override fun equals(other: Any?) = other is ReflectJavaClass && klass == other.klass
override fun hashCode() = klass.hashCode()
@@ -125,7 +125,7 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() {
},
""
)
LoadDescriptorUtil.compileJavaWithAnnotationsJar(sources, tmpdir)
LoadDescriptorUtil.compileJavaWithAnnotationsJar(sources, tmpdir, emptyList(), null)
}
fileName.endsWith(".kt") -> {
val environment = KotlinTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(