mirror of
https://github.com/corda/corda.git
synced 2025-06-03 16:10:58 +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) ->
|
val contractInstances: List<Contract> = contractClasses.map { (contractClassName, contractClass) ->
|
||||||
try {
|
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) {
|
} catch (e: Exception) {
|
||||||
throw TransactionVerificationException.ContractCreationError(ltx.id, contractClassName, e)
|
throw TransactionVerificationException.ContractCreationError(ltx.id, contractClassName, e)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user