fix: Use a checked cast by reifying the generic type parameter

This commit is contained in:
oSumAtrIX 2023-11-18 03:27:00 +01:00
parent a627510edf
commit f7a296e1f1
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -115,7 +115,7 @@ fun BytecodeContext.traverseClassHierarchy(targetClass: MutableClass, callback:
* if the [Instruction] is not a [ReferenceInstruction] or the [Reference] is not of type [T]. * if the [Instruction] is not a [ReferenceInstruction] or the [Reference] is not of type [T].
* @see ReferenceInstruction * @see ReferenceInstruction
*/ */
fun <T : Reference> Instruction.getReference() = (this as? ReferenceInstruction)?.reference as? T inline fun <reified T : Reference> Instruction.getReference() = (this as? ReferenceInstruction)?.reference as? T
/** /**
* Get the index of the first [Instruction] that matches the predicate. * Get the index of the first [Instruction] that matches the predicate.