gpt4 book ai didi

Scala编译器编译报错JComboBox类型参数

转载 作者:行者123 更新时间:2023-12-01 11:55:03 26 4
gpt4 key购买 nike

所以我正在尝试编译 scala 编译器,为了完成这项工作我已经克服了很多问题,但我目前停留在 quick.lib

这非常令人困惑,因为源代码直接来自 Scala 团队本身,所以我知道它应该编译。还采用了我知道在其他地方编译的旧版本并对其进行了测试,但得到了同样的错误。

如能就此问题提供任何帮助或指出正确方向,我们将不胜感激。

quick.lib:
[scalacfork] Compiling 103 files to C:\programming\scala\build\quick\classes\library
[scalacfork] C:\programming\scala\src\swing\scala\swing\ComboBox.scala:162: error: class JComboBox takes type parameters
[scalacfork] override lazy val peer: JComboBox = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ComboBox.scala:123: error: trait ComboBoxModel takes type parameters
[scalacfork] def newConstantModel[A](items: Seq[A]): ComboBoxModel = {
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ComboBox.scala:124: error: trait ComboBoxModel takes type parameters
[scalacfork] new AbstractListModel with ComboBoxModel {
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ComboBox.scala:134: error: type mismatch;
[scalacfork] found : AnyRef
[scalacfork] required: Nothing
[scalacfork] def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ComboBox.scala:162: error: too many arguments for constructor Object: ()Object
[scalacfork] override lazy val peer: JComboBox = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:32: error: trait ListCellRenderer takes type parameters
[scalacfork] def wrap[A](r: ListCellRenderer): Renderer[A] = new Wrapped[A](r)
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:27: error: class JList takes type parameters
[scalacfork] def wrap[A](c: JList) = new ListView[A] {
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:145: error: class JList takes type parameters
[scalacfork] override lazy val peer: JList = new JList with SuperMixin
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:37: error: trait ListCellRenderer takes type parameters
[scalacfork] class Wrapped[A](override val peer: ListCellRenderer) extends Renderer[A] {
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:72: error: trait ListCellRenderer takes type parameters
[scalacfork] def peer: ListCellRenderer = new ListCellRenderer {
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:72: error: trait ListCellRenderer takes type parameters
[scalacfork] def peer: ListCellRenderer = new ListCellRenderer {
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:73: error: class JList takes type parameters
[scalacfork] def getListCellRendererComponent(list: JList, a: Any, index: Int, isSelected: Boolean, focused: Boolean) =
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:126: error: trait ListCellRenderer takes type parameters
[scalacfork] override lazy val peer: ListCellRenderer = new DefaultListCellRenderer
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:153: error: type mismatch;
[scalacfork] found : AnyRef
[scalacfork] required: Nothing
[scalacfork] def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
[scalacfork] ^
[scalacfork] C:\programming\scala\src\swing\scala\swing\ListView.scala:195: error: too many arguments for constructor Object: ()Object
[scalacfork] object indices extends Indices(peer.getSelectedIndices) {
[scalacfork] ^
[scalacfork] 15 errors found

最佳答案

您使用的是 JDK7 吗? “问题”之一是 JDK7 向某些 Swing API 添加了泛型,这与 scala 的工作方式不兼容。使用 JDK6 会有所帮助。

有关此内容的更多信息,请访问:https://groups.google.com/d/topic/scala-user/01CszZu8ga4/discussion

关于Scala编译器编译报错JComboBox类型参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8068119/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com