Comparing startEvent to itself evaluates to FALSE

Here is part of my code:

if (flow.getSource() == lastNode) {
	Log.write(Log.DEBUG, "Evaluated TRUE - " + lastNode.getId() + " : " + flow.getSource().getId());
	return;
}
Log.write(Log.DEBUG, "Evaluated FALSE - " + lastNode.getId() + " : " + flow.getSource().getId());

And here is my log output:

[05-11-2022 14:47:56:738][D] Evaluated FALSE - startEvent_1e4ad105-45fd-414f-81db-668bdb5153fb : startEvent_1e4ad105-45fd-414f-81db-668bdb5153fb

The log shows it is indeed my StartEvent on both sides of the evaluation and the IDs are the same, but it evaluates to false. Why does this comparison fail when StartEvent or EndEvent are in question and it works for any other Node?