mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
CORDA-3273: Replace deprecated use of Class.newInstance() for sake of DJVM. (#5522)
This commit is contained in:
parent
51330c2e44
commit
9c8048008f
@ -366,7 +366,14 @@ class Verifier(val ltx: LedgerTransaction, private val transactionClassLoader: C
|
||||
|
||||
val contractInstances: List<Contract> = contractClasses.map { (contractClassName, contractClass) ->
|
||||
try {
|
||||
contractClass.getDeclaredConstructor().newInstance()
|
||||
/**
|
||||
* This function must execute with the DJVM's sandbox, which does not
|
||||
* permit user code to access [java.lang.reflect.Constructor] objects.
|
||||
*
|
||||
* [Class.newInstance] is deprecated as of Java 9.
|
||||
*/
|
||||
@Suppress("deprecation")
|
||||
contractClass.newInstance()
|
||||
} catch (e: Exception) {
|
||||
throw TransactionVerificationException.ContractCreationError(ltx.id, contractClassName, e)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user