猿问

与集合和泛型相关的 Java 10 迁移问题

继续我在链接中的上一个查询:Swing Issue on Java 10,我发现了更多问题(仅突出显示错误),这次我看到问题主要出现在迁移到 Java 10 后的 Collection API 中。


下面是错误。想知道从 Java 8 迁移时 Java 10 是否有任何重大变化(从集合/泛型的角度来看)。


    [javac] C:\WorkSpace\JAVA10\oswm\rel20.10_Patches\WorkManager\src\com\osm\ui\tree\WMTreeNode.java:159: error: breadthFirstEnumeration() in WMTreeNode cannot override breadthFirstEnumeration() in DefaultMutableTreeNode

    [javac]     public Enumeration<?extends WMTreeNode> breadthFirstEnumeration() {

    [javac]                                             ^

    [javac]   return type Enumeration<? extends WMTreeNode> is not compatible with Enumeration<TreeNode>

    [javac] C:\WorkSpace\JAVA10\oswm\rel20.10_Patches\WorkManager\src\com\osm\ui\tree\WMTreeNode.java:158: error: method does not override or implement a method from a supertype

    [javac]     @Override

    [javac]     ^

    [javac] C:\WorkSpace\JAVA10\oswm\rel20.10_Patches\WorkManager\src\com\osm\ui\tree\WMTreeNode.java:164: error: depthFirstEnumeration() in WMTreeNode cannot override depthFirstEnumeration() in DefaultMutableTreeNode

    [javac]     public Enumeration<?extends WMTreeNode> depthFirstEnumeration() {

    [javac]                                             ^

    [javac]   return type Enumeration<? extends WMTreeNode> is not compatible with Enumeration<TreeNode>

    [javac] C:\WorkSpace\JAVA10\oswm\rel20.10_Patches\WorkManager\src\com\osm\ui\tree\WMTreeNode.java:163: error: method does not override or implement a method from a supertype

    [javac]     @Override

    [javac]     ^


    [javac]                           ^

    [javac] C:\WorkSpace\JAVA10\oswm\rel20.10_Patches\WorkManager\src\com\osm\ui\tree\WMTreeNode.java:298: error: no suitable method found for sort(Vector<TreeNode>)

    [javac]             Collections.sort(children);



WMTreeNode正在延伸javax.swing.tree.DefaultMutableTreeNode


MYYA
浏览 146回答 1
1回答
随时随地看视频慕课网APP

相关分类

Java
我要回答