Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,25 @@ public class Foo {}
parser.delete();
});

it("strips inner call args from chained method-call callee", () => {
const { tree, parser, root } = parse(`public class Foo {
public void run() {
builder().build();
}
}
`);
const result = extractor.extractCallGraph(root);

// The chained call should yield a clean method name "build" for the
// outer call (not the malformed "builder().build"), plus an entry for
// the inner "builder" call.
expect(result.some((e) => e.callee === "build")).toBe(true);
expect(result.some((e) => e.callee.includes("()"))).toBe(false);

tree.delete();
parser.delete();
});

it("tracks correct caller for constructors", () => {
const { tree, parser, root } = parse(`public class Foo {
public Foo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class JavaExtractor implements LanguageExtractor {
if (!nameNode) return null;

const objectNode = node.childForFieldName("object");
if (objectNode) {
if (objectNode && objectNode.type !== "method_invocation") {
return `${objectNode.text}.${nameNode.text}`;
}

Expand Down
Loading