Skip to content

Commit 47aef0f

Browse files
Add STATIC_BASE_TYPE property to calls
1 parent 37a274a commit 47aef0f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

schema/src/main/scala/io/shiftleft/codepropertygraph/schema/CallGraph.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,22 @@ object CallGraph extends SchemaBase {
176176
).protoId(ProtoIds.Inlined)
177177
)
178178

179+
val staticBaseType = builder
180+
.addProperty(
181+
name = "STATIC_BASE_TYPE",
182+
valueType = ValueType.String,
183+
comment = """The `STATIC_BASE_TYPE` field is used to keep track of the type on which a static method
184+
|is called for static methods which may be inherited. This information can then be used to find
185+
|the true `METHOD_FULL_NAME` of the method being called during call linking. For example, if a
186+
|class `Foo` defines a static method `foo` and a class `Bar extends Foo`, then the `STATIC_BASE_TYPE`
187+
|of a`Bar.foo()` call is `Bar` and the `METHOD_FULL_NAME` of the `foo` call is rewritten to
188+
|`Foo.foo:<signature>`.
189+
|""".stripMargin
190+
)
191+
.protoId(ProtoIds.StaticBaseType)
192+
179193
callNode
180-
.addProperties(dispatchType)
194+
.addProperties(dispatchType, staticBaseType)
181195

182196
callNode
183197
.addOutEdge(edge = call, inNode = method)

schema/src/main/scala/io/shiftleft/codepropertygraph/schema/ProtoIds.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ object ProtoIds {
124124
val AstParentType = 56
125125
val AstParentFullName = 57
126126
val DependencyGroupId = 58
127+
val StaticBaseType = 59
127128
val Symbol = 100
128129
val MethodShortName = 102
129130
val PackageName = 103

0 commit comments

Comments
 (0)