fun testClassFileContent()

in integration-testing/src/debugAgentTest/kotlin/PrecompiledDebugProbesTest.kt [14:34]


    fun testClassFileContent() {
        val clz = Class.forName("kotlin.coroutines.jvm.internal.DebugProbesKt")
        val classFileResourcePath = clz.name.replace(".", "/") + ".class"
        val array = clz.classLoader.getResourceAsStream(classFileResourcePath).use { it.readBytes() }
        assertJava8Compliance(array)
        // we expect the integration testing project to be in a subdirectory of the main kotlinx.coroutines project
        val base = File("").absoluteFile.parentFile
        val probes = File(base, "kotlinx-coroutines-core/jvm/resources/DebugProbesKt.bin")
        val binContent = probes.readBytes()
        if (overwrite) {
            FileOutputStream(probes).use { it.write(array) }
            println("Content was successfully overwritten!")
        } else {
            assertTrue(
                array.contentEquals(binContent),
                "Compiled DebugProbesKt.class does not match the file shipped as a resource in kotlinx-coroutines-core. " +
                        "Typically it happens because of the Kotlin version update (-> binary metadata). " +
                        "In that case, run the same test with -Poverwrite.probes=true."
            )
        }
    }