Created
March 31, 2020 15:43
-
-
Save ShikaSD/83674b584ca15bff1e21ac138cc7d298 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val SERIALIZABLE_OBJECT = """ | |
import java.io.Serializable | |
object Serial : Serializable | |
""".source() | |
@Test | |
fun `adds readResolve to obj extending Serializable`() { | |
compiler.sources = listOf(SERIALIZABLE_OBJECT) | |
val result = compiler.compile() | |
val klass = result.classLoader.loadClass("Serial") | |
assertTrue(klass.methods.any { it.addedReadResolve()}) | |
} | |
private fun Method.addedReadResolve() = | |
name == "readResolve" | |
&& parameterCount == 0 | |
&& returnType == Object::class.java | |
&& isSynthetic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment