CORDA-2050: Do not add java.lang.Class fields and properties to local type cache. (#5511)

* Fix SLF4J logging for example Gradle project.

* Stop adding java.lang.Class's internal fields and properties to the local type cache. This allows us to fix ArraySerializer for the DJVM.
This commit is contained in:
Chris Rankin
2019-09-23 18:26:21 +01:00
committed by Rick Parker
parent 650264e092
commit a9d9b668bc
3 changed files with 20 additions and 12 deletions

View File

@ -88,7 +88,9 @@ open class ArraySerializer(override val type: Type, factory: LocalSerializerFact
context: SerializationContext
): Any {
if (obj is List<*>) {
return obj.map { input.readObjectOrNull(it, schemas, elementType, context) }.toArrayOfType(elementType)
return obj.map {
input.readObjectOrNull(redescribe(it, elementType), schemas, elementType, context)
}.toArrayOfType(elementType)
} else throw AMQPNotSerializableException(type, "Expected a List but found $obj")
}

View File

@ -209,7 +209,12 @@ internal data class LocalTypeInformationBuilder(val lookup: LocalTypeLookup,
observedType = type,
typeIdentifier = typeIdentifier,
constructor = null,
properties = buildReadOnlyProperties(rawType),
properties = if (rawType == Class::class.java) {
// Do NOT drill down into the internals of java.lang.Class.
emptyMap()
} else {
buildReadOnlyProperties(rawType)
},
superclass = superclassInformation,
interfaces = interfaceInformation,
typeParameters = typeParameterInformation,