Fix build with JDK 9+

This commit is contained in:
Nico Mexis 2021-06-22 20:54:37 +02:00
parent 5581a343f5
commit 913b49c593
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78
3 changed files with 9 additions and 8 deletions

View file

@ -6,7 +6,7 @@
<version>2.10.12</version> <version>2.10.12</version>
<properties> <properties>
<java.version>8</java.version> <java.version>1.8</java.version>
<maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -256,7 +256,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version> <version>3.1.1</version> <!-- 3.1.2 breaks build on JDK 9+ -->
<configuration> <configuration>
<archive> <archive>
<manifest> <manifest>

View file

@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.resourcelist;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.MutableTreeNode; import javax.swing.tree.MutableTreeNode;
import java.util.Comparator; import java.util.Comparator;
import javax.swing.tree.TreeNode;
/** /**
* @author Konloch * @author Konloch
@ -33,19 +34,19 @@ public class ResourceTreeNode extends DefaultMutableTreeNode
private void recursiveSort(final ResourceTreeNode node) private void recursiveSort(final ResourceTreeNode node)
{ {
node.children.sort(nodeComparator); node.children.sort(nodeComparator);
for (ResourceTreeNode nextNode : (Iterable<ResourceTreeNode>) node.children) for (TreeNode nextNode : (Iterable<TreeNode>) node.children)
{ {
if (nextNode.getChildCount() > 0) if (nextNode.getChildCount() > 0)
{ {
recursiveSort(nextNode); recursiveSort((ResourceTreeNode) nextNode);
} }
} }
} }
protected Comparator<ResourceTreeNode> nodeComparator = new Comparator<ResourceTreeNode>() protected Comparator<TreeNode> nodeComparator = new Comparator<TreeNode>()
{ {
@Override @Override
public int compare(final ResourceTreeNode o1, final ResourceTreeNode o2) public int compare(final TreeNode o1, final TreeNode o2)
{ {
// To make sure nodes with children are always on top // To make sure nodes with children are always on top
final int firstOffset = o1.getChildCount() > 0 ? -1000 : 0; final int firstOffset = o1.getChildCount() > 0 ? -1000 : 0;

View file

@ -82,10 +82,10 @@ public class SearchKeyAdapter extends KeyAdapter
else else
{ {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Enumeration<ResourceTreeNode> enums = curNode.depthFirstEnumeration(); Enumeration<TreeNode> enums = curNode.depthFirstEnumeration();
while (enums != null && enums.hasMoreElements()) while (enums != null && enums.hasMoreElements())
{ {
ResourceTreeNode node = enums.nextElement(); ResourceTreeNode node = (ResourceTreeNode) enums.nextElement();
if (node.isLeaf()) if (node.isLeaf())
{ {
if (((String) (node.getUserObject())).toLowerCase().contains(path[path.length - 1].toLowerCase())) if (((String) (node.getUserObject())).toLowerCase().contains(path[path.length - 1].toLowerCase()))