Fix generics in SwingLoggerPanel to compile in Java 9+
Prior to Java 9, the postOrderEnumeration method returned a raw
Enumeration, but to correctly compile in newer JDKs we must return
the correctly parameterized type.
Bug: #9683
Change-Id: I9a21df1bc6473a7e569e0e4d3aa65ba45215167f
Bug-Link: https://github.com/gwtproject/gwt/issues/9683
diff --git a/dev/core/src/com/google/gwt/dev/shell/log/SwingLoggerPanel.java b/dev/core/src/com/google/gwt/dev/shell/log/SwingLoggerPanel.java
index a7fa364..e6f5e8c 100644
--- a/dev/core/src/com/google/gwt/dev/shell/log/SwingLoggerPanel.java
+++ b/dev/core/src/com/google/gwt/dev/shell/log/SwingLoggerPanel.java
@@ -485,9 +485,9 @@
*/
@SuppressWarnings("unchecked")
public void collapseAll() {
- Enumeration<DefaultMutableTreeNode> children = root.postorderEnumeration();
+ Enumeration<TreeNode> children = root.postorderEnumeration();
while (children.hasMoreElements()) {
- DefaultMutableTreeNode node = children.nextElement();
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement();
if (node != root) {
tree.collapsePath(new TreePath(node.getPath()));
}
@@ -509,9 +509,9 @@
*/
@SuppressWarnings("unchecked")
public void expandAll() {
- Enumeration<DefaultMutableTreeNode> children = root.postorderEnumeration();
+ Enumeration<TreeNode> children = root.postorderEnumeration();
while (children.hasMoreElements()) {
- DefaultMutableTreeNode node = children.nextElement();
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement();
if (node != root) {
tree.expandPath(new TreePath(node.getPath()));
}
@@ -605,10 +605,10 @@
protected ArrayList<DefaultMutableTreeNode> doFind(String search) {
@SuppressWarnings("unchecked")
- Enumeration<DefaultMutableTreeNode> children = root.preorderEnumeration();
+ Enumeration<TreeNode> children = root.preorderEnumeration();
ArrayList<DefaultMutableTreeNode> matches = new ArrayList<DefaultMutableTreeNode>();
while (children.hasMoreElements()) {
- DefaultMutableTreeNode node = children.nextElement();
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement();
if (node != root && nodeMatches(node, search)) {
matches.add(node);
// Make sure our this entry is visible by expanding up to parent