perf(fingerprint): do not resolve already resolved fingerprints

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
oSumAtrIX 2022-09-18 07:35:08 +02:00
parent 2f7e62ef65
commit 4bfd7ebff8
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -50,11 +50,13 @@ object MethodFingerprintUtils {
* @param context The context on which to resolve the [MethodFingerprint]. * @param context The context on which to resolve the [MethodFingerprint].
* @param classDef The class of the matching [Method]. * @param classDef The class of the matching [Method].
* @param forData The [BytecodeData] to host proxies. * @param forData The [BytecodeData] to host proxies.
* @return True if the resolution was successful, false otherwise. * @return True if the resolution was successful or if the fingerprint is already resolved, false otherwise.
*/ */
fun MethodFingerprint.resolve(forData: BytecodeData, context: Method, classDef: ClassDef): Boolean { fun MethodFingerprint.resolve(forData: BytecodeData, context: Method, classDef: ClassDef): Boolean {
val methodFingerprint = this val methodFingerprint = this
if (methodFingerprint.result != null) return true
if (methodFingerprint.returnType != null && !context.returnType.startsWith(methodFingerprint.returnType)) if (methodFingerprint.returnType != null && !context.returnType.startsWith(methodFingerprint.returnType))
return false return false