This commit is contained in:
2026-06-28 15:23:22 +02:00
parent 4d9fee716b
commit f84043f26e

View File

@@ -345,11 +345,18 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine {
sourceMethod = "inline-instantiation";
polymorphicEvents.add(declaredType);
} else if (exprNode instanceof ConditionalExpression cond) {
if (cond.getThenExpression() instanceof ClassInstanceCreation cicThen) {
polymorphicEvents.add(click.kamil.springstatemachineexporter.ast.common.AstUtils.extractSimpleTypeName(cicThen.getType()));
List<Expression> branches = new ArrayList<>();
branches.add(cond.getThenExpression());
branches.add(cond.getElseExpression());
for (Expression branch : branches) {
List<Expression> tracedBranch = variableTracer.traceVariableAll(branch);
for (Expression tb : tracedBranch) {
if (tb instanceof ClassInstanceCreation cic) {
polymorphicEvents.add(click.kamil.springstatemachineexporter.ast.common.AstUtils.extractSimpleTypeName(cic.getType()));
} else {
constantExtractor.extractConstantsFromExpression(tb, polymorphicEvents);
}
}
if (cond.getElseExpression() instanceof ClassInstanceCreation cicElse) {
polymorphicEvents.add(click.kamil.springstatemachineexporter.ast.common.AstUtils.extractSimpleTypeName(cicElse.getType()));
}
sourceMethod = "inline-ternary";
declaredType = polymorphicEvents.isEmpty() ? null : polymorphicEvents.get(0);