mirror of
https://github.com/corda/corda.git
synced 2025-01-18 18:56:28 +00:00
Declare serialisation default interface methods as Java8-style defaults. (#3086)
This commit is contained in:
parent
215e54f1ab
commit
a38250c100
@ -173,6 +173,7 @@ allprojects {
|
||||
apiVersion = "1.2"
|
||||
jvmTarget = "1.8"
|
||||
javaParameters = true // Useful for reflection.
|
||||
freeCompilerArgs = ['-Xenable-jvm-default']
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@ import java.nio.ByteBuffer
|
||||
class OrdinalBits(private val ordinal: Int) {
|
||||
interface OrdinalWriter {
|
||||
val bits: OrdinalBits
|
||||
val encodedSize get() = 1
|
||||
fun writeTo(stream: OutputStream) = stream.write(bits.ordinal)
|
||||
fun putTo(buffer: ByteBuffer) = buffer.put(bits.ordinal.toByte())!!
|
||||
@JvmDefault val encodedSize get() = 1
|
||||
@JvmDefault fun writeTo(stream: OutputStream) = stream.write(bits.ordinal)
|
||||
@JvmDefault fun putTo(buffer: ByteBuffer) = buffer.put(bits.ordinal.toByte())!!
|
||||
}
|
||||
|
||||
init {
|
||||
|
@ -31,6 +31,7 @@ interface AMQPSerializer<out T> {
|
||||
/**
|
||||
* Write the given object, with declared type, to the output.
|
||||
*/
|
||||
@JvmDefault
|
||||
fun writeObject(obj: Any, data: Data, type: Type, output: SerializationOutput,
|
||||
context: SerializationContext, debugIndent: Int = 0)
|
||||
|
||||
@ -38,4 +39,4 @@ interface AMQPSerializer<out T> {
|
||||
* Read the given object from the input. The envelope is provided in case the schema is required.
|
||||
*/
|
||||
fun readObject(obj: Any, schemas: SerializationSchemas, input: DeserializationInput, context: SerializationContext): T
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user