From 12b12d743b63261f957da0ea1fdf56f2d4d9c14c Mon Sep 17 00:00:00 2001 From: Valentyn Sobol Date: Tue, 15 Apr 2025 17:52:15 +0300 Subject: [PATCH] Fix usages feature: filter callers by location --- .../src/main/kotlin/org/jacodb/impl/features/Usages.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Usages.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Usages.kt index adb29dde9..3271e7121 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Usages.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Usages.kt @@ -34,6 +34,7 @@ import org.jacodb.impl.storage.defaultBatchSize import org.jacodb.impl.storage.dslContext import org.jacodb.impl.storage.eqOrNull import org.jacodb.impl.storage.ers.filterDeleted +import org.jacodb.impl.storage.ers.filterLocations import org.jacodb.impl.storage.ers.toClassSource import org.jacodb.impl.storage.execute import org.jacodb.impl.storage.executeQueries @@ -279,11 +280,12 @@ object Usages : JcFeature { val locationId = callee.getCompressed("locationId")!! callee.getLinks("calls").map { it to locationId } } - .map { (call, _) -> + .map { (call, callerLocationId) -> val callerId = call.getCompressedBlob("callerId")!! val caller = symbolInterner.findSymbolName(callerId)!! val clazz = txn.find("Class", "nameId", callerId.compressed) .filterDeleted() + .filterLocations(callerLocationId) .first() val classId = clazz.id.instanceId UsageFeatureResponse(