diff --git a/recaf-ui/src/main/java/me/coley/recaf/ui/pane/HierarchyPane.java b/recaf-ui/src/main/java/me/coley/recaf/ui/pane/HierarchyPane.java index 5d96d35b1..790e37325 100644 --- a/recaf-ui/src/main/java/me/coley/recaf/ui/pane/HierarchyPane.java +++ b/recaf-ui/src/main/java/me/coley/recaf/ui/pane/HierarchyPane.java @@ -28,8 +28,6 @@ import me.coley.recaf.util.threading.FxThreadUtil; import org.slf4j.Logger; -import java.util.Objects; - /** * Visualization of the class hierarchy for children and parent relations. @@ -116,7 +114,7 @@ private HierarchyTree() { @Override public void onUpdate(CommonClassInfo newValue) { InheritanceGraph graph = RecafUI.getController().getServices().getInheritanceGraph(); - HierarchyItem root = new HierarchyItem(newValue); + TreeItem root = new TreeItem<>(newValue); String name = newValue.getName(); InheritanceVertex vertex = graph.getVertex(name); if (vertex != null) { @@ -131,12 +129,12 @@ public void onUpdate(CommonClassInfo newValue) { FxThreadUtil.run(() -> setRoot(root)); } - private void createParents(HierarchyItem root, InheritanceVertex rootVertex) { + private void createParents(TreeItem root, InheritanceVertex rootVertex) { root.setExpanded(true); for (InheritanceVertex parentVertex : rootVertex.getParents()) { if (parentVertex.getName().equals("java/lang/Object")) continue; - HierarchyItem subItem = new HierarchyItem(parentVertex.getValue()); + TreeItem subItem = new TreeItem<>(parentVertex.getValue()); if (noLoops(root, subItem)) { root.getChildren().add(subItem); createParents(subItem, parentVertex); @@ -144,10 +142,10 @@ private void createParents(HierarchyItem root, InheritanceVertex rootVertex) { } } - private void createChildren(HierarchyItem root, InheritanceVertex rootVertex) { + private void createChildren(TreeItem root, InheritanceVertex rootVertex) { root.setExpanded(true); for (InheritanceVertex childVertex : rootVertex.getChildren()) { - HierarchyItem subItem = new HierarchyItem(childVertex.getValue()); + TreeItem subItem = new TreeItem<>(childVertex.getValue()); if (noLoops(root, subItem)) { root.getChildren().add(subItem); createChildren(subItem, childVertex); @@ -166,34 +164,6 @@ private boolean noLoops(TreeItem root, TreeItem child) { } } - /** - * Item of a class in the hierarchy. - */ - static class HierarchyItem extends TreeItem { - private HierarchyItem(CommonClassInfo info) { - super(info); - } - - @Override - public int hashCode() { - CommonClassInfo value = getValue(); - if (value == null) - return -1; - int result = value.getName().hashCode(); - result = 31 * result + (value.getSuperName().hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof HierarchyItem) { - HierarchyItem other = (HierarchyItem) obj; - return Objects.equals(getValue(), other.getValue()); - } - return false; - } - } - /** * Cell of a class in the hierarchy. */