Add UltraLightFacadeClassTest
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
/** should load cls */
|
||||
|
||||
suspend fun doSomething(foo: String): Int {}
|
||||
|
||||
fun <T> async(block: suspend () -> T)
|
||||
@@ -0,0 +1,3 @@
|
||||
import JS = kotlin.jvm.JvmName
|
||||
|
||||
@JS("notFoo") fun foo() {}
|
||||
@@ -0,0 +1,2 @@
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun foo() {}
|
||||
@@ -0,0 +1,4 @@
|
||||
@JvmField
|
||||
val a: Collection<*> = emptyList()
|
||||
@JvmField
|
||||
var b: Int = 1
|
||||
@@ -0,0 +1,22 @@
|
||||
var rwProp: Int
|
||||
@JvmName("get_rwProp")
|
||||
get() = 0
|
||||
@JvmName("set_rwProp")
|
||||
set(v) {}
|
||||
|
||||
@get:JvmName("xyz1")
|
||||
@set:JvmName("xyz2")
|
||||
var xyz: String
|
||||
get() = ""
|
||||
set(value) {}
|
||||
|
||||
@get:JvmName("hasBigArity")
|
||||
val hasBigArity: Boolean
|
||||
get() = true
|
||||
|
||||
fun getRwProp(): Int = 123
|
||||
fun setRwProp(v: Int) {}
|
||||
|
||||
fun foo(x: List<String>) {}
|
||||
@JvmName("fooInt")
|
||||
fun foo(x: List<Int>) {}
|
||||
@@ -0,0 +1,31 @@
|
||||
class Inv<E>
|
||||
class Out<out T>
|
||||
class OutPair<out Final, out Y>
|
||||
class In<in Z>
|
||||
|
||||
class Final
|
||||
open class Open
|
||||
|
||||
@JvmSuppressWildcards(true)
|
||||
fun deepOpen(x: Out<Out<Out<Open>>>) {}
|
||||
|
||||
@JvmSuppressWildcards(false)
|
||||
fun bar(): Out<Open> = null!!
|
||||
|
||||
fun simpleOut(x: Out<@JvmWildcard Final>) {}
|
||||
fun simpleIn(x: In<@JvmWildcard Any?>) {}
|
||||
|
||||
fun falseTrueFalse(): @JvmSuppressWildcards(false) OutPair<Final, @JvmSuppressWildcards OutPair<Out<Final>, Out<@JvmSuppressWildcards(false) Final>>> = null!!
|
||||
fun combination(): @JvmSuppressWildcards OutPair<Open, @JvmWildcard OutPair<Open, @JvmWildcard Out<Open>>> = null!!
|
||||
|
||||
@JvmSuppressWildcards(false)
|
||||
fun foo(x: Boolean, y: Out<Int>): Int = 1
|
||||
|
||||
@JvmSuppressWildcards(true)
|
||||
fun bar(x: Boolean, y: In<Long>, z: @JvmSuppressWildcards(false) Long): Int = 1
|
||||
|
||||
@JvmSuppressWildcards(true)
|
||||
fun foo2(): Out<T>
|
||||
|
||||
@JvmSuppressWildcards(true)
|
||||
fun foo3(): In<Open>
|
||||
@@ -0,0 +1,10 @@
|
||||
lateinit var a: String
|
||||
|
||||
lateinit var b: String
|
||||
private set
|
||||
|
||||
lateinit var c: String
|
||||
protected set
|
||||
|
||||
lateinit var d: String
|
||||
internal set
|
||||
@@ -0,0 +1,4 @@
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("multifileFacade")
|
||||
|
||||
fun foo() = 42
|
||||
@@ -0,0 +1,4 @@
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("multifileFacade")
|
||||
|
||||
fun bar() = 24
|
||||
@@ -0,0 +1,4 @@
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("multifileFacade")
|
||||
|
||||
fun foo() = 42
|
||||
@@ -0,0 +1,4 @@
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("otherMultifileFacade")
|
||||
|
||||
fun bar() = 24
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
val f1 = 2
|
||||
|
||||
val intConst: dynamic = 30
|
||||
val arrayConst: Any = byteArrayOf(1,2)
|
||||
|
||||
protected var f2 = 3
|
||||
|
||||
var name: String = "x"
|
||||
|
||||
val isEmpty get() = false
|
||||
var isEmptyMutable: Boolean?
|
||||
var islowercase: Boolean?
|
||||
var isEmptyInt: Int?
|
||||
var getInt: Int?
|
||||
|
||||
internal var stringRepresentation: String
|
||||
get() = this.toString()
|
||||
set(value) {
|
||||
setDataFromString(value)
|
||||
}
|
||||
|
||||
const val SUBSYSTEM_DEPRECATED: String = "This subsystem is deprecated"
|
||||
|
||||
var counter = 0
|
||||
set(value) {
|
||||
if (value >= 0) field = value
|
||||
}
|
||||
var counter2 : Int?
|
||||
get() = field
|
||||
set(value) {
|
||||
if (value >= 0) field = value
|
||||
}
|
||||
|
||||
lateinit var subject: Unresolved
|
||||
internal lateinit var internalVarPrivateSet: String
|
||||
private set
|
||||
protected lateinit var protectedLateinitVar: String
|
||||
|
||||
var delegatedProp: String by Delegate()
|
||||
var delegatedProp2 by MyProperty()
|
||||
|
||||
var lazyProp: String by lazy { "abc" }
|
||||
|
||||
val Int.intProp: Int
|
||||
get() = 1
|
||||
|
||||
final internal var internalWithPrivateSet: Int = 1
|
||||
private set
|
||||
|
||||
protected var protectedWithPrivateSet: String = ""
|
||||
private set
|
||||
|
||||
val sum: (Int)->Int = { x: Int -> sum(x - 1) + x }
|
||||
|
||||
operator fun getValue(t: T, p: KProperty<*>): Int = 42
|
||||
operator fun setValue(t: T, p: KProperty<*>, i: Int) {}
|
||||
|
||||
@delegate:Transient
|
||||
val plainField: Int = 1
|
||||
|
||||
@delegate:Transient
|
||||
val lazy by lazy { 1 }
|
||||
|
||||
public var int1: Int
|
||||
private set
|
||||
protected get
|
||||
public var int2: Int
|
||||
public get
|
||||
internal set
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
open fun bar(a: Int, b:Any, c:Foo): Unit {}
|
||||
internal fun bar2(a: Sequence, b: Unresolved) {}
|
||||
private fun bar3(x: Foo.Inner, vararg y: Inner) = "str"
|
||||
fun bar4() = 42
|
||||
|
||||
public fun nullableVararg(vararg o: Any?): Unit
|
||||
|
||||
operator fun plus(increment: Int): Foo {}
|
||||
fun String.onString(a: (Int) -> Any?): Foo {}
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
class MyException : Exception
|
||||
|
||||
@Throws(java.io.IOException::class, MyException::class)
|
||||
fun readFile(name: String): String {}
|
||||
|
||||
// Should be mapped to java.lang.Throwable
|
||||
@Throws(kotlin.Throwable::class)
|
||||
fun baz() {}
|
||||
@@ -0,0 +1,51 @@
|
||||
class Inv<E>
|
||||
class Out<out T>
|
||||
class OutPair<out Final, out Y>
|
||||
class In<in Z>
|
||||
|
||||
class Final
|
||||
open class Open
|
||||
|
||||
// The signatures are obtained from compiler/testData/writeSignature/declarationSiteVariance/wildcardOptimization
|
||||
fun openClassArgument(x: Out<Open>, y: In<Open>) {}
|
||||
fun finalClassArgument(x: Out<Final>, y: In<Final>) {}
|
||||
fun oneArgumentFinal(x: OutPair<Final, Open>) {}
|
||||
|
||||
fun arrayOfOutOpen(x: Array<Out<Open>>) {}
|
||||
fun arrayOfOutFinal(x: Array<Out<Final>>) {}
|
||||
fun outOfArrayOpen(x: Out<Array<Open>>) {}
|
||||
fun outOfArrayOutOpen(x: Out<Array<out Open>>) {}
|
||||
|
||||
fun deepOpen(x: Out<Out<Out<Open>>>) {}
|
||||
fun deepFinal(x: Out<Out<Out<Final>>>) {}
|
||||
|
||||
fun skipAllOutInvWildcards(): Inv<OutPair<Open, Out<Out<Open>>>> = null!!
|
||||
fun skipAllInvWildcards(): Inv<In<Out<Open>>> = null!!
|
||||
fun notDeepIn(): In<Final> = null!!
|
||||
fun skipWildcardsUntilIn0(): Out<In<Out<Open>>> = null!!
|
||||
fun skipWildcardsUntilIn1(): Out<In<Out<Final>>> = null!!
|
||||
fun skipWildcardsUntilIn2(): Out<In<OutPair<Final, Out<Open>>>> = null!!
|
||||
fun skipWildcardsUntilInProjection(): Inv<in Out<Open>> = null!!
|
||||
|
||||
fun outIn(x: Out<In<Final>>) {}
|
||||
fun outInAny(x: Out<In<Any?>>) {}
|
||||
|
||||
fun invInv(x: Out<Inv<Open>>) {}
|
||||
fun invOut(x: Out<Inv<out Open>>) {}
|
||||
fun invOutFinal(x: Out<Inv<out Final>>) {}
|
||||
fun invIn(x: Out<Inv<in Final>>) {}
|
||||
fun invInAny(x: Out<Inv<in Any>>) {}
|
||||
|
||||
fun inFinal(x: In<Final>) {}
|
||||
fun inAny(x: In<Any>) {}
|
||||
fun inOutFinal(x: In<Out<Final>>) {}
|
||||
|
||||
fun invOpen(x: Inv<Open>) {}
|
||||
fun invFinal(x: Inv<Final>) {}
|
||||
fun invOutOpen(x: Inv<Out<Open>>) {}
|
||||
fun invOutFinal(x: Inv<Out<Final>>) {}
|
||||
fun invInOutOpen(x: Inv<In<Out<Open>>>) {}
|
||||
fun invInOutFinal(x: Inv<In<Out<Final>>>) {}
|
||||
fun invOutProjectedOutFinal(x: Inv<out Out<Final>>) {}
|
||||
|
||||
fun <Q : Final> typeParameter(x: Out<Q>, y: In<Q>) {}
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBytecodeShapeT
|
||||
import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidSyntheticPropertyDescriptorTest
|
||||
import org.jetbrains.kotlin.asJava.classes.AbstractUltraLightClassLoadingTest
|
||||
import org.jetbrains.kotlin.asJava.classes.AbstractUltraLightClassSanityTest
|
||||
import org.jetbrains.kotlin.asJava.classes.AbstractUltraLightFacadeClassTest
|
||||
import org.jetbrains.kotlin.checkers.*
|
||||
import org.jetbrains.kotlin.copyright.AbstractUpdateKotlinCopyrightTest
|
||||
import org.jetbrains.kotlin.findUsages.AbstractFindUsagesTest
|
||||
@@ -843,6 +844,10 @@ fun main(args: Array<String>) {
|
||||
model("asJava/ultraLightClasses", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractUltraLightFacadeClassTest> {
|
||||
model("asJava/ultraLightFacades", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractIdeCompiledLightClassTest> {
|
||||
model("asJava/lightClasses", excludeDirs = listOf("local", "compilationErrors", "ideRegression"), pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBytecodeShapeT
|
||||
import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidSyntheticPropertyDescriptorTest
|
||||
import org.jetbrains.kotlin.asJava.classes.AbstractUltraLightClassLoadingTest
|
||||
import org.jetbrains.kotlin.asJava.classes.AbstractUltraLightClassSanityTest
|
||||
import org.jetbrains.kotlin.asJava.classes.AbstractUltraLightFacadeClassTest
|
||||
import org.jetbrains.kotlin.checkers.*
|
||||
import org.jetbrains.kotlin.copyright.AbstractUpdateKotlinCopyrightTest
|
||||
import org.jetbrains.kotlin.findUsages.AbstractFindUsagesTest
|
||||
@@ -856,6 +857,10 @@ fun main(args: Array<String>) {
|
||||
model("asJava/ultraLightClasses", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractUltraLightFacadeClassTest> {
|
||||
model("asJava/ultraLightFacades", pattern = KT_OR_KTS)
|
||||
}
|
||||
|
||||
testClass<AbstractIdeCompiledLightClassTest> {
|
||||
model("asJava/lightClasses", excludeDirs = listOf("local", "compilationErrors", "ideRegression"), pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME)
|
||||
}
|
||||
|
||||
@@ -5,5 +5,4 @@ public class Testing {
|
||||
}
|
||||
|
||||
// EXIST: funInFacade
|
||||
// EXIST: funInFacade2
|
||||
// LIGHT_CLASS: facades.MultiFileFacadeClass
|
||||
// EXIST: funInFacade2
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.asJava.classes
|
||||
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import org.jetbrains.kotlin.asJava.KotlinAsJavaSupport
|
||||
import org.jetbrains.kotlin.idea.perf.UltraLightChecker
|
||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
import org.jetbrains.kotlin.kdoc.psi.api.KDoc
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.psiUtil.findDescendantOfType
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractUltraLightFacadeClassTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
|
||||
fun doTest(testDataPath: String) {
|
||||
val file = myFixture.addFileToProject(testDataPath, File(testDataPath).readText()) as KtFile
|
||||
|
||||
val additionalFilePath = "$testDataPath.1"
|
||||
if(File(additionalFilePath).exists()) {
|
||||
myFixture.addFileToProject(additionalFilePath.replaceFirst(".kt.1", "1.kt"), File(additionalFilePath).readText())
|
||||
}
|
||||
|
||||
val scope = GlobalSearchScope.allScope(project)
|
||||
val facades = KotlinAsJavaSupport.getInstance(project).getFacadeNames(FqName.ROOT, scope)
|
||||
|
||||
for (facadeName in facades) {
|
||||
val ultraLightClass = UltraLightChecker.checkFacadeEquivalence(FqName(facadeName), scope, project)
|
||||
if (ultraLightClass != null) {
|
||||
checkClassLoadingExpectations(file, ultraLightClass)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkClassLoadingExpectations(
|
||||
primaryFile: KtFile,
|
||||
ultraLightClass: KtLightClassForFacade
|
||||
) {
|
||||
|
||||
val clsLoadingExpected = primaryFile.findDescendantOfType<KDoc> { it.text?.contains("should load cls") == true } !== null
|
||||
|
||||
assertEquals(
|
||||
"Cls-loaded status differs from expected for ${ultraLightClass.qualifiedName}",
|
||||
clsLoadingExpected,
|
||||
ultraLightClass.isClsDelegateLoaded
|
||||
)
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.asJava.classes;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
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("compiler/testData/asJava/ultraLightFacades")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class UltraLightFacadeClassTestGenerated extends AbstractUltraLightFacadeClassTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInUltraLightFacades() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/ultraLightFacades"), Pattern.compile("^(.+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("coroutines.kt")
|
||||
public void testCoroutines() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/coroutines.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("importAliases.kt")
|
||||
public void testImportAliases() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/importAliases.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOnly.kt")
|
||||
public void testInlineOnly() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/inlineOnly.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmField.kt")
|
||||
public void testJvmField() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/jvmField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmName.kt")
|
||||
public void testJvmName() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/jvmName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmWildcardAnnotations.kt")
|
||||
public void testJvmWildcardAnnotations() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/jvmWildcardAnnotations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lateinitProperty.kt")
|
||||
public void testLateinitProperty() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/lateinitProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileFacade.kt")
|
||||
public void testMultifileFacade() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/multifileFacade.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileFacadeJvmName.kt")
|
||||
public void testMultifileFacadeJvmName() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/multifileFacadeJvmName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("properties.kt")
|
||||
public void testProperties() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/properties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleFunctions.kt")
|
||||
public void testSimpleFunctions() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/simpleFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("throwsAnnotation.kt")
|
||||
public void testThrowsAnnotation() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/throwsAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("wildcardOptimization.kt")
|
||||
public void testWildcardOptimization() throws Exception {
|
||||
runTest("compiler/testData/asJava/ultraLightFacades/wildcardOptimization.kt");
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,16 @@
|
||||
package org.jetbrains.kotlin.idea.perf
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
|
||||
import org.jetbrains.kotlin.asJava.classes.KtUltraLightClass
|
||||
import org.jetbrains.kotlin.asJava.classes.KtUltraLightSupport
|
||||
import org.jetbrains.kotlin.asJava.classes.isPrivateOrParameterInPrivateMethod
|
||||
import org.jetbrains.kotlin.asJava.classes.*
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightNullabilityAnnotation
|
||||
import org.jetbrains.kotlin.load.kotlin.NON_EXISTENT_CLASS_NAME
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.junit.Assert
|
||||
@@ -37,6 +37,36 @@ object UltraLightChecker {
|
||||
fun allClasses(file: KtFile): List<KtClassOrObject> =
|
||||
SyntaxTraverser.psiTraverser(file).filter(KtClassOrObject::class.java).toList()
|
||||
|
||||
|
||||
fun checkFacadeEquivalence(
|
||||
fqName: FqName,
|
||||
searchScope: GlobalSearchScope,
|
||||
project: Project
|
||||
): KtLightClassForFacade? {
|
||||
|
||||
val oldForceFlag = KtUltraLightSupport.forceUsingOldLightClasses
|
||||
KtUltraLightSupport.forceUsingOldLightClasses = true
|
||||
val gold = KtLightClassForFacade.createForFacadeNoCache(fqName, searchScope, project)
|
||||
KtUltraLightSupport.forceUsingOldLightClasses = false
|
||||
val ultraLightClass = KtLightClassForFacade.createForFacadeNoCache(fqName, searchScope, project) ?: return null
|
||||
KtUltraLightSupport.forceUsingOldLightClasses = oldForceFlag
|
||||
|
||||
if (gold != null) {
|
||||
Assert.assertFalse(gold.javaClass.name.contains("Ultra"))
|
||||
}
|
||||
|
||||
val goldText = gold?.renderClass().orEmpty()
|
||||
val ultraText = ultraLightClass.renderClass()
|
||||
|
||||
if (goldText != ultraText) {
|
||||
Assert.assertEquals(
|
||||
"// Classic implementation:\n$goldText",
|
||||
"// Ultra-light implementation:\n$ultraText"
|
||||
)
|
||||
}
|
||||
return ultraLightClass
|
||||
}
|
||||
|
||||
fun checkClassEquivalence(ktClass: KtClassOrObject): KtUltraLightClass? {
|
||||
val gold = KtLightClassForSourceDeclaration.createNoCache(ktClass, forceUsingOldLightClasses = true)
|
||||
val ultraLightClass = LightClassGenerationSupport.getInstance(ktClass.project).createUltraLightClass(ktClass) ?: return null
|
||||
|
||||
Reference in New Issue
Block a user