[kotlinp] Refactor to separate common part from JVM-specific part
This refactoring includes the following: 1. Separate backend-neutral part of the metadata printer `Kotlinp` from the part that accesses JVM-specifics: `JvmKotlinp`. 2. Introduce `org.jetbrains.kotlin.kotlinp.Printer`: The component that renders both individual `Km*` nodes and the whole metadata tree, and does so with the proper indentation. ^KT-62340
This commit is contained in:
committed by
Space Team
parent
d769328311
commit
eec76865a7
@@ -22,8 +22,8 @@ import org.jetbrains.kotlin.kapt3.base.util.KaptLogger
|
||||
import org.jetbrains.kotlin.kapt3.base.util.WriterBackedKaptLogger
|
||||
import org.jetbrains.kotlin.kapt3.test.KaptMessageCollectorProvider
|
||||
import org.jetbrains.kotlin.kapt3.test.kaptOptionsProvider
|
||||
import org.jetbrains.kotlin.kotlinp.Kotlinp
|
||||
import org.jetbrains.kotlin.kotlinp.KotlinpSettings
|
||||
import org.jetbrains.kotlin.kotlinp.Settings
|
||||
import org.jetbrains.kotlin.kotlinp.JvmKotlinp
|
||||
import org.jetbrains.kotlin.test.model.*
|
||||
import org.jetbrains.kotlin.test.services.*
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
@@ -125,7 +125,7 @@ internal data class Kapt4ContextBinaryArtifact(
|
||||
}
|
||||
|
||||
private fun Printer.renderMetadata(metadata: Metadata) {
|
||||
val text = Kotlinp(KotlinpSettings(isVerbose = true, sortDeclarations = true)).renderClassFile(KotlinClassMetadata.readLenient(metadata))
|
||||
val text = JvmKotlinp(Settings(isVerbose = true, sortDeclarations = true)).printClassFile(KotlinClassMetadata.readLenient(metadata))
|
||||
// "/*" and "*/" delimiters are used in kotlinp, for example to render type parameter names. Replace them with something else
|
||||
// to avoid them being interpreted as Java comments.
|
||||
val sanitized = text.split('\n')
|
||||
|
||||
Reference in New Issue
Block a user