CodeQL library for Java/Kotlin
codeql/java-all 0.11.0 (changelog, source)

Member predicate MetricRefType::getResponse

Gets the response for a type.

This estimates the number of different callables that can be executed when a callable is invoked on this type. In an ideal world, one would compute a precise static approximation of the dynamic call graph, and then take the number of reachable callables from each callable. However, there are two problems with such an approach. First, it is incredibly expensive to compute such an approximation. Second, the approximation is likely to be very rough, even when using these expensive algorithms.

For that reason, Chidamber and Kemerer suggested in their seminal 1994 article that one just counts the number of calls within the callables of a class. Spinellis’s ckjm tool does precisely that, and we follow its lead.

int getResponse()