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/compiler/scala/tools/nsc/javac | |
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/compiler/scala/tools/nsc/javac')
-rw-r--r-- | src/compiler/scala/tools/nsc/javac/JavaScanners.scala | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala index c600f6364b..ed5ebb1a01 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala @@ -63,7 +63,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { var errpos: ScanPosition var lastPos: ScanPosition def skipToken: ScanPosition - def nextToken: Unit + def nextToken(): Unit def next: AbstractJavaTokenData def intVal(negated: Boolean): Long def floatVal(negated: Boolean): Double @@ -282,7 +282,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { p - 1 } - def nextToken { + def nextToken() { if (next.token == EMPTY) { fetchToken() } @@ -648,7 +648,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { // Identifiers --------------------------------------------------------------- - private def getIdentRest { + private def getIdentRest() { while (true) { (in.ch: @switch) match { case 'A' | 'B' | 'C' | 'D' | 'E' | @@ -734,7 +734,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { /** read fractional part and exponent of floating point number * if one is present. */ - protected def getFraction { + protected def getFraction() { token = DOUBLELIT while ('0' <= in.ch && in.ch <= '9') { putChar(in.ch) @@ -823,7 +823,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { } /** read a number into name and set base */ - protected def getNumber { + protected def getNumber() { while (digit2int(in.ch, if (base < 10) 10 else base) >= 0) { putChar(in.ch) in.next @@ -905,7 +905,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { /** INIT: read lookahead character and token. */ - def init { + def init() { in.next nextToken } |