Skip to content

XmlGraph: build nodes only for the requested class - #586

Open
amalsaidov wants to merge 1 commit into
cqfn:masterfrom
amalsaidov:fix-xmlgraph-cross-class-nodes
Open

amalsaidov wants to merge 1 commit into
cqfn:masterfrom
amalsaidov:fix-xmlgraph-cross-class-nodes

Conversation

@amalsaidov

Copy link
Copy Markdown

While looking at #556 I noticed that XmlGraph.build selected methods with an unscoped //methods/method XPath, which walks the whole skeleton. When the skeleton holds more than one class, the graph for one class ends up with nodes for other classes' methods too (the reporter saw 5 nodes instead of 2).

This scopes the method query to the requested package and class, so only the target class's methods become nodes.

Added a regression test buildsNodesOnlyForTheRequestedClass that builds a skeleton with two classes (MethodMethodCalls and Bar) and asserts the graph for one of them has exactly its 5 methods. Before the change it failed with "collection size was <8>"; after it passes.

Tested with mvn clean install -Pqulice -Denforcer.skip=true (BUILD SUCCESS, qulice clean).

Fixes #556

XmlGraph.build selected methods with an unscoped '//methods/method'
XPath, so it collected methods from every class in the skeleton, not
just the requested package/class. With more than one class the graph
ended up with extra nodes. Scope the query to the target package and
class.

Fixes cqfn#556

Signed-off-by: karma <inskarma0101@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XmlGraph builds graph with redundant nodes.

1 participant