[stubs] add test which checks consistency between cls and decompiled stubs
This commit is contained in:
+6
-149
@@ -1,160 +1,17 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 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.analysis.decompiler.stub.files
|
||||
|
||||
import com.intellij.core.CoreApplicationEnvironment
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.impl.DebugUtil
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.psi.stubs.PsiFileStub
|
||||
import com.intellij.util.indexing.FileContentImpl
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.file.CachedAttributeData
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.file.ClsKotlinBinaryClassCache
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.file.FileAttributeService
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.file.KotlinClsStubBuilder
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.STUB_TO_STRING_PREFIX
|
||||
import org.jetbrains.kotlin.test.*
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import java.io.DataInput
|
||||
import java.io.DataOutput
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import kotlin.io.path.absolutePathString
|
||||
import kotlin.io.path.name
|
||||
import kotlin.io.path.readText
|
||||
import kotlin.streams.toList
|
||||
|
||||
abstract class AbstractClsStubBuilderTest : KotlinTestWithEnvironment() {
|
||||
override fun createEnvironment(): KotlinCoreEnvironment {
|
||||
return KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(testRootDisposable, ConfigurationKind.JDK_NO_RUNTIME)
|
||||
abstract class AbstractClsStubBuilderTest : AbstractStubBuilderTest() {
|
||||
override fun getStubToTest(classFile: VirtualFile): PsiFileStub<*> {
|
||||
return KotlinClsStubBuilder().buildFileStub(FileContentImpl.createByFile(classFile))!!
|
||||
}
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
|
||||
with(environment.projectEnvironment.environment) {
|
||||
registerApplicationServices()
|
||||
}
|
||||
}
|
||||
|
||||
private fun CoreApplicationEnvironment.registerApplicationServices() {
|
||||
registerApplicationService(FileAttributeService::class.java, DummyFileAttributeService)
|
||||
registerApplicationService(ClsKotlinBinaryClassCache::class.java, ClsKotlinBinaryClassCache())
|
||||
}
|
||||
|
||||
fun runTest(testDirectory: String) {
|
||||
val testDirectoryPath = Paths.get(testDirectory)
|
||||
val testData = TestData.createFromDirectory(testDirectoryPath)
|
||||
|
||||
doTest(testData, useStringTable = true)
|
||||
doTest(testData, useStringTable = false)
|
||||
}
|
||||
|
||||
|
||||
private fun doTest(testData: TestData, useStringTable: Boolean) {
|
||||
val classFile = getClassFileToDecompile(testData, useStringTable)
|
||||
testClsStubsForFile(classFile, testData)
|
||||
}
|
||||
|
||||
private fun testClsStubsForFile(classFile: VirtualFile, testData: TestData) {
|
||||
val stubTreeFromCls = KotlinClsStubBuilder().buildFileStub(FileContentImpl.createByFile(classFile))!!
|
||||
KotlinTestUtils.assertEqualsToFile(testData.expectedFile, stubTreeFromCls.serializeToString())
|
||||
}
|
||||
|
||||
private fun getClassFileToDecompile(testData: TestData, useStringTable: Boolean): VirtualFile {
|
||||
val extraOptions = buildList {
|
||||
add("-Xallow-kotlin-package")
|
||||
if (useStringTable) {
|
||||
add("-Xuse-type-table")
|
||||
}
|
||||
}
|
||||
|
||||
val library = CompilerTestUtil.compileJvmLibrary(
|
||||
src = testData.directory.toFile(),
|
||||
extraOptions = extraOptions,
|
||||
).toPath()
|
||||
|
||||
return findClassFileByName(library, testData.jvmFileName)
|
||||
}
|
||||
|
||||
private fun findClassFileByName(library: Path, className: String): VirtualFile {
|
||||
val jarFileSystem = environment.projectEnvironment.environment.jarFileSystem as CoreJarFileSystem
|
||||
val root = jarFileSystem.refreshAndFindFileByPath(library.absolutePathString() + "!/")!!
|
||||
val files = mutableSetOf<VirtualFile>()
|
||||
VfsUtilCore.iterateChildrenRecursively(
|
||||
root,
|
||||
/*filter=*/{ virtualFile ->
|
||||
virtualFile.isDirectory || virtualFile.name == "$className.class"
|
||||
},
|
||||
/*iterator=*/{ virtualFile ->
|
||||
if (!virtualFile.isDirectory) {
|
||||
files.addIfNotNull(virtualFile)
|
||||
}
|
||||
true
|
||||
})
|
||||
|
||||
return files.single()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun StubElement<out PsiElement>.serializeToString(): String {
|
||||
return serializeStubToString(this)
|
||||
}
|
||||
|
||||
private fun serializeStubToString(stubElement: StubElement<*>): String {
|
||||
val treeStr = DebugUtil.stubTreeToString(stubElement).replace(SpecialNames.SAFE_IDENTIFIER_FOR_NO_NAME.asString(), "<no name>")
|
||||
|
||||
// Nodes are stored in form "NodeType:Node" and have too many repeating information for Kotlin stubs
|
||||
// Remove all repeating information (See KotlinStubBaseImpl.toString())
|
||||
return treeStr.lines().joinToString(separator = "\n") {
|
||||
if (it.contains(STUB_TO_STRING_PREFIX)) {
|
||||
it.takeWhile(Char::isWhitespace) + it.substringAfter("KotlinStub$")
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}.replace(", [", "[")
|
||||
}
|
||||
|
||||
|
||||
private data class TestData(
|
||||
val directory: Path,
|
||||
val mainKotlinFile: Path,
|
||||
val expectedFile: Path,
|
||||
val jvmFileName: String
|
||||
) {
|
||||
companion object {
|
||||
fun createFromDirectory(directory: Path): TestData {
|
||||
val allFiles = Files.list(directory).toList()
|
||||
val mainKotlinFile = allFiles.single { path ->
|
||||
path.name.replaceFirstChar { it.uppercaseChar() } == "${directory.name.removeSuffix("Kt")}.kt"
|
||||
}
|
||||
val jvmFileName = InTextDirectivesUtils.findStringWithPrefixes(mainKotlinFile.readText(), "JVM_FILE_NAME:")
|
||||
?: directory.name
|
||||
return TestData(
|
||||
directory = directory,
|
||||
mainKotlinFile = mainKotlinFile,
|
||||
expectedFile = allFiles.single { it.name == "${directory.name}.txt" },
|
||||
jvmFileName = jvmFileName,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object DummyFileAttributeService : FileAttributeService {
|
||||
override fun <T> write(file: VirtualFile, id: String, value: T, writeValueFun: (DataOutput, T) -> Unit): CachedAttributeData<T> {
|
||||
return CachedAttributeData(value, 0)
|
||||
}
|
||||
|
||||
override fun <T> read(file: VirtualFile, id: String, readValueFun: (DataInput) -> T): CachedAttributeData<T>? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* 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.analysis.decompiler.stub.files
|
||||
|
||||
import com.intellij.core.CoreApplicationEnvironment
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.impl.DebugUtil
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.file.CachedAttributeData
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.file.ClsKotlinBinaryClassCache
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.file.FileAttributeService
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.STUB_TO_STRING_PREFIX
|
||||
import org.jetbrains.kotlin.test.*
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import java.io.DataInput
|
||||
import java.io.DataOutput
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import kotlin.io.path.absolutePathString
|
||||
import kotlin.io.path.name
|
||||
import kotlin.io.path.readText
|
||||
import com.intellij.psi.stubs.PsiFileStub
|
||||
import java.util.stream.Collectors
|
||||
|
||||
abstract class AbstractStubBuilderTest : KotlinTestWithEnvironment() {
|
||||
override fun createEnvironment(): KotlinCoreEnvironment {
|
||||
return KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(testRootDisposable, ConfigurationKind.JDK_NO_RUNTIME)
|
||||
}
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
|
||||
with(environment.projectEnvironment.environment) {
|
||||
registerApplicationServices()
|
||||
}
|
||||
}
|
||||
|
||||
private fun CoreApplicationEnvironment.registerApplicationServices() {
|
||||
registerApplicationService(FileAttributeService::class.java, DummyFileAttributeService)
|
||||
registerApplicationService(ClsKotlinBinaryClassCache::class.java, ClsKotlinBinaryClassCache())
|
||||
}
|
||||
|
||||
fun runTest(testDirectory: String) {
|
||||
val testDirectoryPath = Paths.get(testDirectory)
|
||||
val testData = TestData.createFromDirectory(testDirectoryPath)
|
||||
|
||||
doTest(testData, useStringTable = true)
|
||||
doTest(testData, useStringTable = false)
|
||||
}
|
||||
|
||||
|
||||
private fun doTest(testData: TestData, useStringTable: Boolean) {
|
||||
val classFile = getClassFileToDecompile(testData, useStringTable)
|
||||
testClsStubsForFile(classFile, testData)
|
||||
}
|
||||
|
||||
private fun testClsStubsForFile(classFile: VirtualFile, testData: TestData) {
|
||||
KotlinTestUtils.assertEqualsToFile(testData.expectedFile, getStubToTest(classFile).serializeToString())
|
||||
}
|
||||
|
||||
protected abstract fun getStubToTest(classFile: VirtualFile): PsiFileStub<*>
|
||||
|
||||
private fun getClassFileToDecompile(testData: TestData, useStringTable: Boolean): VirtualFile {
|
||||
val extraOptions = buildList {
|
||||
add("-Xallow-kotlin-package")
|
||||
if (useStringTable) {
|
||||
add("-Xuse-type-table")
|
||||
}
|
||||
addAll(testData.additionalCompilerOptions)
|
||||
}
|
||||
|
||||
val library = CompilerTestUtil.compileJvmLibrary(
|
||||
src = testData.directory.toFile(),
|
||||
extraOptions = extraOptions,
|
||||
).toPath()
|
||||
|
||||
return findClassFileByName(library, testData.jvmFileName)
|
||||
}
|
||||
|
||||
private fun findClassFileByName(library: Path, className: String): VirtualFile {
|
||||
val jarFileSystem = environment.projectEnvironment.environment.jarFileSystem as CoreJarFileSystem
|
||||
val root = jarFileSystem.refreshAndFindFileByPath(library.absolutePathString() + "!/")!!
|
||||
val files = mutableSetOf<VirtualFile>()
|
||||
VfsUtilCore.iterateChildrenRecursively(
|
||||
root,
|
||||
/*filter=*/{ virtualFile ->
|
||||
virtualFile.isDirectory || virtualFile.name == "$className.class"
|
||||
},
|
||||
/*iterator=*/{ virtualFile ->
|
||||
if (!virtualFile.isDirectory) {
|
||||
files.addIfNotNull(virtualFile)
|
||||
}
|
||||
true
|
||||
})
|
||||
|
||||
return files.single()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun StubElement<out PsiElement>.serializeToString(): String {
|
||||
return serializeStubToString(this)
|
||||
}
|
||||
|
||||
private fun serializeStubToString(stubElement: StubElement<*>): String {
|
||||
val treeStr = DebugUtil.stubTreeToString(stubElement).replace(SpecialNames.SAFE_IDENTIFIER_FOR_NO_NAME.asString(), "<no name>")
|
||||
|
||||
// Nodes are stored in form "NodeType:Node" and have too many repeating information for Kotlin stubs
|
||||
// Remove all repeating information (See KotlinStubBaseImpl.toString())
|
||||
return treeStr.lines().joinToString(separator = "\n") {
|
||||
if (it.contains(STUB_TO_STRING_PREFIX)) {
|
||||
it.takeWhile(Char::isWhitespace) + it.substringAfter("KotlinStub$")
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}.replace(", [", "[")
|
||||
}
|
||||
|
||||
|
||||
private data class TestData(
|
||||
val directory: Path,
|
||||
val mainKotlinFile: Path,
|
||||
val expectedFile: Path,
|
||||
val jvmFileName: String,
|
||||
val additionalCompilerOptions: List<String>,
|
||||
) {
|
||||
companion object {
|
||||
fun createFromDirectory(directory: Path): TestData {
|
||||
val allFiles = Files.list(directory).collect(Collectors.toList())
|
||||
val mainKotlinFile = allFiles.single { path: Path ->
|
||||
path.name.replaceFirstChar { Character.toUpperCase(it) } == "${directory.name.removeSuffix("Kt")}.kt"
|
||||
}
|
||||
val fileText = mainKotlinFile.readText()
|
||||
val jvmFileName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "JVM_FILE_NAME:") ?: directory.name
|
||||
val additionalCompilerOptions = InTextDirectivesUtils.findListWithPrefixes(fileText, "// !LANGUAGE: ").map { "-XXLanguage:$it" }
|
||||
return TestData(
|
||||
directory = directory,
|
||||
mainKotlinFile = mainKotlinFile,
|
||||
expectedFile = allFiles.single { it.fileName.toString() == "${directory.name}.txt" },
|
||||
jvmFileName = jvmFileName,
|
||||
additionalCompilerOptions = additionalCompilerOptions,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object DummyFileAttributeService : FileAttributeService {
|
||||
override fun <T> write(file: VirtualFile, id: String, value: T, writeValueFun: (DataOutput, T) -> Unit): CachedAttributeData<T> {
|
||||
return CachedAttributeData(value, 0)
|
||||
}
|
||||
|
||||
override fun <T> read(file: VirtualFile, id: String, readValueFun: (DataInput) -> T): CachedAttributeData<T>? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,19 @@ dependencies {
|
||||
implementation(project(":analysis:decompiled:decompiler-to-stubs"))
|
||||
implementation(project(":analysis:decompiled:decompiler-to-file-stubs"))
|
||||
implementation(intellijCore())
|
||||
|
||||
testImplementation(projectTests(":compiler:tests-common"))
|
||||
testImplementation(projectTests(":analysis:decompiled:decompiler-to-file-stubs"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" { none() }
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
projectTest {
|
||||
dependsOn(":dist")
|
||||
workingDir = rootDir
|
||||
}
|
||||
|
||||
testsJar()
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.analysis.decompiler.psi
|
||||
|
||||
import com.intellij.ide.highlighter.JavaClassFileType
|
||||
import com.intellij.openapi.extensions.LoadingOrder
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.ClassFileViewProviderFactory
|
||||
import com.intellij.psi.FileTypeFileViewProviders
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers
|
||||
import com.intellij.psi.stubs.PsiFileStub
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.files.AbstractStubBuilderTest
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtFileStubBuilder
|
||||
|
||||
abstract class AbstractByDecompiledPsiStubBuilderTest : AbstractStubBuilderTest() {
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
|
||||
FileTypeFileViewProviders.INSTANCE.addExplicitExtension(JavaClassFileType.INSTANCE, ClassFileViewProviderFactory())
|
||||
|
||||
ClassFileDecompilers.getInstance().EP_NAME.point.apply {
|
||||
registerExtension(KotlinClassFileDecompiler(), LoadingOrder.FIRST, testRootDisposable)
|
||||
registerExtension(KotlinBuiltInDecompiler(), LoadingOrder.FIRST, testRootDisposable)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getStubToTest(classFile: VirtualFile): PsiFileStub<*> {
|
||||
val decompiledFile = PsiManager.getInstance(project).findFile(classFile)
|
||||
?: error("No decompiled file was found for $classFile")
|
||||
return KtFileStubBuilder().buildStubTree(decompiledFile) as PsiFileStub<*>
|
||||
}
|
||||
}
|
||||
+284
@@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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.analysis.decompiler.psi;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ByDecompiledPsiStubBuilderTestGenerated extends AbstractByDecompiledPsiStubBuilderTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInClsFileStubBuilder() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder"), Pattern.compile("^([^\\.]+)$"), null, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotatedFlexibleTypes")
|
||||
public void testAnnotatedFlexibleTypes() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/AnnotatedFlexibleTypes/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotatedParameterInEnumConstructor")
|
||||
public void testAnnotatedParameterInEnumConstructor() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/AnnotatedParameterInEnumConstructor/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotatedParameterInInnerClassConstructor")
|
||||
public void testAnnotatedParameterInInnerClassConstructor() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/AnnotatedParameterInInnerClassConstructor/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationClass")
|
||||
public void testAnnotationClass() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/AnnotationClass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationValues")
|
||||
public void testAnnotationValues() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/AnnotationValues/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Annotations")
|
||||
public void testAnnotations() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Annotations/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationsOnNullableTypes")
|
||||
public void testAnnotationsOnNullableTypes() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/AnnotationsOnNullableTypes/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnnotationsOnParenthesizedTypes")
|
||||
public void testAnnotationsOnParenthesizedTypes() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/AnnotationsOnParenthesizedTypes/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AnonymousReturnWithGenericType")
|
||||
public void testAnonymousReturnWithGenericType() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/AnonymousReturnWithGenericType/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassMembers")
|
||||
public void testClassMembers() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/ClassMembers/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassObject")
|
||||
public void testClassObject() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/ClassObject/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Const")
|
||||
public void testConst() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Const/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ContextReceivers")
|
||||
public void testContextReceivers() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/ContextReceivers/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Contracts")
|
||||
public void testContracts() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Contracts/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DataClass")
|
||||
public void testDataClass() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/DataClass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DefinitelyNotNullTypes")
|
||||
public void testDefinitelyNotNullTypes() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/DefinitelyNotNullTypes/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Delegation")
|
||||
public void testDelegation() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Delegation/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("DependencyOnNestedClasses")
|
||||
public void testDependencyOnNestedClasses() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/DependencyOnNestedClasses/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Enum")
|
||||
public void testEnum() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Enum/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FlexibleTypes")
|
||||
public void testFlexibleTypes() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/FlexibleTypes/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("FunInterfaceDeclaration")
|
||||
public void testFunInterfaceDeclaration() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/FunInterfaceDeclaration/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("InheritingClasses")
|
||||
public void testInheritingClasses() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/InheritingClasses/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("InnerClassEnumEntry")
|
||||
public void testInnerClassEnumEntry() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/InnerClassEnumEntry/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("InnerTypes")
|
||||
public void testInnerTypes() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/InnerTypes/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalClass")
|
||||
public void testLocalClass() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/LocalClass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Modifiers")
|
||||
public void testModifiers() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Modifiers/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("MultifileClass")
|
||||
public void testMultifileClass() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/MultifileClass/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NamedCompanionObject")
|
||||
public void testNamedCompanionObject() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/NamedCompanionObject/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("NestedClasses")
|
||||
public void testNestedClasses() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/NestedClasses/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Objects")
|
||||
public void testObjects() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Objects/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("PrivateConstField")
|
||||
public void testPrivateConstField() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/PrivateConstField/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("PrivateToThis")
|
||||
public void testPrivateToThis() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/PrivateToThis/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Sealed")
|
||||
public void testSealed() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Sealed/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SecondaryConstructors")
|
||||
public void testSecondaryConstructors() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/SecondaryConstructors/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SuspendLambda")
|
||||
public void testSuspendLambda() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/SuspendLambda/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopJvmPackageName")
|
||||
public void testTopJvmPackageName() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/TopJvmPackageName/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelMembersAnnotatedKt")
|
||||
public void testTopLevelMembersAnnotatedKt() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/TopLevelMembersAnnotatedKt/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TopLevelMembersKt")
|
||||
public void testTopLevelMembersKt() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/TopLevelMembersKt/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeAliases")
|
||||
public void testTypeAliases() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/TypeAliases/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeBoundsAndDelegationSpecifiers")
|
||||
public void testTypeBoundsAndDelegationSpecifiers() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/TypeBoundsAndDelegationSpecifiers/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeModifiers")
|
||||
public void testTypeModifiers() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/TypeModifiers/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParams")
|
||||
public void testTypeParams() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/TypeParams/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Types")
|
||||
public void testTypes() throws Exception {
|
||||
runTest("analysis/decompiled/decompiler-to-file-stubs/testData/clsFileStubBuilder/Types/");
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ dependencies {
|
||||
testApi(projectTests(":analysis:analysis-api-fe10"))
|
||||
testApi(projectTests(":analysis:analysis-api-standalone"))
|
||||
testApi(projectTests(":analysis:decompiled:decompiler-to-file-stubs"))
|
||||
testApi(projectTests(":analysis:decompiled:decompiler-to-psi"))
|
||||
testApi(projectTests(":analysis:symbol-light-classes"))
|
||||
testApi(intellijCore())
|
||||
testApiJUnit5()
|
||||
|
||||
+10
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.generators.tests.analysis.api
|
||||
|
||||
import org.jetbrains.kotlin.analysis.decompiler.psi.AbstractByDecompiledPsiStubBuilderTest
|
||||
import org.jetbrains.kotlin.analysis.decompiler.stub.files.AbstractClsStubBuilderTest
|
||||
import org.jetbrains.kotlin.generators.TestGroupSuite
|
||||
|
||||
@@ -17,4 +18,13 @@ internal fun TestGroupSuite.generateDecompiledTests() {
|
||||
model("clsFileStubBuilder", extension = null, recursive = false)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup(
|
||||
"analysis/decompiled/decompiler-to-psi/tests",
|
||||
"analysis/decompiled/decompiler-to-file-stubs/testData",
|
||||
) {
|
||||
testClass<AbstractByDecompiledPsiStubBuilderTest> {
|
||||
model("clsFileStubBuilder", extension = null, recursive = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user