Skip to content

Call graph is missing edges to implementations of interfaces #113

@rahlk

Description

@rahlk

Describe the bug

When there is call to an interface method, the call graph edge in the current call graph points to the interface and not to any of the implementations. So when there is a call to a method is a class that implements/extends this interface, we don't see those edges in the call graph.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Generate a analysis.json with java -jar /path/to/codeanalyzer-2.2.0-dev.jar --input /path/to/daytrader8 --output /path/to/analysis-json/
  2. Inspect the JSON for call edges from com.ibm.websphere.samples.daytrader.web.servlet.TradeServletAction::doBuy(ServletContext, HttpServletRequest, HttpServletResponse, String, String, String).

Observed behavior

We'll see a call edge directly to the interface, i.e., we observe that there will an edge to tAction.buy(userID, symbol, new Double(quantity).doubleValue(), TradeConfig.getOrderProcessingMode()); where private TradeServices tAction; and TradeServices is an interface class.

Expected behavior

Call graph edge should point to the right implementation(s) of the the interface (i.e, to TradeDirect or TradeSLSBBean which implement/extend TradeServices). Or, if we choose to be imprecise, then we'll have to have edges to each of these implementations.

Screenshots

Image

Environment (please complete the following information):

  • OS: All supported
  • Version of Java: 11+
  • Version of Maven: N/A
  • Version of Gradle: N/A

Additional context

  • Explore the various analysis depths in WALA to see which one works

  • Expose the call-graph analysis depths as a CLI option to provide to codeanalyzer call graph construction

  • Mirror this in CLDK python-sdk repo as a now feature request

  • Consider manually adding call-edges to all implementing subtypes of the the interface (match by method signature of the subtypes.)

  • Test on below:

com.ibm.websphere.samples.daytrader.web.servlet.TradeServletAction, doBuy(ServletContext, HttpServletRequest, HttpServletResponse, String, String, String)

private TradeServices tAction
OrderDataBean orderData = tAction.buy(userID, symbol, new Double(quantity).doubleValue(), TradeConfig.getOrderProcessingMode());

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions