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

@ -6,6 +6,12 @@ apply plugin: 'net.corda.plugins.quasar-utils'
configurations { configurations {
integrationTestCompile.extendsFrom testCompile integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime integrationTestRuntime.extendsFrom testRuntime
compile {
// We already have a SLF4J implementation on our runtime classpath,
// and we don't need another one.
exclude group: "org.apache.logging.log4j"
}
} }
sourceSets { sourceSets {
@ -33,14 +39,9 @@ dependencies {
compile project(':core') compile project(':core')
compile project(':client:jfx') compile project(':client:jfx')
compile (project(':node-driver')) { compile project(':node-driver')
// We already have a SLF4J implementation on our runtime classpath, compile project(':webserver')
// and we don't need another one.
exclude group: 'org.apache.logging.log4j'
}
compile (project(':webserver')) {
exclude group: "org.apache.logging.log4j"
}
testCompile project(':test-utils') testCompile project(':test-utils')
compile "org.graphstream:gs-core:1.3" compile "org.graphstream:gs-core:1.3"
@ -49,8 +50,8 @@ dependencies {
exclude group: "junit" exclude group: "junit"
} }
compile project(path: ":node:capsule", configuration: 'runtimeArtifacts') cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts') cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
// CorDapps: dependent flows and services // CorDapps: dependent flows and services
compile project(':finance:contracts') compile project(':finance:contracts')

View File

@ -88,7 +88,9 @@ open class ArraySerializer(override val type: Type, factory: LocalSerializerFact
context: SerializationContext context: SerializationContext
): Any { ): Any {
if (obj is List<*>) { 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") } 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, observedType = type,
typeIdentifier = typeIdentifier, typeIdentifier = typeIdentifier,
constructor = null, 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, superclass = superclassInformation,
interfaces = interfaceInformation, interfaces = interfaceInformation,
typeParameters = typeParameterInformation, typeParameters = typeParameterInformation,