@@ -49,28 +49,32 @@ fun readGraph(paths: GraphPaths): DeserializedGraph {
49
49
val (source, target, label) = parts
50
50
val field = parts.getOrNull(3 )
51
51
TestEdge (
52
- vertexMappings.getValue(source.toInt()),
53
- vertexMappings.getValue(target.toInt()),
52
+ vertexMappings.getValue(source.toInt()).withoutJacoDbIds() ,
53
+ vertexMappings.getValue(target.toInt()).withoutJacoDbIds() ,
54
54
label,
55
- field?.let { fieldMappings.getValue(it.toInt()) }
55
+ field?.let { fieldMappings.getValue(it.toInt()) }?.withoutJacoDbIds()
56
56
)
57
57
}.toSet()
58
58
},
59
59
vertexToType = paths.typesURL.openStream().bufferedReader().useLines { lines ->
60
60
lines.associate { line ->
61
61
val (vertex, type) = line.splitWords()
62
- vertexMappings.getValue(vertex.toInt()) to typeMappings.getValue(type.toInt())
62
+ vertexMappings.getValue(vertex.toInt()).withoutJacoDbIds() to typeMappings.getValue(type.toInt())
63
63
}
64
64
},
65
65
vertexToSupTypes = paths.typesURL.openStream().bufferedReader().useLines { lines ->
66
66
lines.map { line ->
67
67
val (vertex, type) = line.splitWords()
68
- vertexMappings.getValue(vertex.toInt()) to typeMappings.getValue(type.toInt())
68
+ vertexMappings.getValue(vertex.toInt()).withoutJacoDbIds() to typeMappings.getValue(type.toInt())
69
69
}
70
70
.groupBy(keySelector = { it.first }, valueTransform = { it.second })
71
71
.mapValues { it.value.toSet() }
72
72
}
73
73
)
74
74
}
75
75
76
+ // JacoDB generates JRE-dependent ID for every method and field (e.g. `(id:7)java.lang.Object#<init>()`)
77
+ private fun String.withoutJacoDbIds (): String =
78
+ replace(""" \(id:\d+\)""" .toRegex(), " (id:jre-dependent)" )
79
+
76
80
private fun String.splitWords () = split(" \\ s+" .toRegex())
0 commit comments