Add ReplaceWithSupertypeAnonymousTypeTransformer to light analysis tests

To make these tests behave closer to kapt, since kapt is the primary use
case for the light analysis mode.

AbstractLightAnalysisModeTest compares the text dump of bytecode
obtained with full analysis and light analysis, removing things like
anonymous/synthetic entities. In the light analysis mode anonymous
objects in supertypes are always approximated, and in the full analysis
mode they are always present as is in signatures. So we're transforming
the text dump in the same way, by approximating anonymous objects in
signatures (more precisely, in return types of methods and fields) to
the supertype.
This commit is contained in:
Alexander Udalov
2023-06-09 00:57:15 +02:00
parent c5f44486a9
commit 4ac6f01d31
6 changed files with 77 additions and 14 deletions
@@ -1,9 +1,14 @@
/*
* Copyright 2010-2023 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.jvm.abi
import org.jetbrains.kotlin.codegen.BytecodeListingTextCollectingVisitor
import org.jetbrains.kotlin.incremental.isClassFile
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
import org.jetbrains.org.objectweb.asm.*
import org.jetbrains.org.objectweb.asm.ClassReader
import java.io.File
abstract class AbstractJvmAbiContentTest : BaseJvmAbiTest() {
@@ -19,8 +24,8 @@ abstract class AbstractJvmAbiContentTest : BaseJvmAbiTest() {
val reader = ClassReader(bytes)
val visitor = BytecodeListingTextCollectingVisitor(
filter = BytecodeListingTextCollectingVisitor.Filter.EMPTY,
allClasses = emptyMap(),
withSignatures = false,
api = Opcodes.API_VERSION,
sortDeclarations = false, // Declaration order matters for the ABI
)
reader.accept(visitor, 0)