CORDA-3377: Upgrade to DJVM 1.0-RC05 (#5862)

This commit is contained in:
Chris Rankin 2020-01-17 09:46:15 +00:00 committed by Matthew Nesbit
parent 01666ed068
commit 49b4f66515
85 changed files with 192 additions and 193 deletions

View File

@ -30,7 +30,7 @@ snakeYamlVersion=1.19
caffeineVersion=2.7.0
metricsVersion=4.1.0
metricsNewRelicVersion=1.1.1
djvmVersion=1.0-RC04
djvmVersion=1.0-RC05
deterministicRtVersion=1.0-RC02
openSourceBranch=https://github.com/corda/corda/blob/release/os/4.4
openSourceSamplesBranch=https://github.com/corda/samples/blob/release-V4

View File

@ -7,8 +7,8 @@ import net.corda.node.djvm.AttachmentBuilder
import java.util.function.Function
class AttachmentFactory(
private val classLoader: SandboxClassLoader,
private val taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
classLoader: SandboxClassLoader,
private val taskFactory: Function<Class<out Function<*,*>>, out Function<in Any?, out Any?>>,
private val sandboxBasicInput: Function<in Any?, out Any?>,
private val serializer: Serializer
) {
@ -17,7 +17,7 @@ class AttachmentFactory(
)
fun toSandbox(attachments: List<Attachment>): Any? {
val builder = classLoader.createTaskFor(taskFactory, AttachmentBuilder::class.java)
val builder = taskFactory.apply(AttachmentBuilder::class.java)
for (attachment in attachments) {
builder.apply(arrayOf(
serializer.deserialize(attachment.signerKeys.serialize()),

View File

@ -1,15 +1,13 @@
package net.corda.node.internal.djvm
import net.corda.djvm.rewiring.SandboxClassLoader
import net.corda.node.djvm.CommandBuilder
import java.util.function.Function
class CommandFactory(
private val classLoader: SandboxClassLoader,
private val taskFactory: Function<in Any, out Function<in Any?, out Any?>>
private val taskFactory: Function<Class<out Function<*,*>>, out Function<in Any?, out Any?>>
) {
fun toSandbox(signers: Any?, commands: Any?, partialMerkleLeafIndices: IntArray?): Any? {
val builder = classLoader.createTaskFor(taskFactory, CommandBuilder::class.java)
val builder = taskFactory.apply(CommandBuilder::class.java)
return builder.apply(arrayOf(
signers,
commands,

View File

@ -11,7 +11,7 @@ import java.util.function.Function
class ComponentFactory(
private val classLoader: SandboxClassLoader,
private val taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
private val taskFactory: Function<Class<out Function<*,*>>, out Function<in Any?, out Any?>>,
private val sandboxBasicInput: Function<in Any?, out Any?>,
private val serializer: Serializer,
private val componentGroups: List<ComponentGroup>
@ -22,7 +22,7 @@ class ComponentFactory(
): Any? {
val components = (componentGroups.firstOrNull(groupType::isSameType) ?: return null).components
val componentBytes = Array(components.size) { idx -> components[idx].bytes }
return classLoader.createTaskFor(taskFactory, ComponentBuilder::class.java).apply(arrayOf(
return taskFactory.apply(ComponentBuilder::class.java).apply(arrayOf(
classLoader.createForImport(serializer.deserializerFor(clazz)),
sandboxBasicInput.apply(groupType),
componentBytes

View File

@ -63,7 +63,7 @@ class DeterministicVerifier(
externalCaching = false
}
val taskFactory = classLoader.createRawTaskFactory()
val taskFactory = classLoader.createRawTaskFactory().compose(classLoader.createSandboxFunction())
val sandboxBasicInput = classLoader.createBasicInput()
/**
@ -92,11 +92,11 @@ class DeterministicVerifier(
val privacySaltData = ltx.privacySalt.serialize()
val networkingParametersData = ltx.networkParameters?.serialize()
val createSandboxTx = classLoader.createTaskFor(taskFactory, LtxFactory::class.java)
val createSandboxTx = taskFactory.apply(LtxFactory::class.java)
createSandboxTx.apply(arrayOf(
serializer.deserialize(serializedInputs),
componentFactory.toSandbox(OUTPUTS_GROUP, TransactionState::class.java),
CommandFactory(classLoader, taskFactory).toSandbox(
CommandFactory(taskFactory).toSandbox(
componentFactory.toSandbox(SIGNERS_GROUP, List::class.java),
componentFactory.toSandbox(COMMANDS_GROUP, CommandData::class.java),
componentFactory.calculateLeafIndicesFor(COMMANDS_GROUP)
@ -111,7 +111,7 @@ class DeterministicVerifier(
))
}
val verifier = classLoader.createTaskFor(taskFactory, ContractVerifier::class.java)
val verifier = taskFactory.apply(ContractVerifier::class.java)
// Now execute the contract verifier task within the sandbox...
verifier.apply(sandboxTx)

View File

@ -63,13 +63,14 @@ import java.util.function.Function
class AMQPSerializationScheme(
private val classLoader: SandboxClassLoader,
private val sandboxBasicInput: Function<in Any?, out Any?>,
private val taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
private val rawTaskFactory: Function<in Any, out Function<in Any?, out Any?>>,
private val customSerializerClassNames: Set<String>,
private val serializationWhitelistNames: Set<String>,
private val serializerFactoryFactory: SerializerFactoryFactory
) : SerializationScheme {
private fun getSerializerFactory(context: SerializationContext): SerializerFactory {
val taskFactory = rawTaskFactory.compose(classLoader.createSandboxFunction())
return serializerFactoryFactory.make(context).apply {
register(SandboxBitSetSerializer(classLoader, taskFactory, this))
register(SandboxCertPathSerializer(classLoader, taskFactory, this))
@ -105,9 +106,9 @@ class AMQPSerializationScheme(
register(SandboxMapSerializer(classLoader, taskFactory, this))
register(SandboxEnumSerializer(classLoader, taskFactory, this))
register(SandboxPublicKeySerializer(classLoader, taskFactory))
register(SandboxToStringSerializer(BigDecimal::class.java, classLoader, taskFactory, sandboxBasicInput))
register(SandboxToStringSerializer(BigInteger::class.java, classLoader, taskFactory, sandboxBasicInput))
register(SandboxToStringSerializer(StringBuffer::class.java, classLoader, taskFactory, sandboxBasicInput))
register(SandboxToStringSerializer(BigDecimal::class.java, classLoader, rawTaskFactory, sandboxBasicInput))
register(SandboxToStringSerializer(BigInteger::class.java, classLoader, rawTaskFactory, sandboxBasicInput))
register(SandboxToStringSerializer(StringBuffer::class.java, classLoader, rawTaskFactory, sandboxBasicInput))
register(SandboxCurrencySerializer(classLoader, taskFactory, sandboxBasicInput))
register(SandboxX509CertificateSerializer(classLoader, taskFactory))
register(SandboxX509CRLSerializer(classLoader, taskFactory))
@ -121,13 +122,16 @@ class AMQPSerializationScheme(
register(SandboxSymbolSerializer(classLoader, taskFactory, sandboxBasicInput))
for (customSerializerName in customSerializerClassNames) {
register(SandboxCorDappCustomSerializer(customSerializerName, classLoader, taskFactory, this))
register(SandboxCorDappCustomSerializer(customSerializerName, classLoader, rawTaskFactory, this))
}
registerWhitelists(this)
registerWhitelists(taskFactory, this)
}
}
private fun registerWhitelists(factory: SerializerFactory) {
private fun registerWhitelists(
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) {
if (serializationWhitelistNames.isEmpty()) {
return
}
@ -136,7 +140,7 @@ class AMQPSerializationScheme(
classLoader.toSandboxClass(whitelistClass).kotlin.objectOrNewInstance()
}.toArrayOf(classLoader.toSandboxClass(SerializationWhitelist::class.java))
@Suppress("unchecked_cast")
val mergeTask = classLoader.createTaskFor(taskFactory, MergeWhitelists::class.java) as Function<in Array<*>, out Array<Class<*>>>
val mergeTask = taskFactory.apply(MergeWhitelists::class.java) as Function<in Array<*>, out Array<Class<*>>>
factory.addToWhitelist(mergeTask.apply(serializationWhitelists).toSet())
}

View File

@ -42,7 +42,7 @@ fun createSandboxSerializationEnv(
encoding = null
)
val taskFactory = classLoader.createRawTaskFactory()
val rawTaskFactory = classLoader.createRawTaskFactory()
val sandboxBasicInput = classLoader.createBasicInput()
val primitiveSerializerFactory: Function<Class<*>, AMQPSerializer<Any>> = Function { clazz ->
@ -53,7 +53,7 @@ fun createSandboxSerializationEnv(
registerScheme(AMQPSerializationScheme(
classLoader = classLoader,
sandboxBasicInput = sandboxBasicInput,
taskFactory = taskFactory,
rawTaskFactory = rawTaskFactory,
customSerializerClassNames = customSerializerClassNames,
serializationWhitelistNames = serializationWhitelistNames,
serializerFactoryFactory = SandboxSerializerFactoryFactory(primitiveSerializerFactory)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxBitSetSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(BitSet::class.java),
proxyClass = classLoader.toSandboxAnyClass(BitSetProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, BitSetDeserializer::class.java)
private val task = taskFactory.apply(BitSetDeserializer::class.java)
override val deserializationAliases = aliasFor(BitSet::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxCertPathSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(CertPath::class.java),
proxyClass = classLoader.toSandboxAnyClass(CertPathProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, CertPathDeserializer::class.java)
private val task = taskFactory.apply(CertPathDeserializer::class.java)
override val deserializationAliases = aliasFor(CertPath::class.java)

View File

@ -12,14 +12,14 @@ import java.util.function.Function
@Suppress("unchecked_cast")
class SandboxClassSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = Class::class.java as Class<Any>,
proxyClass = classLoader.toSandboxAnyClass(ClassProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, ClassDeserializer::class.java)
private val task = taskFactory.apply(ClassDeserializer::class.java)
private val nameOf: Function<Any, String>
init {

View File

@ -26,12 +26,12 @@ import java.util.function.Function
class SandboxCollectionSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
private val localFactory: LocalSerializerFactory
) : CustomSerializer.Implements<Any>(clazz = classLoader.toSandboxAnyClass(Collection::class.java)) {
@Suppress("unchecked_cast")
private val creator: Function<Array<Any>, out Any?>
= classLoader.createTaskFor(taskFactory, CreateCollection::class.java) as Function<Array<Any>, out Any?>
= taskFactory.apply(CreateCollection::class.java) as Function<Array<Any>, out Any?>
private val unsupportedTypes: Set<Class<Any>> = listOf(
EnumSet::class.java

View File

@ -30,7 +30,7 @@ import java.util.function.Function
class SandboxCorDappCustomSerializer(
private val serializerName: String,
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
rawTaskFactory: Function<in Any, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer<Any>() {
private val unproxy: Function<in Any?, out Any?>
@ -53,7 +53,7 @@ class SandboxCorDappCustomSerializer(
val unproxyTask = classLoader.toSandboxClass(CorDappCustomDeserializer::class.java)
.getConstructor(serializationCustomSerializer)
.newInstance(customSerializerClass.kotlin.objectOrNewInstance())
unproxy = taskFactory.apply(unproxyTask)
unproxy = rawTaskFactory.apply(unproxyTask)
}
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -16,13 +16,13 @@ import java.util.function.Function
class SandboxCurrencySerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
basicInput: Function<in Any?, out Any?>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(Currency::class.java)) {
private val creator: Function<Any?, Any?>
init {
val createTask = classLoader.createTaskFor(taskFactory, CreateCurrency::class.java)
val createTask = taskFactory.apply(CreateCurrency::class.java)
creator = basicInput.andThen(createTask)
}

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxDecimal128Serializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(Decimal128::class.java)) {
@Suppress("unchecked_cast")
private val transformer: Function<LongArray, out Any?>
= classLoader.createTaskFor(taskFactory, Decimal128Deserializer::class.java) as Function<LongArray, out Any?>
= taskFactory.apply(Decimal128Deserializer::class.java) as Function<LongArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxDecimal32Serializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(Decimal32::class.java)) {
@Suppress("unchecked_cast")
private val transformer: Function<IntArray, out Any?>
= classLoader.createTaskFor(taskFactory, Decimal32Deserializer::class.java) as Function<IntArray, out Any?>
= taskFactory.apply(Decimal32Deserializer::class.java) as Function<IntArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxDecimal64Serializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(Decimal64::class.java)) {
@Suppress("unchecked_cast")
private val transformer: Function<LongArray, out Any?>
= classLoader.createTaskFor(taskFactory, Decimal64Deserializer::class.java) as Function<LongArray, out Any?>
= taskFactory.apply(Decimal64Deserializer::class.java) as Function<LongArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxDurationSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(Duration::class.java),
proxyClass = classLoader.toSandboxAnyClass(DurationProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, DurationDeserializer::class.java)
private val task = taskFactory.apply(DurationDeserializer::class.java)
override val deserializationAliases = aliasFor(Duration::class.java)

View File

@ -22,12 +22,12 @@ import java.util.function.Function
class SandboxEnumSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
private val localFactory: LocalSerializerFactory
) : CustomSerializer.Implements<Any>(clazz = classLoader.toSandboxAnyClass(Enum::class.java)) {
@Suppress("unchecked_cast")
private val describer: Function<Class<*>, Array<Any>>
= classLoader.createTaskFor(taskFactory, DescribeEnum::class.java) as Function<Class<*>, Array<Any>>
= taskFactory.apply(DescribeEnum::class.java) as Function<Class<*>, Array<Any>>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -12,14 +12,14 @@ import java.util.function.Function
class SandboxEnumSetSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(EnumSet::class.java),
proxyClass = classLoader.toSandboxAnyClass(EnumSetProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, EnumSetDeserializer::class.java)
private val task = taskFactory.apply(EnumSetDeserializer::class.java)
override val additionalSerializers: Set<CustomSerializer<out Any>> = singleton(
SandboxClassSerializer(classLoader, taskFactory, factory)

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxInputStreamSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Implements<Any>(classLoader.toSandboxAnyClass(InputStream::class.java)) {
@Suppress("unchecked_cast")
private val decoder: Function<ByteArray, out Any?>
= classLoader.createTaskFor(taskFactory, InputStreamDeserializer::class.java) as Function<ByteArray, out Any?>
= taskFactory.apply(InputStreamDeserializer::class.java) as Function<ByteArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxInstantSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(Instant::class.java),
proxyClass = classLoader.toSandboxAnyClass(InstantProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, InstantDeserializer::class.java)
private val task = taskFactory.apply(InstantDeserializer::class.java)
override val deserializationAliases = aliasFor(Instant::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxLocalDateSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(LocalDate::class.java),
proxyClass = classLoader.toSandboxAnyClass(LocalDateProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, LocalDateDeserializer::class.java)
private val task = taskFactory.apply(LocalDateDeserializer::class.java)
override val deserializationAliases = aliasFor(LocalDate::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxLocalDateTimeSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(LocalDateTime::class.java),
proxyClass = classLoader.toSandboxAnyClass(LocalDateTimeProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, LocalDateTimeDeserializer::class.java)
private val task = taskFactory.apply(LocalDateTimeDeserializer::class.java)
override val deserializationAliases = aliasFor(LocalDateTime::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxLocalTimeSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(LocalTime::class.java),
proxyClass = classLoader.toSandboxAnyClass(LocalTimeProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, LocalTimeDeserializer::class.java)
private val task = taskFactory.apply(LocalTimeDeserializer::class.java)
override val deserializationAliases = aliasFor(LocalTime::class.java)

View File

@ -26,12 +26,12 @@ import java.util.function.Function
class SandboxMapSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
private val localFactory: LocalSerializerFactory
) : CustomSerializer.Implements<Any>(clazz = classLoader.toSandboxAnyClass(Map::class.java)) {
@Suppress("unchecked_cast")
private val creator: Function<Array<Any>, out Any?>
= classLoader.createTaskFor(taskFactory, CreateMap::class.java) as Function<Array<Any>, out Any?>
= taskFactory.apply(CreateMap::class.java) as Function<Array<Any>, out Any?>
// The order matters here - the first match should be the most specific one.
// Kotlin preserves the ordering for us by associating into a LinkedHashMap.

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxMonthDaySerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(MonthDay::class.java),
proxyClass = classLoader.toSandboxAnyClass(MonthDayProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, MonthDayDeserializer::class.java)
private val task = taskFactory.apply(MonthDayDeserializer::class.java)
override val deserializationAliases = aliasFor(MonthDay::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxOffsetDateTimeSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(OffsetDateTime::class.java),
proxyClass = classLoader.toSandboxAnyClass(OffsetDateTimeProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, OffsetDateTimeDeserializer::class.java)
private val task = taskFactory.apply(OffsetDateTimeDeserializer::class.java)
override val deserializationAliases = aliasFor(OffsetDateTime::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxOffsetTimeSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(OffsetTime::class.java),
proxyClass = classLoader.toSandboxAnyClass(OffsetTimeProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, OffsetTimeDeserializer::class.java)
private val task = taskFactory.apply(OffsetTimeDeserializer::class.java)
override val deserializationAliases = aliasFor(OffsetTime::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxOpaqueBytesSubSequenceSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(OpaqueBytesSubSequence::class.java),
proxyClass = classLoader.toSandboxAnyClass(OpaqueBytes::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, OpaqueBytesSubSequenceDeserializer::class.java)
private val task = taskFactory.apply(OpaqueBytesSubSequenceDeserializer::class.java)
override val deserializationAliases = aliasFor(OpaqueBytesSubSequence::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxOptionalSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(Optional::class.java),
proxyClass = classLoader.toSandboxAnyClass(OptionalProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, OptionalDeserializer::class.java)
private val task = taskFactory.apply(OptionalDeserializer::class.java)
override val deserializationAliases = aliasFor(Optional::class.java)

View File

@ -11,14 +11,14 @@ import java.util.function.Function
class SandboxPeriodSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(Period::class.java),
proxyClass = classLoader.toSandboxAnyClass(PeriodProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, PeriodDeserializer::class.java)
private val task = taskFactory.apply(PeriodDeserializer::class.java)
override val deserializationAliases = aliasFor(Period::class.java)

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxPublicKeySerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Implements<Any>(classLoader.toSandboxAnyClass(PublicKey::class.java)) {
@Suppress("unchecked_cast")
private val decoder: Function<ByteArray, out Any?>
= classLoader.createTaskFor(taskFactory, PublicKeyDecoder::class.java) as Function<ByteArray, out Any?>
= taskFactory.apply(PublicKeyDecoder::class.java) as Function<ByteArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -16,13 +16,13 @@ import java.util.function.Function
class SandboxSymbolSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
basicInput: Function<in Any?, out Any?>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(Symbol::class.java)) {
private val transformer: Function<String, out Any?>
init {
val transformTask = classLoader.createTaskFor(taskFactory, SymbolDeserializer::class.java)
val transformTask = taskFactory.apply(SymbolDeserializer::class.java)
@Suppress("unchecked_cast")
transformer = basicInput.andThen(transformTask) as Function<String, Any?>
}

View File

@ -17,7 +17,7 @@ import java.util.function.Function
class SandboxToStringSerializer(
unsafeClass: Class<*>,
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
rawTaskFactory: Function<in Any, out Function<in Any?, out Any?>>,
basicInput: Function<in Any?, out Any?>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(unsafeClass)) {
private val creator: Function<Any?, Any?>
@ -27,7 +27,7 @@ class SandboxToStringSerializer(
val createTask = classLoader.toSandboxClass(CreateFromString::class.java)
.getConstructor(Constructor::class.java)
.newInstance(clazz.getConstructor(stringClass))
creator = basicInput.andThen(taskFactory.apply(createTask))
creator = basicInput.andThen(rawTaskFactory.apply(createTask))
}
override val deserializationAliases = aliasFor(unsafeClass)

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxUnsignedByteSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(UnsignedByte::class.java)) {
@Suppress("unchecked_cast")
private val transformer: Function<ByteArray, out Any?>
= classLoader.createTaskFor(taskFactory, UnsignedByteDeserializer::class.java) as Function<ByteArray, out Any?>
= taskFactory.apply(UnsignedByteDeserializer::class.java) as Function<ByteArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxUnsignedIntegerSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(UnsignedInteger::class.java)) {
@Suppress("unchecked_cast")
private val transformer: Function<IntArray, out Any?>
= classLoader.createTaskFor(taskFactory, UnsignedIntegerDeserializer::class.java) as Function<IntArray, out Any?>
= taskFactory.apply(UnsignedIntegerDeserializer::class.java) as Function<IntArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxUnsignedLongSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(UnsignedLong::class.java)) {
@Suppress("unchecked_cast")
private val transformer: Function<LongArray, out Any?>
= classLoader.createTaskFor(taskFactory, UnsignedLongDeserializer::class.java) as Function<LongArray, out Any?>
= taskFactory.apply(UnsignedLongDeserializer::class.java) as Function<LongArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -16,11 +16,11 @@ import java.util.function.Function
class SandboxUnsignedShortSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Is<Any>(classLoader.toSandboxAnyClass(UnsignedShort::class.java)) {
@Suppress("unchecked_cast")
private val transformer: Function<ShortArray, out Any?>
= classLoader.createTaskFor(taskFactory, UnsignedShortDeserializer::class.java) as Function<ShortArray, out Any?>
= taskFactory.apply(UnsignedShortDeserializer::class.java) as Function<ShortArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -12,16 +12,15 @@ import net.corda.serialization.internal.amqp.SerializationSchemas
import org.apache.qpid.proton.codec.Data
import java.lang.reflect.Type
import java.security.cert.X509CRL
import java.util.Collections.singleton
import java.util.function.Function
class SandboxX509CRLSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Implements<Any>(classLoader.toSandboxAnyClass(X509CRL::class.java)) {
@Suppress("unchecked_cast")
private val generator: Function<ByteArray, out Any?>
= classLoader.createTaskFor(taskFactory, X509CRLDeserializer::class.java) as Function<ByteArray, out Any?>
= taskFactory.apply(X509CRLDeserializer::class.java) as Function<ByteArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -12,16 +12,15 @@ import net.corda.serialization.internal.amqp.SerializationSchemas
import org.apache.qpid.proton.codec.Data
import java.lang.reflect.Type
import java.security.cert.X509Certificate
import java.util.Collections.singleton
import java.util.function.Function
class SandboxX509CertificateSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>
) : CustomSerializer.Implements<Any>(classLoader.toSandboxAnyClass(X509Certificate::class.java)) {
@Suppress("unchecked_cast")
private val generator: Function<ByteArray, out Any?>
= classLoader.createTaskFor(taskFactory, X509CertificateDeserializer::class.java) as Function<ByteArray, out Any?>
= taskFactory.apply(X509CertificateDeserializer::class.java) as Function<ByteArray, out Any?>
override val schemaForDocumentation: Schema = Schema(emptyList())

View File

@ -7,19 +7,18 @@ import net.corda.serialization.internal.amqp.CustomSerializer
import net.corda.serialization.internal.amqp.SerializerFactory
import net.corda.serialization.internal.amqp.custom.YearMonthSerializer.YearMonthProxy
import java.time.YearMonth
import java.util.Collections.singleton
import java.util.function.Function
class SandboxYearMonthSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(YearMonth::class.java),
proxyClass = classLoader.toSandboxAnyClass(YearMonthProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, YearMonthDeserializer::class.java)
private val task = taskFactory.apply(YearMonthDeserializer::class.java)
override val deserializationAliases = aliasFor(YearMonth::class.java)

View File

@ -7,19 +7,18 @@ import net.corda.serialization.internal.amqp.CustomSerializer
import net.corda.serialization.internal.amqp.SerializerFactory
import net.corda.serialization.internal.amqp.custom.YearSerializer.YearProxy
import java.time.Year
import java.util.Collections.singleton
import java.util.function.Function
class SandboxYearSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(Year::class.java),
proxyClass = classLoader.toSandboxAnyClass(YearProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, YearDeserializer::class.java)
private val task = taskFactory.apply(YearDeserializer::class.java)
override val deserializationAliases = aliasFor(Year::class.java)

View File

@ -7,19 +7,18 @@ import net.corda.serialization.internal.amqp.CustomSerializer
import net.corda.serialization.internal.amqp.SerializerFactory
import net.corda.serialization.internal.amqp.custom.ZoneIdSerializer.ZoneIdProxy
import java.time.ZoneId
import java.util.Collections.singleton
import java.util.function.Function
class SandboxZoneIdSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(ZoneId::class.java),
proxyClass = classLoader.toSandboxAnyClass(ZoneIdProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, ZoneIdDeserializer::class.java)
private val task = taskFactory.apply(ZoneIdDeserializer::class.java)
override val revealSubclassesInSchema: Boolean = true

View File

@ -10,19 +10,18 @@ import java.time.LocalDateTime
import java.time.ZoneId
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.util.Collections.singleton
import java.util.function.Function
class SandboxZonedDateTimeSerializer(
classLoader: SandboxClassLoader,
taskFactory: Function<in Any, out Function<in Any?, out Any?>>,
taskFactory: Function<Class<out Function<*, *>>, out Function<in Any?, out Any?>>,
factory: SerializerFactory
) : CustomSerializer.Proxy<Any, Any>(
clazz = classLoader.toSandboxAnyClass(ZonedDateTime::class.java),
proxyClass = classLoader.toSandboxAnyClass(ZonedDateTimeProxy::class.java),
factory = factory
) {
private val task = classLoader.createTaskFor(taskFactory, ZonedDateTimeDeserializer::class.java)
private val task = taskFactory.apply(ZonedDateTimeDeserializer::class.java)
private val creator: Function<in Any?, out Any?>
init {

View File

@ -28,7 +28,7 @@ class DeserializeBigDecimalTest : TestBase(KOTLIN) {
val sandboxBigInteger = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showBigDecimal = classLoader.createTaskFor(taskFactory, ShowBigDecimal::class.java)
val showBigDecimal = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowBigDecimal::class.java)
val result = showBigDecimal.apply(sandboxBigInteger) ?: fail("Result cannot be null")
assertEquals(ShowBigDecimal().apply(bigDecimal), result.toString())

View File

@ -28,7 +28,7 @@ class DeserializeBigIntegerTest : TestBase(KOTLIN) {
val sandboxBigInteger = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showBigInteger = classLoader.createTaskFor(taskFactory, ShowBigInteger::class.java)
val showBigInteger = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowBigInteger::class.java)
val result = showBigInteger.apply(sandboxBigInteger) ?: fail("Result cannot be null")
assertEquals(ShowBigInteger().apply(bigInteger), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeBitSetTest : TestBase(KOTLIN) {
val sandboxBitSet = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showBitSet = classLoader.createTaskFor(taskFactory, ShowBitSet::class.java)
val showBitSet = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowBitSet::class.java)
val result = showBitSet.apply(sandboxBitSet) ?: fail("Result cannot be null")
assertEquals(bitSet.toString(), result.toString())

View File

@ -60,7 +60,7 @@ class DeserializeCertificatesTest : TestBase(KOTLIN) {
val sandboxCertPath = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCertPath = classLoader.createTaskFor(taskFactory, ShowCertPath::class.java)
val showCertPath = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCertPath::class.java)
val result = showCertPath.apply(sandboxCertPath) ?: fail("Result cannot be null")
assertEquals(ShowCertPath().apply(certPath).toUNIX().toJava8Format(), result.toString())
@ -84,7 +84,7 @@ class DeserializeCertificatesTest : TestBase(KOTLIN) {
val sandboxCertificate = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCertificate = classLoader.createTaskFor(taskFactory, ShowCertificate::class.java)
val showCertificate = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCertificate::class.java)
val result = showCertificate.apply(sandboxCertificate) ?: fail("Result cannot be null")
assertEquals(ShowCertificate().apply(certificate).toUNIX().toJava8Format(), result.toString())
@ -118,7 +118,7 @@ class DeserializeCertificatesTest : TestBase(KOTLIN) {
val sandboxCRL = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCRL = classLoader.createTaskFor(taskFactory, ShowCRL::class.java)
val showCRL = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCRL::class.java)
val result = showCRL.apply(sandboxCRL) ?: fail("Result cannot be null")
assertEquals(ShowCRL().apply(crl).toUNIX(), result.toString())

View File

@ -27,7 +27,7 @@ class DeserializeClassTest : TestBase(KOTLIN) {
val sandboxInstant = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showClass = classLoader.createTaskFor(taskFactory, ShowClass::class.java)
val showClass = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowClass::class.java)
val result = showClass.apply(sandboxInstant) ?: fail("Result cannot be null")
assertEquals("sandbox.${myClass.name}", result.toString())

View File

@ -28,7 +28,7 @@ class DeserializeCollectionsTest : TestBase(KOTLIN) {
val sandboxList = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringList = classLoader.createTaskFor(taskFactory, ShowStringList::class.java)
val showStringList = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowStringList::class.java)
val result = showStringList.apply(sandboxList) ?: fail("Result cannot be null")
assertEquals(stringList.lines.joinToString(), result.toString())
@ -53,7 +53,7 @@ class DeserializeCollectionsTest : TestBase(KOTLIN) {
val sandboxSet = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showIntegerSet = classLoader.createTaskFor(taskFactory, ShowIntegerSet::class.java)
val showIntegerSet = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowIntegerSet::class.java)
val result = showIntegerSet.apply(sandboxSet) ?: fail("Result cannot be null")
assertEquals(integerSet.numbers.joinToString(), result.toString())
@ -78,7 +78,7 @@ class DeserializeCollectionsTest : TestBase(KOTLIN) {
val sandboxSet = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showIntegerSortedSet = classLoader.createTaskFor(taskFactory, ShowIntegerSortedSet::class.java)
val showIntegerSortedSet = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowIntegerSortedSet::class.java)
val result = showIntegerSortedSet.apply(sandboxSet) ?: fail("Result cannot be null")
assertEquals(integerSortedSet.numbers.joinToString(), result.toString())
@ -103,7 +103,7 @@ class DeserializeCollectionsTest : TestBase(KOTLIN) {
val sandboxSet = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showLongNavigableSet = classLoader.createTaskFor(taskFactory, ShowLongNavigableSet::class.java)
val showLongNavigableSet = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowLongNavigableSet::class.java)
val result = showLongNavigableSet.apply(sandboxSet) ?: fail("Result cannot be null")
assertEquals(longNavigableSet.numbers.joinToString(), result.toString())
@ -128,7 +128,7 @@ class DeserializeCollectionsTest : TestBase(KOTLIN) {
val sandboxCollection = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showShortCollection = classLoader.createTaskFor(taskFactory, ShowShortCollection::class.java)
val showShortCollection = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowShortCollection::class.java)
val result = showShortCollection.apply(sandboxCollection) ?: fail("Result cannot be null")
assertEquals(shortCollection.numbers.joinToString(), result.toString())
@ -153,7 +153,7 @@ class DeserializeCollectionsTest : TestBase(KOTLIN) {
val sandboxSet = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showNonEmptyStringSet = classLoader.createTaskFor(taskFactory, ShowNonEmptyStringSet::class.java)
val showNonEmptyStringSet = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowNonEmptyStringSet::class.java)
val result = showNonEmptyStringSet.apply(sandboxSet) ?: fail("Result cannot be null")
assertEquals(nonEmptyStrings.lines.joinToString(), result.toString())
@ -178,7 +178,7 @@ class DeserializeCollectionsTest : TestBase(KOTLIN) {
val sandboxSet = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showHasEnumSet = classLoader.createTaskFor(taskFactory, ShowHasEnumSet::class.java)
val showHasEnumSet = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowHasEnumSet::class.java)
val result = showHasEnumSet.apply(sandboxSet) ?: fail("Result cannot be null")
assertEquals(enumSet.values.toString(), result.toString())

View File

@ -51,7 +51,7 @@ class DeserializeComposedCustomDataTest: TestBase(KOTLIN) {
val sandboxComplex = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showComplex = classLoader.createTaskFor(taskFactory, ShowComposedData::class.java)
val showComplex = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowComposedData::class.java)
val result = showComplex.apply(sandboxComplex) ?: fail("Result cannot be null")
assertEquals(SANDBOX_STRING, result::class.java.name)
assertEquals(ShowComposedData().apply(composed), result.toString())

View File

@ -24,7 +24,7 @@ class DeserializeCurrencyTest : TestBase(KOTLIN) {
val sandboxCurrency = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCurrency = classLoader.createTaskFor(taskFactory, ShowCurrency::class.java)
val showCurrency = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCurrency::class.java)
val result = showCurrency.apply(sandboxCurrency) ?: fail("Result cannot be null")
assertEquals(ShowCurrency().apply(currency), result.toString())

View File

@ -46,7 +46,7 @@ class DeserializeCustomGenericDataTest: TestBase(KOTLIN) {
val sandboxComplex = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showComplex = classLoader.createTaskFor(taskFactory, ShowComplexData::class.java)
val showComplex = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowComplexData::class.java)
val result = showComplex.apply(sandboxComplex) ?: fail("Result cannot be null")
assertEquals(SANDBOX_STRING, result::class.java.name)
assertEquals(ShowComplexData().apply(complex), result.toString())

View File

@ -26,7 +26,7 @@ class DeserializeEnumSetTest : TestBase(KOTLIN) {
val sandboxEnumSet = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showEnumSet = classLoader.createTaskFor(taskFactory, ShowEnumSet::class.java)
val showEnumSet = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowEnumSet::class.java)
val result = showEnumSet.apply(sandboxEnumSet) ?: fail("Result cannot be null")
assertEquals(ShowEnumSet().apply(enumSet), result.toString())

View File

@ -25,7 +25,7 @@ class DeserializeEnumTest : TestBase(KOTLIN) {
val sandboxExample = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showExampleData = classLoader.createTaskFor(taskFactory, ShowExampleData::class.java)
val showExampleData = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowExampleData::class.java)
val result = showExampleData.apply(sandboxExample) ?: fail("Result cannot be null")
assertEquals(ShowExampleData().apply(example), result.toString())

View File

@ -24,7 +24,7 @@ class DeserializeGenericsTest : TestBase(KOTLIN) {
val sandboxWrapper = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val getGenericData = classLoader.createTaskFor(taskFactory, GetGenericData::class.java)
val getGenericData = taskFactory.compose(classLoader.createSandboxFunction()).apply(GetGenericData::class.java)
val result = getGenericData.apply(sandboxWrapper) ?: fail("Result cannot be null")
assertEquals("Hello World!", result.toString())
@ -43,7 +43,7 @@ class DeserializeGenericsTest : TestBase(KOTLIN) {
val sandboxWrapper = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val getGenericData = classLoader.createTaskFor(taskFactory, GetGenericData::class.java)
val getGenericData = taskFactory.compose(classLoader.createSandboxFunction()).apply(GetGenericData::class.java)
val result = getGenericData.apply(sandboxWrapper) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Integer", result::class.java.name)
@ -62,7 +62,7 @@ class DeserializeGenericsTest : TestBase(KOTLIN) {
val sandboxWrapper = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val getGenericData = classLoader.createTaskFor(taskFactory, GetGenericData::class.java)
val getGenericData = taskFactory.compose(classLoader.createSandboxFunction()).apply(GetGenericData::class.java)
val result = getGenericData.apply(sandboxWrapper) ?: fail("Result cannot be null")
assertEquals("[Lsandbox.java.lang.Integer;", result::class.java.name)
@ -82,7 +82,7 @@ class DeserializeGenericsTest : TestBase(KOTLIN) {
val sandboxWrapper = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val getGenericData = classLoader.createTaskFor(taskFactory, GetGenericData::class.java)
val getGenericData = taskFactory.compose(classLoader.createSandboxFunction()).apply(GetGenericData::class.java)
val result = getGenericData.apply(sandboxWrapper) ?: fail("Result cannot be null")
assertEquals("[I", result::class.java.name)
@ -102,13 +102,14 @@ class DeserializeGenericsTest : TestBase(KOTLIN) {
val sandboxWrapper = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val getGenericData = classLoader.createTaskFor(taskFactory, GetGenericData::class.java)
val sandboxFunction = classLoader.createSandboxFunction()
val getGenericData = taskFactory.compose(sandboxFunction).apply(GetGenericData::class.java)
val dataResult = getGenericData.apply(sandboxWrapper) ?: fail("Result cannot be null")
assertEquals("[Hello World!]", dataResult.toString())
assertEquals("sandbox.java.util.Collections\$UnmodifiableRandomAccessList", dataResult::class.java.name)
val getGenericIterableData = classLoader.createTaskFor(taskFactory, GetGenericIterableData::class.java)
val getGenericIterableData = taskFactory.compose(sandboxFunction).apply(GetGenericIterableData::class.java)
val dataItemResult = getGenericIterableData.apply(sandboxWrapper) ?: fail("Result cannot be null")
assertEquals(SANDBOX_STRING, dataItemResult::class.java.name)
}
@ -146,7 +147,7 @@ class DeserializeGenericsTest : TestBase(KOTLIN) {
val sandboxWrapped = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showConcreteWrapper = classLoader.createTaskFor(taskFactory, ShowConcreteWrapper::class.java)
val showConcreteWrapper = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowConcreteWrapper::class.java)
val result = showConcreteWrapper.apply(sandboxWrapped) ?: fail("Result cannot be null")
assertEquals("Concrete: first='Hello World', second='!'", result.toString())

View File

@ -27,7 +27,7 @@ class DeserializeInputStreamTest : TestBase(KOTLIN) {
val sandboxStream = data.deserializeTypeFor<InputStream>(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showInputStream = classLoader.createTaskFor(taskFactory, ShowInputStream::class.java)
val showInputStream = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowInputStream::class.java)
val result = showInputStream.apply(sandboxStream) ?: fail("Result cannot be null")
assertEquals(String(MESSAGE.byteInputStream().readFully()), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeInstantTest : TestBase(KOTLIN) {
val sandboxInstant = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showInstant = classLoader.createTaskFor(taskFactory, ShowInstant::class.java)
val showInstant = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowInstant::class.java)
val result = showInstant.apply(sandboxInstant) ?: fail("Result cannot be null")
assertEquals(instant.toString(), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeJavaWithMultipleConstructorsTest : TestBase(KOTLIN) {
val sandboxData = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showMultiData = classLoader.createTaskFor(taskFactory, ShowMultiData::class.java)
val showMultiData = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowMultiData::class.java)
val result = showMultiData.apply(sandboxData) ?: fail("Result cannot be null")
assertThat(result.toString())

View File

@ -25,7 +25,7 @@ class DeserializeKotlinAliasTest : TestBase(KOTLIN) {
val sandboxAttachmentId = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showAlias = classLoader.createTaskFor(taskFactory, ShowAlias::class.java)
val showAlias = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowAlias::class.java)
val result = showAlias.apply(sandboxAttachmentId) ?: fail("Result cannot be null")
assertEquals(ShowAlias().apply(attachmentId), result.toString())
@ -50,7 +50,7 @@ class DeserializeKotlinAliasTest : TestBase(KOTLIN) {
val sandboxAttachment = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showAliasData = classLoader.createTaskFor(taskFactory, ShowAliasData::class.java)
val showAliasData = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowAliasData::class.java)
val result = showAliasData.apply(sandboxAttachment) ?: fail("Result cannot be null")
assertEquals(ShowAliasData().apply(attachment), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeLocalDateTest : TestBase(KOTLIN) {
val sandboxDate = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showLocalDate = classLoader.createTaskFor(taskFactory, ShowLocalDate::class.java)
val showLocalDate = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowLocalDate::class.java)
val result = showLocalDate.apply(sandboxDate) ?: fail("Result cannot be null")
assertEquals(date.toString(), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeLocalDateTimeTest : TestBase(KOTLIN) {
val sandboxDateTime = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showLocalDateTime = classLoader.createTaskFor(taskFactory, ShowLocalDateTime::class.java)
val showLocalDateTime = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowLocalDateTime::class.java)
val result = showLocalDateTime.apply( sandboxDateTime) ?: fail("Result cannot be null")
assertEquals(dateTime.toString(), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeLocalTimeTest : TestBase(KOTLIN) {
val sandboxTime = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showLocalTime = classLoader.createTaskFor(taskFactory, ShowLocalTime::class.java)
val showLocalTime = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowLocalTime::class.java)
val result = showLocalTime.apply(sandboxTime) ?: fail("Result cannot be null")
assertEquals(time.toString(), result.toString())

View File

@ -27,7 +27,7 @@ class DeserializeMapsTest : TestBase(KOTLIN) {
val sandboxMap = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringMap = classLoader.createTaskFor(taskFactory, ShowStringMap::class.java)
val showStringMap = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowStringMap::class.java)
val result = showStringMap.apply(sandboxMap) ?: fail("Result cannot be null")
assertEquals(stringMap.values.entries.joinToString(), result.toString())
@ -56,7 +56,7 @@ class DeserializeMapsTest : TestBase(KOTLIN) {
val sandboxMap = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringSortedMap = classLoader.createTaskFor(taskFactory, ShowStringSortedMap::class.java)
val showStringSortedMap = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowStringSortedMap::class.java)
val result = showStringSortedMap.apply(sandboxMap) ?: fail("Result cannot be null")
assertEquals(sortedMap.values.entries.joinToString(), result.toString())
@ -85,7 +85,7 @@ class DeserializeMapsTest : TestBase(KOTLIN) {
val sandboxMap = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringNavigableMap = classLoader.createTaskFor(taskFactory, ShowStringNavigableMap::class.java)
val showStringNavigableMap = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowStringNavigableMap::class.java)
val result = showStringNavigableMap.apply(sandboxMap) ?: fail("Result cannot be null")
assertEquals(navigableMap.values.entries.joinToString(), result.toString())
@ -114,7 +114,8 @@ class DeserializeMapsTest : TestBase(KOTLIN) {
val sandboxMap = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringLinkedHashMap = classLoader.createTaskFor(taskFactory, ShowStringLinkedHashMap::class.java)
val sandboxFunction = classLoader.createSandboxFunction()
val showStringLinkedHashMap = taskFactory.compose(sandboxFunction).apply(ShowStringLinkedHashMap::class.java)
val result = showStringLinkedHashMap.apply(sandboxMap) ?: fail("Result cannot be null")
assertEquals(linkedHashMap.values.entries.joinToString(), result.toString())
@ -143,7 +144,7 @@ class DeserializeMapsTest : TestBase(KOTLIN) {
val sandboxMap = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringTreeMap = classLoader.createTaskFor(taskFactory, ShowStringTreeMap::class.java)
val showStringTreeMap = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowStringTreeMap::class.java)
val result = showStringTreeMap.apply(sandboxMap) ?: fail("Result cannot be null")
assertEquals(treeMap.values.entries.joinToString(), result.toString())
@ -171,7 +172,7 @@ class DeserializeMapsTest : TestBase(KOTLIN) {
val sandboxMap = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showEnumMap = classLoader.createTaskFor(taskFactory, ShowEnumMap::class.java)
val showEnumMap = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowEnumMap::class.java)
val result = showEnumMap.apply(sandboxMap) ?: fail("Result cannot be null")
assertEquals(enumMap.toString(), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeMonthDayTest : TestBase(KOTLIN) {
val sandboxMonthDay = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showMonthDay = classLoader.createTaskFor(taskFactory, ShowMonthDay::class.java)
val showMonthDay = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowMonthDay::class.java)
val result = showMonthDay.apply(sandboxMonthDay) ?: fail("Result cannot be null")
assertEquals(monthDay.toString(), result.toString())

View File

@ -25,7 +25,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringArray = classLoader.createTaskFor(taskFactory, ShowStringArray::class.java)
val showStringArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowStringArray::class.java)
val result = showStringArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals(SANDBOX_STRING, result::class.java.name)
@ -51,7 +51,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCharacterArray = classLoader.createTaskFor(taskFactory, ShowCharacterArray::class.java)
val showCharacterArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCharacterArray::class.java)
val result = showCharacterArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals(SANDBOX_STRING, result::class.java.name)
@ -76,7 +76,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showLongArray = classLoader.createTaskFor(taskFactory, ShowLongArray::class.java)
val showLongArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowLongArray::class.java)
val result = showLongArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Long", result::class.java.name)
@ -101,7 +101,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showIntegerArray = classLoader.createTaskFor(taskFactory, ShowIntegerArray::class.java)
val showIntegerArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowIntegerArray::class.java)
val result = showIntegerArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Integer", result::class.java.name)
@ -126,7 +126,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showShortArray = classLoader.createTaskFor(taskFactory, ShowShortArray::class.java)
val showShortArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowShortArray::class.java)
val result = showShortArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Integer", result::class.java.name)
@ -151,7 +151,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showByteArray = classLoader.createTaskFor(taskFactory, ShowByteArray::class.java)
val showByteArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowByteArray::class.java)
val result = showByteArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Integer", result::class.java.name)
@ -176,7 +176,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showDoubleArray = classLoader.createTaskFor(taskFactory, ShowDoubleArray::class.java)
val showDoubleArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowDoubleArray::class.java)
val result = showDoubleArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Double", result::class.java.name)
@ -201,7 +201,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showFloatArray = classLoader.createTaskFor(taskFactory, ShowFloatArray::class.java)
val showFloatArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowFloatArray::class.java)
val result = showFloatArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Float", result::class.java.name)
@ -226,7 +226,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showBooleanArray = classLoader.createTaskFor(taskFactory, ShowBooleanArray::class.java)
val showBooleanArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowBooleanArray::class.java)
val result = showBooleanArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Boolean", result::class.java.name)
@ -252,7 +252,7 @@ class DeserializeObjectArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showUUIDArray = classLoader.createTaskFor(taskFactory, ShowUUIDArray::class.java)
val showUUIDArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowUUIDArray::class.java)
val result = showUUIDArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals(SANDBOX_STRING, result::class.java.name)

View File

@ -23,7 +23,7 @@ class DeserializeOffsetDateTimeTest : TestBase(KOTLIN) {
val sandboxDateTime = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showOffsetDateTime = classLoader.createTaskFor(taskFactory, ShowOffsetDateTime::class.java)
val showOffsetDateTime = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowOffsetDateTime::class.java)
val result = showOffsetDateTime.apply(sandboxDateTime) ?: fail("Result cannot be null")
assertEquals(dateTime.toString(), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeOffsetTimeTest : TestBase(KOTLIN) {
val sandboxTime = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showOffsetTime = classLoader.createTaskFor(taskFactory, ShowOffsetTime::class.java)
val showOffsetTime = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowOffsetTime::class.java)
val result = showOffsetTime.apply(sandboxTime) ?: fail("Result cannot be null")
assertEquals(time.toString(), result.toString())

View File

@ -32,7 +32,8 @@ class DeserializeOpaqueBytesSubSequenceTest : TestBase(KOTLIN) {
val sandboxBytes = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showOpaqueBytesSubSequence = classLoader.createTaskFor(taskFactory, ShowOpaqueBytesSubSequence::class.java)
val sandboxFunction = classLoader.createSandboxFunction()
val showOpaqueBytesSubSequence = taskFactory.compose(sandboxFunction).apply(ShowOpaqueBytesSubSequence::class.java)
val result = showOpaqueBytesSubSequence.apply(sandboxBytes) ?: fail("Result cannot be null")
assertEquals(MESSAGE.substring(OFFSET), String(result as ByteArray))

View File

@ -23,7 +23,7 @@ class DeserializeOptionalTest : TestBase(KOTLIN) {
val sandboxOptional = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showOptional = classLoader.createTaskFor(taskFactory, ShowOptional::class.java)
val showOptional = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowOptional::class.java)
val result = showOptional.apply(sandboxOptional) ?: fail("Result cannot be null")
assertEquals("Optional -> Optional[Hello World!]", result.toString())
@ -42,7 +42,7 @@ class DeserializeOptionalTest : TestBase(KOTLIN) {
val sandboxOptional = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showOptional = classLoader.createTaskFor(taskFactory, ShowOptional::class.java)
val showOptional = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowOptional::class.java)
val result = showOptional.apply(sandboxOptional) ?: fail("Result cannot be null")
assertEquals("Optional -> Optional.empty", result.toString())

View File

@ -23,7 +23,7 @@ class DeserializePeriodTest : TestBase(KOTLIN) {
val sandboxPeriod = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showPeriod = classLoader.createTaskFor(taskFactory, ShowPeriod::class.java)
val showPeriod = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowPeriod::class.java)
val result = showPeriod.apply(sandboxPeriod) ?: fail("Result cannot be null")
assertEquals(period.toString(), result.toString())

View File

@ -24,7 +24,7 @@ class DeserializePrimitiveArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCharArray = classLoader.createTaskFor(taskFactory, ShowCharArray::class.java)
val showCharArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCharArray::class.java)
val result = showCharArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals(SANDBOX_STRING, result::class.java.name)
@ -49,7 +49,7 @@ class DeserializePrimitiveArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showIntegerArray = classLoader.createTaskFor(taskFactory, ShowIntegerArray::class.java)
val showIntegerArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowIntegerArray::class.java)
val result = showIntegerArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Integer", result::class.java.name)
@ -74,7 +74,7 @@ class DeserializePrimitiveArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showLongArray = classLoader.createTaskFor(taskFactory, ShowLongArray::class.java)
val showLongArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowLongArray::class.java)
val result = showLongArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Long", result::class.java.name)
@ -99,7 +99,7 @@ class DeserializePrimitiveArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showShortArray = classLoader.createTaskFor(taskFactory, ShowShortArray::class.java)
val showShortArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowShortArray::class.java)
val result = showShortArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Integer", result::class.java.name)
@ -124,7 +124,7 @@ class DeserializePrimitiveArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showByteArray = classLoader.createTaskFor(taskFactory, ShowByteArray::class.java)
val showByteArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowByteArray::class.java)
val result = showByteArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Integer", result::class.java.name)
@ -149,7 +149,7 @@ class DeserializePrimitiveArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showBooleanArray = classLoader.createTaskFor(taskFactory, ShowBooleanArray::class.java)
val showBooleanArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowBooleanArray::class.java)
val result = showBooleanArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Boolean", result::class.java.name)
@ -174,7 +174,7 @@ class DeserializePrimitiveArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showDoubleArray = classLoader.createTaskFor(taskFactory, ShowDoubleArray::class.java)
val showDoubleArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowDoubleArray::class.java)
val result = showDoubleArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Double", result::class.java.name)
@ -199,7 +199,7 @@ class DeserializePrimitiveArraysTest : TestBase(KOTLIN) {
val sandboxArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showFloatArray = classLoader.createTaskFor(taskFactory, ShowFloatArray::class.java)
val showFloatArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowFloatArray::class.java)
val result = showFloatArray.apply(sandboxArray) ?: fail("Result cannot be null")
assertEquals("sandbox.java.lang.Float", result::class.java.name)

View File

@ -32,7 +32,7 @@ class DeserializeProtonJTest : TestBase(KOTLIN) {
val sandboxProtonJ = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showUnsignedLong = classLoader.createTaskFor(taskFactory, ShowUnsignedLong::class.java)
val showUnsignedLong = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowUnsignedLong::class.java)
val result = showUnsignedLong.apply(sandboxProtonJ) ?: fail("Result cannot be null")
assertEquals(protonJ.number.toString(), result.toString())
@ -57,7 +57,7 @@ class DeserializeProtonJTest : TestBase(KOTLIN) {
val sandboxProtonJ = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showUnsignedInteger = classLoader.createTaskFor(taskFactory, ShowUnsignedInteger::class.java)
val showUnsignedInteger = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowUnsignedInteger::class.java)
val result = showUnsignedInteger.apply(sandboxProtonJ) ?: fail("Result cannot be null")
assertEquals(protonJ.number.toString(), result.toString())
@ -82,7 +82,7 @@ class DeserializeProtonJTest : TestBase(KOTLIN) {
val sandboxProtonJ = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showUnsignedShort = classLoader.createTaskFor(taskFactory, ShowUnsignedShort::class.java)
val showUnsignedShort = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowUnsignedShort::class.java)
val result = showUnsignedShort.apply(sandboxProtonJ) ?: fail("Result cannot be null")
assertEquals(protonJ.number.toString(), result.toString())
@ -107,7 +107,7 @@ class DeserializeProtonJTest : TestBase(KOTLIN) {
val sandboxProtonJ = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showUnsignedByte = classLoader.createTaskFor(taskFactory, ShowUnsignedByte::class.java)
val showUnsignedByte = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowUnsignedByte::class.java)
val result = showUnsignedByte.apply(sandboxProtonJ) ?: fail("Result cannot be null")
assertEquals(protonJ.number.toString(), result.toString())
@ -132,7 +132,7 @@ class DeserializeProtonJTest : TestBase(KOTLIN) {
val sandboxProtonJ = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showDecimal128 = classLoader.createTaskFor(taskFactory, ShowDecimal128::class.java)
val showDecimal128 = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowDecimal128::class.java)
val result = showDecimal128.apply(sandboxProtonJ) ?: fail("Result cannot be null")
assertThat(result)
@ -157,7 +157,7 @@ class DeserializeProtonJTest : TestBase(KOTLIN) {
val sandboxProtonJ = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showDecimal64 = classLoader.createTaskFor(taskFactory, ShowDecimal64::class.java)
val showDecimal64 = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowDecimal64::class.java)
val result = showDecimal64.apply(sandboxProtonJ) ?: fail("Result cannot be null")
assertEquals(protonJ.number.bits.toString(), result.toString())
@ -181,7 +181,7 @@ class DeserializeProtonJTest : TestBase(KOTLIN) {
val sandboxProtonJ = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showDecimal32 = classLoader.createTaskFor(taskFactory, ShowDecimal32::class.java)
val showDecimal32 = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowDecimal32::class.java)
val result = showDecimal32.apply(sandboxProtonJ) ?: fail("Result cannot be null")
assertEquals(protonJ.number.bits.toString(), result.toString())
@ -204,9 +204,9 @@ class DeserializeProtonJTest : TestBase(KOTLIN) {
val sandboxProtonJ = data.deserializeFor(classLoader)
val executor = classLoader.createRawTaskFactory()
val taskFactory = classLoader.createTaskFor(executor, ShowSymbol::class.java)
val result = taskFactory.apply(sandboxProtonJ) ?: fail("Result cannot be null")
val taskFactory = classLoader.createRawTaskFactory()
val showSymbol = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowSymbol::class.java)
val result = showSymbol.apply(sandboxProtonJ) ?: fail("Result cannot be null")
assertEquals(protonJ.symbol.toString(), result.toString())
assertEquals(SANDBOX_STRING, result::class.java.name)

View File

@ -44,7 +44,7 @@ class DeserializePublicKeyTest : TestBase(KOTLIN) {
val sandboxKey = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showPublicKey = classLoader.createTaskFor(taskFactory, ShowPublicKey::class.java)
val showPublicKey = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowPublicKey::class.java)
val result = showPublicKey.apply(sandboxKey) ?: fail("Result cannot be null")
assertEquals(ShowPublicKey().apply(publicKey), result.toString())
@ -72,7 +72,7 @@ class DeserializePublicKeyTest : TestBase(KOTLIN) {
val sandboxKey = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showPublicKey = classLoader.createTaskFor(taskFactory, ShowPublicKey::class.java)
val showPublicKey = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowPublicKey::class.java)
val result = showPublicKey.apply(sandboxKey) ?: fail("Result cannot be null")
assertEquals(ShowPublicKey().apply(compositeData), result.toString())

View File

@ -22,7 +22,7 @@ class DeserializeStringBufferTest : TestBase(KOTLIN) {
val sandboxBuffer = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringBuffer = classLoader.createTaskFor(taskFactory, ShowStringBuffer::class.java)
val showStringBuffer = taskFactory.compose(classLoader.createSandboxFunction()).apply( ShowStringBuffer::class.java)
val result = showStringBuffer.apply(sandboxBuffer) ?: fail("Result cannot be null")
assertEquals(ShowStringBuffer().apply(buffer), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeStringTest : TestBase(KOTLIN) {
val sandboxString = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringMessage = classLoader.createTaskFor(taskFactory, ShowStringMessage::class.java)
val showStringMessage = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowStringMessage::class.java)
val result = showStringMessage.apply(sandboxString) ?: fail("Result cannot be null")
assertEquals(stringMessage.message, result.toString())
@ -50,7 +50,7 @@ class DeserializeStringTest : TestBase(KOTLIN) {
val sandboxListArray = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showStringListOfArray = classLoader.createTaskFor(taskFactory, ShowStringListOfArray::class.java)
val showStringListOfArray = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowStringListOfArray::class.java)
val result = showStringListOfArray.apply(sandboxListArray) ?: fail("Result cannot be null")
assertEquals(stringListArray.data.flatMap(Array<String>::toList).joinToString(), result.toString())

View File

@ -44,7 +44,7 @@ class DeserializeWithCustomSerializerTest: TestBase(KOTLIN) {
val sandboxCustom = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCustom = classLoader.createTaskFor(taskFactory, ShowCustomData::class.java)
val showCustom = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCustomData::class.java)
val result = showCustom.apply(sandboxCustom) ?: fail("Result cannot be null")
assertEquals(custom.value, result.toString())

View File

@ -42,7 +42,7 @@ class DeserializeWithObjectCustomSerializerTest: TestBase(KOTLIN) {
val sandboxCustom = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCustom = classLoader.createTaskFor(taskFactory, ShowCustomData::class.java)
val showCustom = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCustomData::class.java)
val result = showCustom.apply(sandboxCustom) ?: fail("Result cannot be null")
assertEquals(custom.value, result.toString())

View File

@ -45,7 +45,7 @@ class DeserializeWithSerializationWhitelistTest: TestBase(KOTLIN) {
val sandboxCustom = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showCustom = classLoader.createTaskFor(taskFactory, ShowCustomData::class.java)
val showCustom = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowCustomData::class.java)
val result = showCustom.apply(sandboxCustom) ?: fail("Result cannot be null")
assertEquals(custom.value, result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeYearMonthTest : TestBase(KOTLIN) {
val sandboxYearMonth = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showYearMonth = classLoader.createTaskFor(taskFactory, ShowYearMonth::class.java)
val showYearMonth = taskFactory.compose(classLoader.createSandboxFunction()).apply( ShowYearMonth::class.java)
val result = showYearMonth.apply(sandboxYearMonth) ?: fail("Result cannot be null")
assertEquals(yearMonth.toString(), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeYearTest : TestBase(KOTLIN) {
val sandboxYear = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showYear = classLoader.createTaskFor(taskFactory, ShowYear::class.java)
val showYear = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowYear::class.java)
val result = showYear.apply(sandboxYear) ?: fail("Result cannot be null")
assertEquals(year.toString(), result.toString())

View File

@ -35,7 +35,7 @@ class DeserializeZoneIdTest : TestBase(KOTLIN) {
val sandboxZoneId = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showZoneId = classLoader.createTaskFor(taskFactory, ShowZoneId::class.java)
val showZoneId = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowZoneId::class.java)
val result = showZoneId.apply(sandboxZoneId) ?: fail("Result cannot be null")
assertEquals(zoneId.toString(), result.toString())

View File

@ -23,7 +23,7 @@ class DeserializeZonedDateTimeTest : TestBase(KOTLIN) {
val sandboxDateTime = data.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showZonedDateTime = classLoader.createTaskFor(taskFactory, ShowZonedDateTime::class.java)
val showZonedDateTime = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowZonedDateTime::class.java)
val result = showZonedDateTime.apply(sandboxDateTime) ?: fail("Result cannot be null")
assertEquals(dateTime.toString(), result.toString())

View File

@ -21,7 +21,7 @@ import org.junit.jupiter.api.extension.BeforeEachCallback
import org.junit.jupiter.api.extension.ExtensionContext
class LocalSerialization(
private val customSerializers: Set<SerializationCustomSerializer<*,*>>,
private val customSerializers: Set<SerializationCustomSerializer<*, *>>,
private val serializationWhitelists: Set<SerializationWhitelist>
) : BeforeEachCallback, AfterEachCallback {
private companion object {

View File

@ -53,7 +53,7 @@ class SafeDeserialisationTest : TestBase(KOTLIN) {
val sandboxData = evilData.deserializeFor(classLoader)
val taskFactory = classLoader.createRawTaskFactory()
val showInnocentData = classLoader.createTaskFor(taskFactory, ShowInnocentData::class.java)
val showInnocentData = taskFactory.compose(classLoader.createSandboxFunction()).apply(ShowInnocentData::class.java)
val result = showInnocentData.apply(sandboxData) ?: fail("Result cannot be null")
// Check that we have deserialised the data without instantiating the Evil class.