我正在尝试编译scala编译器,我已经克服了许多问题,但我目前被困在quick.lib
这是非常令人困惑的,因为源代码直接来自scala团队自己,所以我知道它应该编译。还采用了一个旧版本,我知道在其他地方编译和测试,但得到相同的错误。
在这个问题上的任何帮助或指出正确的方向将不胜感激。
quick.lib:
[scalacfork] Compiling 103 files to C:programmingscalabuildquickclasseslibrary
[scalacfork] C:programmingscalasrcswingscalaswingComboBox.scala:162: error: class JComboBox takes type parameters
[scalacfork] override lazy val peer: JComboBox = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingComboBox.scala:123: error: trait ComboBoxModel takes type parameters
[scalacfork] def newConstantModel[A](items: Seq[A]): ComboBoxModel = {
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingComboBox.scala:124: error: trait ComboBoxModel takes type parameters
[scalacfork] new AbstractListModel with ComboBoxModel {
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingComboBox.scala:134: error: type mismatch;
[scalacfork] found : AnyRef
[scalacfork] required: Nothing
[scalacfork] def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingComboBox.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:programmingscalasrcswingscalaswingListView.scala:32: error: trait ListCellRenderer takes type parameters
[scalacfork] def wrap[A](r: ListCellRenderer): Renderer[A] = new Wrapped[A](r)
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.scala:27: error: class JList takes type parameters
[scalacfork] def wrap[A](c: JList) = new ListView[A] {
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.scala:145: error: class JList takes type parameters
[scalacfork] override lazy val peer: JList = new JList with SuperMixin
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.scala:37: error: trait ListCellRenderer takes type parameters
[scalacfork] class Wrapped[A](override val peer: ListCellRenderer) extends Renderer[A] {
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.scala:72: error: trait ListCellRenderer takes type parameters
[scalacfork] def peer: ListCellRenderer = new ListCellRenderer {
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.scala:72: error: trait ListCellRenderer takes type parameters
[scalacfork] def peer: ListCellRenderer = new ListCellRenderer {
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.scala:73: error: class JList takes type parameters
[scalacfork] def getListCellRendererComponent(list: JList, a: Any, index: Int, isSelected: Boolean, focused: Boolean) =
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.scala:126: error: trait ListCellRenderer takes type parameters
[scalacfork] override lazy val peer: ListCellRenderer = new DefaultListCellRenderer
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.scala:153: error: type mismatch;
[scalacfork] found : AnyRef
[scalacfork] required: Nothing
[scalacfork] def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
[scalacfork] ^
[scalacfork] C:programmingscalasrcswingscalaswingListView.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