diff options
author | Paul Phillips <paulp@improving.org> | 2011-04-28 16:26:05 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-04-28 16:26:05 +0000 |
commit | c5d9b7e6a99f253d6da941610c58d9d9e1a02925 (patch) | |
tree | 461c02007998ff775201b6860843b555f4ae3bfc /src/swing | |
parent | 199ec3c10fe7d2b2029ea8ae6a19240b46181435 (diff) | |
download | scala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.tar.gz scala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.tar.bz2 scala-c5d9b7e6a99f253d6da941610c58d9d9e1a02925.zip |
I wrote a warning when nullary methods return U...
I wrote a warning when nullary methods return Unit. I wimped out of
including it in this patch because we had about 200 of them, and that's
what is fixed in this patch. I will add the warning to some kind of
"-Xlint" feature after 2.9.
This is motivated at least partly by the resolution of #4506, which
indicates the distinction between "def foo()" and "def foo" will
continue to jab its pointy stick into our eyes, so I believe we have a
minimal duty of at least following our own advice about what they mean
and not making a semirandom choice as to whether a method has parens or
not. Review by community.
Diffstat (limited to 'src/swing')
-rw-r--r-- | src/swing/scala/swing/Component.scala | 2 | ||||
-rw-r--r-- | src/swing/scala/swing/Container.scala | 2 | ||||
-rw-r--r-- | src/swing/scala/swing/MainFrame.scala | 2 | ||||
-rw-r--r-- | src/swing/scala/swing/Publisher.scala | 2 | ||||
-rw-r--r-- | src/swing/scala/swing/TextField.scala | 4 | ||||
-rw-r--r-- | src/swing/scala/swing/UIElement.scala | 4 |
6 files changed, 8 insertions, 8 deletions
diff --git a/src/swing/scala/swing/Component.scala b/src/swing/scala/swing/Component.scala index fc4936cfde..5eaff35bb0 100644 --- a/src/swing/scala/swing/Component.scala +++ b/src/swing/scala/swing/Component.scala @@ -200,7 +200,7 @@ abstract class Component extends UIElement { def requestFocusInWindow() = peer.requestFocusInWindow() def hasFocus: Boolean = peer.isFocusOwner - protected override def onFirstSubscribe { + protected override def onFirstSubscribe() { super.onFirstSubscribe // TODO: deprecated, remove after 2.8 peer.addComponentListener(new java.awt.event.ComponentListener { diff --git a/src/swing/scala/swing/Container.scala b/src/swing/scala/swing/Container.scala index 562d91243c..b39bfe0f5d 100644 --- a/src/swing/scala/swing/Container.scala +++ b/src/swing/scala/swing/Container.scala @@ -25,7 +25,7 @@ object Container { def contents: Seq[Component] = _contents protected class Content extends BufferWrapper[Component] { - override def clear { peer.removeAll() } + override def clear() { peer.removeAll() } override def remove(n: Int): Component = { val c = peer.getComponent(n) peer.remove(n) diff --git a/src/swing/scala/swing/MainFrame.scala b/src/swing/scala/swing/MainFrame.scala index 299f7b9293..e8b276e7fe 100644 --- a/src/swing/scala/swing/MainFrame.scala +++ b/src/swing/scala/swing/MainFrame.scala @@ -17,5 +17,5 @@ import event._ * framework and quits the application when closed. */ class MainFrame extends Frame { - override def closeOperation { sys.exit(0) } + override def closeOperation() { sys.exit(0) } } diff --git a/src/swing/scala/swing/Publisher.scala b/src/swing/scala/swing/Publisher.scala index ebab00463a..3c3e99fc49 100644 --- a/src/swing/scala/swing/Publisher.scala +++ b/src/swing/scala/swing/Publisher.scala @@ -111,7 +111,7 @@ private[swing] trait SingleRefCollection[+A <: AnyRef] extends Iterable[A] { sel private val elems = self.underlying.iterator private var hd: A = _ private var ahead: Boolean = false - private def skip: Unit = + private def skip(): Unit = while (!ahead && elems.hasNext) { // make sure we have a reference to the next element, // otherwise it might be garbage collected diff --git a/src/swing/scala/swing/TextField.scala b/src/swing/scala/swing/TextField.scala index f04e122fb9..789a8f49a5 100644 --- a/src/swing/scala/swing/TextField.scala +++ b/src/swing/scala/swing/TextField.scala @@ -47,7 +47,7 @@ class TextField(text0: String, columns0: Int) extends TextComponent with TextCom publish(EditDone(TextField.this)) } - protected override def onFirstSubscribe { + protected override def onFirstSubscribe() { super.onFirstSubscribe peer.addActionListener(actionListener) peer.addFocusListener(new FocusAdapter { @@ -55,7 +55,7 @@ class TextField(text0: String, columns0: Int) extends TextComponent with TextCom }) } - protected override def onLastUnsubscribe { + protected override def onLastUnsubscribe() { super.onLastUnsubscribe peer.removeActionListener(actionListener) } diff --git a/src/swing/scala/swing/UIElement.scala b/src/swing/scala/swing/UIElement.scala index 8e34b0c38c..38bc6308fd 100644 --- a/src/swing/scala/swing/UIElement.scala +++ b/src/swing/scala/swing/UIElement.scala @@ -119,7 +119,7 @@ trait UIElement extends Proxy with LazyPublisher { def ignoreRepaint: Boolean = peer.getIgnoreRepaint def ignoreRepaint_=(b: Boolean) { peer.setIgnoreRepaint(b) } - protected def onFirstSubscribe { + protected def onFirstSubscribe() { peer.addComponentListener(new java.awt.event.ComponentListener { def componentHidden(e: java.awt.event.ComponentEvent) { publish(UIElementHidden(UIElement.this)) @@ -135,5 +135,5 @@ trait UIElement extends Proxy with LazyPublisher { } }) } - protected def onLastUnsubscribe {} + protected def onLastUnsubscribe() {} } |