ENT-11351 - Compiler warnings pass 4 (#7663)

* Compiler warnings

* Resolve detekt errors

* Reverted code change; added warning suppression

* Address PR review comments
This commit is contained in:
Chris Cochrane
2024-01-29 13:49:00 +00:00
committed by GitHub
parent a7d0684fe7
commit 9b794795a0
19 changed files with 39 additions and 26 deletions

View File

@ -8,6 +8,7 @@ import net.corda.core.crypto.newSecureRandom
import net.corda.core.internal.CertRole
import net.corda.core.internal.SignedDataWithCert
import net.corda.core.internal.signWithCert
import net.corda.core.internal.uncheckedCast
import net.corda.core.internal.validate
import net.corda.core.utilities.days
import net.corda.core.utilities.millis
@ -424,7 +425,7 @@ val CertPath.x509Certificates: List<X509Certificate>
get() {
require(type == "X.509") { "Not an X.509 cert path: $this" }
// We're not mapping the list to avoid creating a new one.
return certificates as List<X509Certificate>
return uncheckedCast(certificates)
}
val Certificate.x509: X509Certificate get() = requireNotNull(this as? X509Certificate) { "Not an X.509 certificate: $this" }

View File

@ -490,7 +490,8 @@ class ThrowableSerializer<T>(kryo: Kryo, type: Class<T>) : Serializer<Throwable>
}
}
private val delegate: Serializer<Throwable> = uncheckedCast(SerializerFactory.ReflectionSerializerFactory.newSerializer(kryo, FieldSerializer::class.java, type)) as Serializer<Throwable>
@Suppress("UNCHECKED_CAST")
private val delegate: Serializer<Throwable> = SerializerFactory.ReflectionSerializerFactory.newSerializer(kryo, FieldSerializer::class.java, type) as Serializer<Throwable>
override fun write(kryo: Kryo, output: Output, throwable: Throwable) {
delegate.write(kryo, output, throwable)