mirror of
https://github.com/corda/corda.git
synced 2025-04-15 15:07:03 +00:00
CORDA-539 - Fix for attempting to create a primitive nullable field
Refactoring meant that the secondary constructor wasn't being called any more and thus the check wasn't being made. Originally, we always created copies of fields when constructing a schema which meant we always called the secondary constructor, now we don't
This commit is contained in:
parent
063771fac4
commit
ef409c4d65
@ -4,8 +4,6 @@ import jdk.internal.org.objectweb.asm.Opcodes.*
|
||||
import org.objectweb.asm.ClassWriter
|
||||
import org.objectweb.asm.MethodVisitor
|
||||
import org.objectweb.asm.Type
|
||||
import java.beans.BeanDescriptor
|
||||
import java.util.*
|
||||
|
||||
abstract class Field(val field: Class<out Any?>) {
|
||||
abstract var descriptor: String?
|
||||
@ -95,12 +93,14 @@ class NullableField(field: Class<out Any?>) : ClassField(field) {
|
||||
override val nullabilityAnnotation = "Ljavax/annotation/Nullable;"
|
||||
|
||||
constructor(name: String, field: Class<out Any?>) : this(field) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
init {
|
||||
if (field.isPrimitive) {
|
||||
throw NullablePrimitiveException(
|
||||
"Field $name is primitive type ${Type.getDescriptor(field)} and thus cannot be nullable")
|
||||
}
|
||||
|
||||
this.name = name
|
||||
}
|
||||
|
||||
override fun nullTest(mv: MethodVisitor, slot: Int) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user