heuristic call graph

This commit is contained in:
2026-06-21 07:33:01 +02:00
parent 9cf2d063b3
commit e06429cb02
6 changed files with 75 additions and 56 deletions

View File

@@ -0,0 +1,11 @@
package click.kamil.springstatemachineexporter.analysis.model;
import lombok.Data;
import java.util.List;
@Data
public class CallEdge {
private final String targetMethod;
private final List<String> arguments;
}

View File

@@ -0,0 +1,11 @@
package click.kamil.springstatemachineexporter.analysis.service;
import click.kamil.springstatemachineexporter.analysis.model.CallChain;
import click.kamil.springstatemachineexporter.analysis.model.EntryPoint;
import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint;
import java.util.List;
public interface CallGraphEngine {
List<CallChain> findChains(List<EntryPoint> entryPoints, List<TriggerPoint> triggers);
}

View File

@@ -1,6 +1,7 @@
package click.kamil.springstatemachineexporter.analysis.service; package click.kamil.springstatemachineexporter.analysis.service;
import click.kamil.springstatemachineexporter.analysis.model.CallChain; import click.kamil.springstatemachineexporter.analysis.model.CallChain;
import click.kamil.springstatemachineexporter.analysis.model.CallEdge;
import click.kamil.springstatemachineexporter.analysis.model.EntryPoint; import click.kamil.springstatemachineexporter.analysis.model.EntryPoint;
import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint; import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint;
import click.kamil.springstatemachineexporter.ast.common.CodebaseContext; import click.kamil.springstatemachineexporter.ast.common.CodebaseContext;
@@ -11,19 +12,13 @@ import org.eclipse.jdt.core.dom.*;
import java.util.*; import java.util.*;
@Slf4j @Slf4j
public class CallGraphBuilder { public class HeuristicCallGraphEngine implements CallGraphEngine {
private final CodebaseContext context; private final CodebaseContext context;
private final ConstantResolver constantResolver; private final ConstantResolver constantResolver;
private String currentMethodFqn; private String currentMethodFqn;
private Map<String, List<CallEdge>> graph; private Map<String, List<CallEdge>> graph;
@lombok.Data public HeuristicCallGraphEngine(CodebaseContext context) {
private static class CallEdge {
private final String targetMethod;
private final List<String> arguments;
}
public CallGraphBuilder(CodebaseContext context) {
this.context = context; this.context = context;
this.constantResolver = new ConstantResolver(); this.constantResolver = new ConstantResolver();
} }

View File

@@ -21,7 +21,7 @@ public class JdtIntelligenceProvider implements CodebaseIntelligenceProvider {
private final GenericEventDetector eventDetector; private final GenericEventDetector eventDetector;
private final SpringMvcDetector mvcDetector; private final SpringMvcDetector mvcDetector;
private final MessagingDetector messagingDetector; private final MessagingDetector messagingDetector;
private final CallGraphBuilder callGraphBuilder; private final CallGraphEngine callGraphEngine;
private final LifecycleDetector lifecycleDetector; private final LifecycleDetector lifecycleDetector;
private final InterceptorDetector interceptorDetector; private final InterceptorDetector interceptorDetector;
private final SpringComponentDetector componentDetector; private final SpringComponentDetector componentDetector;
@@ -32,7 +32,7 @@ public class JdtIntelligenceProvider implements CodebaseIntelligenceProvider {
this.eventDetector = new GenericEventDetector(context, constantResolver, context.getLibraryHints()); this.eventDetector = new GenericEventDetector(context, constantResolver, context.getLibraryHints());
this.mvcDetector = new SpringMvcDetector(context, constantResolver); this.mvcDetector = new SpringMvcDetector(context, constantResolver);
this.messagingDetector = new MessagingDetector(context); this.messagingDetector = new MessagingDetector(context);
this.callGraphBuilder = new CallGraphBuilder(context); this.callGraphEngine = new HeuristicCallGraphEngine(context);
this.lifecycleDetector = new LifecycleDetector(context); this.lifecycleDetector = new LifecycleDetector(context);
this.interceptorDetector = new InterceptorDetector(context); this.interceptorDetector = new InterceptorDetector(context);
this.componentDetector = new SpringComponentDetector(context); this.componentDetector = new SpringComponentDetector(context);
@@ -69,7 +69,7 @@ public class JdtIntelligenceProvider implements CodebaseIntelligenceProvider {
@Override @Override
public List<CallChain> findCallChains(List<EntryPoint> entryPoints, List<TriggerPoint> triggers) { public List<CallChain> findCallChains(List<EntryPoint> entryPoints, List<TriggerPoint> triggers) {
log.info("JdtIntelligenceProvider searching for call chains between {} entry points and {} triggers", entryPoints.size(), triggers.size()); log.info("JdtIntelligenceProvider searching for call chains between {} entry points and {} triggers", entryPoints.size(), triggers.size());
return callGraphBuilder.findChains(entryPoints, triggers); return callGraphEngine.findChains(entryPoints, triggers);
} }
@Override @Override

View File

@@ -4,7 +4,7 @@ import click.kamil.springstatemachineexporter.analysis.model.CallChain;
import click.kamil.springstatemachineexporter.analysis.model.EntryPoint; import click.kamil.springstatemachineexporter.analysis.model.EntryPoint;
import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint; import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint;
import click.kamil.springstatemachineexporter.analysis.resolver.ConstantResolver; import click.kamil.springstatemachineexporter.analysis.resolver.ConstantResolver;
import click.kamil.springstatemachineexporter.analysis.service.CallGraphBuilder; import click.kamil.springstatemachineexporter.analysis.service.HeuristicCallGraphEngine;
import click.kamil.springstatemachineexporter.analysis.service.GenericEventDetector; import click.kamil.springstatemachineexporter.analysis.service.GenericEventDetector;
import click.kamil.springstatemachineexporter.analysis.service.SpringMvcDetector; import click.kamil.springstatemachineexporter.analysis.service.SpringMvcDetector;
import click.kamil.springstatemachineexporter.ast.common.CodebaseContext; import click.kamil.springstatemachineexporter.ast.common.CodebaseContext;
@@ -76,7 +76,7 @@ public class InheritedEventDetectionTest {
assertThat(tp.getEvent()).isEqualTo("event"); assertThat(tp.getEvent()).isEqualTo("event");
// Build Call Chains // Build Call Chains
CallGraphBuilder callGraphBuilder = new CallGraphBuilder(context); HeuristicCallGraphEngine callGraphBuilder = new HeuristicCallGraphEngine(context);
List<CallChain> chains = callGraphBuilder.findChains(entryPoints, triggers); List<CallChain> chains = callGraphBuilder.findChains(entryPoints, triggers);
assertThat(chains).describedAs("Should link ChildController.trigger to BaseController.send").hasSize(1); assertThat(chains).describedAs("Should link ChildController.trigger to BaseController.send").hasSize(1);

View File

@@ -12,9 +12,11 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.List; import java.util.List;
import org.junit.jupiter.api.Tag;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class CallGraphBuilderTest { @Tag("heuristic_guess_paths_and_scrape_regex_replace_with_data_flow_analysis")
class HeuristicCallGraphEngineTest {
@Test @Test
void shouldFindCallChainWithLambdaMethodReference(@TempDir Path tempDir) throws IOException { void shouldFindCallChainWithLambdaMethodReference(@TempDir Path tempDir) throws IOException {
@@ -43,7 +45,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderService") .className("com.example.OrderService")
@@ -94,7 +96,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.PersisterService") .className("com.example.PersisterService")
@@ -146,7 +148,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -200,7 +202,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -268,7 +270,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -322,7 +324,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -392,7 +394,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -438,7 +440,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -489,7 +491,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -547,7 +549,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -597,7 +599,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -650,7 +652,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -695,7 +697,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -747,7 +749,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -793,7 +795,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -837,7 +839,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -887,7 +889,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -933,7 +935,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder() EntryPoint entryPoint = EntryPoint.builder()
.className("com.example.OrderController") .className("com.example.OrderController")
@@ -984,7 +986,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("processOrderEvent").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("processOrderEvent").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("updateOrderState").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("updateOrderState").event("event").build();
@@ -1017,7 +1019,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("createOrder").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("createOrder").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("processOrderEvent").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("processOrderEvent").event("event").build();
@@ -1073,7 +1075,7 @@ class CallGraphBuilderTest {
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.controller.EventController").methodName("handleEvent").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.controller.EventController").methodName("handleEvent").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.service.EventService").methodName("process").event("type").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.service.EventService").methodName("process").event("type").build();
@@ -1115,7 +1117,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1149,7 +1151,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1181,7 +1183,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1218,7 +1220,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1255,7 +1257,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1290,7 +1292,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1327,7 +1329,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1361,7 +1363,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1397,7 +1399,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1431,7 +1433,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1469,7 +1471,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1510,7 +1512,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1548,7 +1550,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1587,7 +1589,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1630,7 +1632,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1672,7 +1674,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1713,7 +1715,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1754,7 +1756,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1797,7 +1799,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();
@@ -1842,7 +1844,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint ep1 = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus1").build(); EntryPoint ep1 = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus1").build();
EntryPoint ep2 = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus2").build(); EntryPoint ep2 = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus2").build();
@@ -1887,7 +1889,7 @@ class CallGraphBuilderTest {
Files.writeString(tempDir.resolve("OrderConfig.java"), source); Files.writeString(tempDir.resolve("OrderConfig.java"), source);
CodebaseContext context = new CodebaseContext(); CodebaseContext context = new CodebaseContext();
context.scan(tempDir); context.scan(tempDir);
CallGraphBuilder builder = new CallGraphBuilder(context); HeuristicCallGraphEngine builder = new HeuristicCallGraphEngine(context);
EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build(); EntryPoint entryPoint = EntryPoint.builder().className("com.example.OrderController").methodName("handleStatus").build();
TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build(); TriggerPoint trigger = TriggerPoint.builder().className("com.example.OrderService").methodName("process").event("event").build();