Blame SOURCES/scala-2.10.2-java7.patch

3eaa5a
diff -up scala-2.10.0-RC3-sources/src/swing/scala/swing/ComboBox.scala.jdk7 scala-2.10.0-RC3-sources/src/swing/scala/swing/ComboBox.scala
3eaa5a
--- scala-2.10.0-RC3-sources/src/swing/scala/swing/ComboBox.scala.jdk7	2012-11-05 02:49:19.000000000 +0100
3eaa5a
+++ scala-2.10.0-RC3-sources/src/swing/scala/swing/ComboBox.scala	2012-12-07 23:29:32.821949227 +0100
3eaa5a
@@ -9,7 +9,7 @@
3eaa5a
 package scala.swing
3eaa5a
 
3eaa5a
 import event._
3eaa5a
-import javax.swing.{JList, JComponent, JComboBox, JTextField, ComboBoxModel, AbstractListModel, ListCellRenderer}
3eaa5a
+import javax.swing.{ JComponent, JComboBox, JTextField, ComboBoxModel, AbstractListModel, ListCellRenderer }
3eaa5a
 import java.awt.event.ActionListener
3eaa5a
 
3eaa5a
 object ComboBox {
3eaa5a
@@ -118,10 +118,10 @@ object ComboBox {
3eaa5a
   implicit def floatEditor(c: ComboBox[Float]): Editor[Float] = new BuiltInEditor(c)(s => s.toFloat, s => s.toString)
3eaa5a
   implicit def doubleEditor(c: ComboBox[Double]): Editor[Double] = new BuiltInEditor(c)(s => s.toDouble, s => s.toString)
3eaa5a
 
3eaa5a
-  def newConstantModel[A](items: Seq[A]): ComboBoxModel = {
3eaa5a
-    new AbstractListModel with ComboBoxModel {
3eaa5a
+  def newConstantModel[A](items: Seq[A]): ComboBoxModel[A] = {
3eaa5a
+    new AbstractListModel[A] with ComboBoxModel[A] {
3eaa5a
       private var selected: A = if (items.isEmpty) null.asInstanceOf[A] else items(0)
3eaa5a
-      def getSelectedItem: AnyRef = selected.asInstanceOf[AnyRef]
3eaa5a
+      def getSelectedItem = selected.asInstanceOf[AnyRef]
3eaa5a
       def setSelectedItem(a: Any) {
3eaa5a
         if ((selected != null && selected != a) ||
3eaa5a
             selected == null && a != null) {
3eaa5a
@@ -129,7 +129,7 @@ object ComboBox {
3eaa5a
           fireContentsChanged(this, -1, -1)
3eaa5a
         }
3eaa5a
       }
3eaa5a
-      def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
3eaa5a
+      def getElementAt(n: Int) = items(n).asInstanceOf[A]
3eaa5a
       def getSize = items.size
3eaa5a
     }
3eaa5a
   }
3eaa5a
@@ -157,7 +157,7 @@ object ComboBox {
3eaa5a
  * @see javax.swing.JComboBox
3eaa5a
  */
3eaa5a
 class ComboBox[A](items: Seq[A]) extends Component with Publisher {
3eaa5a
-  override lazy val peer: JComboBox = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
3eaa5a
+  override lazy val peer: JComboBox[A] = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
3eaa5a
 
3eaa5a
   object selection extends Publisher {
3eaa5a
     def index: Int = peer.getSelectedIndex
3eaa5a
@@ -182,7 +182,8 @@ class ComboBox[A](items: Seq[A]) extends
3eaa5a
    * of the component to its own defaults _after_ the renderer has been
3eaa5a
    * configured. That's Swing's principle of most suprise.
3eaa5a
    */
3eaa5a
-  def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getRenderer)
3eaa5a
+  def renderer: ListView.Renderer[A] = ListView.Renderer.wrap[A](peer.getRenderer.asInstanceOf[ListCellRenderer[A]])
3eaa5a
+  // def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getRenderer)
3eaa5a
   def renderer_=(r: ListView.Renderer[A]) { peer.setRenderer(r.peer) }
3eaa5a
 
3eaa5a
   /* XXX: currently not safe to expose:
3eaa5a
@@ -201,8 +202,8 @@ class ComboBox[A](items: Seq[A]) extends
3eaa5a
     peer.setEditor(editor(this).comboBoxPeer)
3eaa5a
   }
3eaa5a
 
3eaa5a
-  def prototypeDisplayValue: Option[A] = toOption[A](peer.getPrototypeDisplayValue)
3eaa5a
+  def prototypeDisplayValue: Option[A] = Option(peer.getPrototypeDisplayValue)
3eaa5a
   def prototypeDisplayValue_=(v: Option[A]) {
3eaa5a
-    peer.setPrototypeDisplayValue((v map toAnyRef).orNull)
3eaa5a
+    peer.setPrototypeDisplayValue((v map toAnyRef).orNull.asInstanceOf[A])
3eaa5a
   }
3eaa5a
 }
3eaa5a
diff -up scala-2.10.0-RC3-sources/src/swing/scala/swing/ListView.scala.jdk7 scala-2.10.0-RC3-sources/src/swing/scala/swing/ListView.scala
3eaa5a
--- scala-2.10.0-RC3-sources/src/swing/scala/swing/ListView.scala.jdk7	2012-11-05 02:49:19.000000000 +0100
3eaa5a
+++ scala-2.10.0-RC3-sources/src/swing/scala/swing/ListView.scala	2012-12-07 22:58:13.267919851 +0100
3eaa5a
@@ -24,21 +24,21 @@ object ListView {
3eaa5a
     val MultiInterval = Value(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
3eaa5a
   }
3eaa5a
 
3eaa5a
-  def wrap[A](c: JList) = new ListView[A] {
3eaa5a
+  def wrap[A](c: JList[A]) = new ListView[A] {
3eaa5a
     override lazy val peer = c
3eaa5a
   }
3eaa5a
 
3eaa5a
   object Renderer {
3eaa5a
-    def wrap[A](r: ListCellRenderer): Renderer[A] = new Wrapped[A](r)
3eaa5a
+    def wrap[A](r: ListCellRenderer[A]): Renderer[A] = new Wrapped[A](r)
3eaa5a
 
3eaa5a
     /**
3eaa5a
      * Wrapper for javax.swing.ListCellRenderers
3eaa5a
      */
3eaa5a
-  	class Wrapped[A](override val peer: ListCellRenderer) extends Renderer[A] {
3eaa5a
-  	  def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int) = {
3eaa5a
+      class Wrapped[A](override val peer: ListCellRenderer[A]) extends Renderer[A] {
3eaa5a
+        def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int) = {
3eaa5a
         Component.wrap(peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused).asInstanceOf[JComponent])
3eaa5a
+        }
3eaa5a
       }
3eaa5a
-  	}
3eaa5a
 
3eaa5a
     /**
3eaa5a
      * Returns a renderer for items of type A. The given function
3eaa5a
@@ -55,8 +55,8 @@ object ListView {
3eaa5a
      * 
3eaa5a
      */
3eaa5a
     def apply[A,B](f: A => B)(implicit renderer: Renderer[B]): Renderer[A] = new Renderer[A] {
3eaa5a
-      def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component =
3eaa5a
-        renderer.componentFor(list, isSelected, focused, f(a), index)
3eaa5a
+      def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component =
3eaa5a
+        renderer.componentFor(list.asInstanceOf[ListView[_ <: B]], isSelected, focused, f(a), index)
3eaa5a
     }
3eaa5a
   }
3eaa5a
 
3eaa5a
@@ -69,11 +69,11 @@ object ListView {
3eaa5a
    * @see javax.swing.ListCellRenderer
3eaa5a
    */
3eaa5a
   abstract class Renderer[-A] {
3eaa5a
-    def peer: ListCellRenderer = new ListCellRenderer {
3eaa5a
-      def getListCellRendererComponent(list: JList, a: Any, index: Int, isSelected: Boolean, focused: Boolean) =
3eaa5a
-        componentFor(ListView.wrap[A](list), isSelected, focused, a.asInstanceOf[A], index).peer
3eaa5a
+    def peer: ListCellRenderer[_ >: A] = new ListCellRenderer[A] {
3eaa5a
+      def getListCellRendererComponent(list: JList[_ <: A], a: A, index: Int, isSelected: Boolean, focused: Boolean) =
3eaa5a
+        componentFor(ListView.wrap[A](list.asInstanceOf[JList[A]]), isSelected, focused, a, index).peer
3eaa5a
     }
3eaa5a
-    def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component
3eaa5a
+    def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component
3eaa5a
   }
3eaa5a
 
3eaa5a
   /**
3eaa5a
@@ -110,7 +110,7 @@ object ListView {
3eaa5a
     /**
3eaa5a
      * Configures the component before returning it.
3eaa5a
      */
3eaa5a
-    def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component = {
3eaa5a
+    def componentFor(list: ListView[_ <: A], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component = {
3eaa5a
       preConfigure(list, isSelected, focused, a, index)
3eaa5a
       configure(list, isSelected, focused, a, index)
3eaa5a
       component
3eaa5a
@@ -123,10 +123,10 @@ object ListView {
3eaa5a
    * that renders the string returned from an item's toString.
3eaa5a
    */
3eaa5a
   implicit object GenericRenderer extends Renderer[Any] {
3eaa5a
-    override lazy val peer: ListCellRenderer = new DefaultListCellRenderer
3eaa5a
-    def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: Any, index: Int): Component = {
3eaa5a
-      val c = peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused).asInstanceOf[JComponent]
3eaa5a
-      Component.wrap(c)
3eaa5a
+    override lazy val peer: ListCellRenderer[Any] = (new DefaultListCellRenderer).asInstanceOf[ListCellRenderer[Any]]
3eaa5a
+    def componentFor(list: ListView[_ <: Any], isSelected: Boolean, focused: Boolean, a: Any, index: Int): Component = {
3eaa5a
+      val c = peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused)
3eaa5a
+      Component.wrap(c.asInstanceOf[JComponent])
3eaa5a
     }
3eaa5a
   }
3eaa5a
 }
3eaa5a
@@ -142,34 +142,34 @@ object ListView {
3eaa5a
  */
3eaa5a
 class ListView[A] extends Component {
3eaa5a
   import ListView._
3eaa5a
-  override lazy val peer: JList = new JList with SuperMixin
3eaa5a
+  override lazy val peer: JList[A] = new JList[A] with SuperMixin
3eaa5a
 
3eaa5a
   def this(items: Seq[A]) = {
3eaa5a
     this()
3eaa5a
     listData = items
3eaa5a
   }
3eaa5a
 
3eaa5a
-  protected class ModelWrapper(val items: Seq[A]) extends AbstractListModel {
3eaa5a
-    def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
3eaa5a
+  protected class ModelWrapper[A](val items: Seq[A]) extends AbstractListModel[A] {
3eaa5a
+    def getElementAt(n: Int) = items(n)
3eaa5a
     def getSize = items.size
3eaa5a
   }
3eaa5a
 
3eaa5a
   def listData: Seq[A] = peer.getModel match {
3eaa5a
-    case model: ModelWrapper => model.items
3eaa5a
-    case model @ _ => new Seq[A] { selfSeq =>
3eaa5a
+    case model: ModelWrapper[a] => model.items
3eaa5a
+    case model => new Seq[A] { selfSeq =>
3eaa5a
      def length = model.getSize
3eaa5a
      def iterator = new Iterator[A] {
3eaa5a
        var idx = 0
3eaa5a
        def next = { idx += 1; apply(idx-1) }
3eaa5a
        def hasNext = idx < selfSeq.length
3eaa5a
      }
3eaa5a
-     def apply(n: Int) = model.getElementAt(n).asInstanceOf[A]
3eaa5a
+     def apply(n: Int): A = model.getElementAt(n)
3eaa5a
     }
3eaa5a
   }
3eaa5a
 
3eaa5a
   def listData_=(items: Seq[A]) {
3eaa5a
-    peer.setModel(new AbstractListModel {
3eaa5a
-      def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
3eaa5a
+    peer.setModel(new AbstractListModel[A] {
3eaa5a
+      def getElementAt(n: Int) = items(n)
3eaa5a
       def getSize = items.size
3eaa5a
     })
3eaa5a
   }
3eaa5a
@@ -216,7 +216,7 @@ class ListView[A] extends Component {
3eaa5a
     def adjusting = peer.getSelectionModel.getValueIsAdjusting
3eaa5a
   }
3eaa5a
 
3eaa5a
-  def renderer: ListView.Renderer[A] = ListView.Renderer.wrap(peer.getCellRenderer)
3eaa5a
+  def renderer: ListView.Renderer[A] = ListView.Renderer.wrap[A](peer.getCellRenderer.asInstanceOf[ListCellRenderer[A]])
3eaa5a
   def renderer_=(r: ListView.Renderer[A]) { peer.setCellRenderer(r.peer) }
3eaa5a
 
3eaa5a
   def fixedCellWidth = peer.getFixedCellWidth