private static String formatFromLine(List<Activation> activations, int n) {
return "\tfrom " + formatCallerLine(activations, n);
}
public static String formatCallerLine(List<Activation> activations, int n) {
final SourceSection sourceSection = activations.get(n).getCallNode().getEncapsulatingSourceSection();
final SourceSection reportedSourceSection;
final String reportedName;
if (sourceSection instanceof CoreSourceSection) {
reportedSourceSection = activations.get(n + 1).getCallNode().getEncapsulatingSourceSection();
reportedName = ((CoreSourceSection) sourceSection).getMethodName();
} else {
reportedSourceSection = sourceSection;
reportedName = sourceSection.getIdentifier();
}
final StringBuilder builder = new StringBuilder();
if (reportedSourceSection instanceof NullSourceSection) {
builder.append("NullSourceSection");
} else {
builder.append(reportedSourceSection.getSource().getName());
builder.append(":");
builder.append(reportedSourceSection.getStartLine());
}
builder.append(":in `");
builder.append(reportedName);
builder.append("'");