从PrimeFaces 10.0.0到11.0.0的变化是否使Treenode成为原始类型?
现在,当我定义一个treenode列表时,例如:
list node = elethnode.getChildren();
我收到两个警告。
对于左侧:“ treenode是一种原始类型。对右侧的通用类型treeNode的引用应为“参数化”
:“类型安全:类型列表的表达式需要不受检查的转换以符合列表以列出列表“
这也会引起代码破坏问题尝试使用for循环以迭代这样的列表时:
for(treenode loopingNode:node.getChildren()) { ... }
我收到一个实际错误:“类型不匹配:无法从元素类型对象转换为treenode”
这些问题仅在从PrimeFaces 10.0.0升级到PrimeFaces 11.0.0时才提出。为什么会这?我已经浏览了迁移指南(
Now, when I define a TreeNode List such as:
List node = otherNode.getChildren();
I get two warnings.
For the left side: "TreeNode is a raw type. References to generic type TreeNode should be parameterized"
For the right side: "Type safety: The expression of type List needs unchecked conversion to conform to List"
This also creates a code breaking issue when trying to use a for loop to iterate though the list like this:
for(TreeNode loopingNode : node.getChildren())
{
...
}
I receive an actual error: "Type mismatch: cannot convert from element type Object to TreeNode"
These issues were only raised when upgrading from PrimeFaces 10.0.0 to PrimeFaces 11.0.0. Why would this be? I have looked through the migration guide (https://primefaces.github.io/primefaces/11_0_0/#/../migrationguide/11_0_0), but I do not think I see anything about this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。请参阅:
在11.0.0 RC 1中添加了这一点。我将在迁移指南中添加注释。
Yes. See:
This was added in 11.0.0 RC 1. I'll add a note to the migration guide.