While performing the task, I encountered "Legacy code", it is compiled in Java 8, but not in Java 16, it swears at this particular piece of code.
protected void onCalculate() {
final ConsoleMapperForTree cm = new ConsoleMapperForTree();
cm.setVisible(true);
cm.getConsole().setFont(new Font("Tahoma", 0, 20));
final DefaultMutableTreeNode root = (DefaultMutableTreeNode)this.tree.getModel().getRoot();
final Enumeration<DefaultMutableTreeNode> enmFclt = (Enumeration<DefaultMutableTreeNode>)root.children(); // this is highlighted as an error
while (enmFclt.hasMoreElements()) {
final DefaultMutableTreeNode fclt = enmFclt.nextElement();
int nSpec = 0;
final Enumeration<DefaultMutableTreeNode> enmDep = (Enumeration<DefaultMutableTreeNode>)fclt.children(); // this is highlighted as an error
while (enmDep.hasMoreElements()) {
final DefaultMutableTreeNode dep = enmDep.nextElement();
final Object data = dep.getUserObject();
if (((Dept)data).spec) {
++nSpec;
}
}
System.out.println(fclt + " has " + nSpec + " specdepartments");
}
}