我怎样才能使以下工作:
class Foo extends javax.swing.undo.UndoManager {
// increase visibility - works for method
override def editToBeUndone: javax.swing.undo.UndoableEdit = super.editToBeUndone
// fails for field
def edits: java.util.Vector[javax.swing.undo.UndoableEdit] = super.edits
}
请注意,这edits
是CompoundEdit
(的超类UndoManager
)中的受保护字段。我希望有一个同名的公共访问器来读取该字段。我该怎么做?
<console>:8: error: super may be not be used on variable edits
def edits: java.util.Vector[javax.swing.undo.UndoableEdit] = super.edits
^