diff options
author | michelou <michelou@epfl.ch> | 2010-06-29 14:00:36 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2010-06-29 14:00:36 +0000 |
commit | b2abe22c97e0c588f7a5f68e970dbc78f87c6b29 (patch) | |
tree | d075a2e3f720a5d6ef6216239f7d9c4e97c6bac5 /src | |
parent | 1067f5f55ca0de0035fee3d0179203801f0b4b87 (diff) | |
download | scala-b2abe22c97e0c588f7a5f68e970dbc78f87c6b29.tar.gz scala-b2abe22c97e0c588f7a5f68e970dbc78f87c6b29.tar.bz2 scala-b2abe22c97e0c588f7a5f68e970dbc78f87c6b29.zip |
removed warnings (deprecation,unchecked)
Diffstat (limited to 'src')
12 files changed, 59 insertions, 43 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/model/Entity.scala b/src/compiler/scala/tools/nsc/doc/model/Entity.scala index d0ce44c3f2..f36f560777 100644 --- a/src/compiler/scala/tools/nsc/doc/model/Entity.scala +++ b/src/compiler/scala/tools/nsc/doc/model/Entity.scala @@ -20,10 +20,12 @@ trait Entity { } -/** A class, trait, object or package. A package is represented as an instance of the `Package` subclass. A class, - * trait, object or package may be directly an instance of `WeakTemplateEntity` if it is not ''documentable'' (that - * is, if there is no documentation page for it in the current site), otherwise, it will be represented as an instance - * of the `TemplateEntity` subclass. */ +/** A class, trait, object or package. A package is represented as an instance + * of the `Package` subclass. A class, trait, object or package may be + * directly an instance of `WeakTemplateEntity` if it is not ''documentable'' + * (that is, if there is no documentation page for it in the current site), + * otherwise, it will be represented as an instance of the `TemplateEntity` + * subclass. */ trait TemplateEntity extends Entity { def isPackage: Boolean def isRootPackage: Boolean @@ -59,8 +61,8 @@ trait MemberEntity extends Entity { def isTemplate: Boolean } -/** A ''documentable'' class, trait or object (that is, a documentation page will be generated for it in the current - * site). */ +/** A ''documentable'' class, trait or object (that is, a documentation page + * will be generated for it in the current site). */ trait DocTemplateEntity extends TemplateEntity with MemberEntity { def toRoot: List[DocTemplateEntity] def inSource: Option[(io.AbstractFile, Int)] @@ -110,7 +112,8 @@ trait Class extends Trait { /** A ''documentable'' object. */ trait Object extends DocTemplateEntity -/** A package that contains at least one ''documentable'' class, trait, object or package. */ +/** A package that contains at least one ''documentable'' class, trait, + * object or package. */ trait Package extends Object { def inTemplate: Package def toRoot: List[Package] @@ -135,7 +138,8 @@ trait Constructor extends NonTemplateMemberEntity { def valueParams : List[List[ValueParam]] } -/** A value (`val`), lazy val (`lazy val`) or variable (`var`) of a ''documentable'' class, trait or object. */ +/** A value (`val`), lazy val (`lazy val`) or variable (`var`) of a + * ''documentable'' class, trait or object. */ trait Val extends NonTemplateMemberEntity /** An abstract type of a ''documentable'' class, trait or object. */ @@ -178,26 +182,26 @@ sealed trait Visibility { } /** The visibility of `private[this]` members. */ -case class PrivateInInstance extends Visibility +case class PrivateInInstance() extends Visibility /** The visibility of `protected[this]` members. */ -case class ProtectedInInstance extends Visibility { +case class ProtectedInInstance() extends Visibility { override def isProtected = true } -/** The visibility of `private[owner]` members. An unqualified private members is encoded with `owner` equal to the - * members's `inTemplate`. */ +/** The visibility of `private[owner]` members. An unqualified private members + * is encoded with `owner` equal to the members's `inTemplate`. */ case class PrivateInTemplate(owner: TemplateEntity) extends Visibility -/** The visibility of `protected[owner]` members. An unqualified protected members is encoded with `owner` equal to the - * members's `inTemplate`. - * Note that whilst the member is visible in any template owned by `owner`, it is only visible in subclasses of the - * member's `inTemplate`. */ +/** The visibility of `protected[owner]` members. An unqualified protected + * members is encoded with `owner` equal to the members's `inTemplate`. + * Note that whilst the member is visible in any template owned by `owner`, + * it is only visible in subclasses of the member's `inTemplate`. */ case class ProtectedInTemplate(owner: TemplateEntity) extends Visibility { override def isProtected = true } /** The visibility of public members. */ -case class Public extends Visibility { +case class Public() extends Visibility { override def isPublic = true } diff --git a/src/compiler/scala/tools/nsc/interpreter/Completion.scala b/src/compiler/scala/tools/nsc/interpreter/Completion.scala index c163960f86..22a95a4bf8 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Completion.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Completion.scala @@ -100,10 +100,12 @@ class Completion(val repl: Interpreter) extends CompletionOutput { def imported(tp: Type) = new ImportCompletion(tp) } - class TypeMemberCompletion(val tp: Type) extends CompletionAware with CompilerCompletion { + class TypeMemberCompletion(val tp: Type) extends CompletionAware + with CompilerCompletion { def excludeEndsWith: List[String] = Nil def excludeStartsWith: List[String] = List("<") // <byname>, <repeated>, etc. - def excludeNames: List[String] = anyref.methodNames -- anyRefMethodsToShow ++ List("_root_") + def excludeNames: List[String] = + anyref.methodNames.filterNot(anyRefMethodsToShow contains) ++ List("_root_") def methodSignatureString(sym: Symbol) = { def asString = new MethodSymbolOutput(sym).methodString() @@ -298,7 +300,8 @@ class Completion(val repl: Interpreter) extends CompletionOutput { private var lastCursor: Int = -1 // Does this represent two consecutive tabs? - def isConsecutiveTabs(buf: String, cursor: Int) = cursor == lastCursor && buf == lastBuf + def isConsecutiveTabs(buf: String, cursor: Int) = + cursor == lastCursor && buf == lastBuf // Longest common prefix def commonPrefix(xs: List[String]) = diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 9c382439bc..b7110b66df 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -386,7 +386,7 @@ abstract class ClassfileParser { val start = starts(index) if (in.buf(start).toInt != CONSTANT_UTF8) errorBadTag(start) val len = in.getChar(start + 1) - bytesBuffer ++= (in.buf, start + 3, len) + bytesBuffer ++= in.buf.view(start + 3, len) } val bytes = bytesBuffer.toArray val decodedLength = reflect.generic.ByteCodecs.decode(bytes) diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index d9b60b9ca1..1350ab3bb4 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -612,12 +612,12 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { if (settings.debug.value) log("normalizeMember: " + sym.fullName) if (sym.isMethod && !atPhase(currentRun.typerPhase)(sym.typeParams.isEmpty)) { var (stps, tps) = splitParams(sym.info.typeParams) - val unusedStvars = stps -- specializedTypeVars(sym.info).toList + val unusedStvars = stps filterNot (specializedTypeVars(sym.info).toList contains) if (unusedStvars.nonEmpty && currentRun.compiles(sym) && !sym.isSynthetic) { reporter.warning(sym.pos, "%s %s unused or used in non-specializable positions." .format(unusedStvars.mkString("", ", ", ""), if (unusedStvars.length == 1) "is" else "are")) unusedStvars foreach (_.removeAnnotation(SpecializedClass)) - stps = stps -- unusedStvars + stps = stps filterNot (unusedStvars contains) tps = tps ::: unusedStvars } val res = sym :: (for (env <- specializations(stps) if needsSpecialization(env, sym)) yield { @@ -644,8 +644,8 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } else List(sym) } - /** Specialize member `m' w.r.t. to the outer environment and the type parameters of - * the innermost enclosing class. + /** Specialize member `m' w.r.t. to the outer environment and the type + * parameters of the innermost enclosing class. * * Turns 'private' into 'protected' for members that need specialization. * @@ -714,7 +714,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { def checkOverriddenTParams(overridden: Symbol) { if (currentRun.compiles(overriding)) - for (val (baseTvar, derivedTvar) <- overridden.info.typeParams.zip(overriding.info.typeParams); + for ((baseTvar, derivedTvar) <- overridden.info.typeParams.zip(overriding.info.typeParams); val missing = missingSpecializations(baseTvar, derivedTvar) if missing.nonEmpty) reporter.error(derivedTvar.pos, diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala index 5d1a0997ed..b5a46f7018 100644 --- a/src/library/scala/Enumeration.scala +++ b/src/library/scala/Enumeration.scala @@ -52,7 +52,7 @@ private object Enumeration { * * <b>def</b> isWorkingDay(d: WeekDay) = ! (d == Sat || d == Sun) * - * WeekDay.iterator filter isWorkingDay foreach println + * WeekDay.values filter isWorkingDay foreach println * }</pre> * * @param initial The initial value from which to count the integers that diff --git a/src/library/scala/collection/mutable/BufferProxy.scala b/src/library/scala/collection/mutable/BufferProxy.scala index 7adbb8ee3f..5d2e7fd86d 100644 --- a/src/library/scala/collection/mutable/BufferProxy.scala +++ b/src/library/scala/collection/mutable/BufferProxy.scala @@ -125,16 +125,20 @@ trait BufferProxy[A] extends Buffer[A] with Proxy { * @param n the index where a new element will be inserted. * @param iter the iterable object providing all elements to insert. */ - def insertAll(n: Int, iter: scala.collection.Iterable[A]): Unit = self.insertAll(n, iter) + def insertAll(n: Int, iter: scala.collection.Iterable[A]) { + self.insertAll(n, iter) + } - override def insertAll(n: Int, iter: scala.collection.Traversable[A]): Unit = self.insertAll(n, iter) + override def insertAll(n: Int, iter: scala.collection.Traversable[A]) { + self.insertAll(n, iter) + } /** Replace element at index `n` with the new element `newelem`. * * @param n the index of the element to replace. * @param newelem the new element. */ - def update(n: Int, newelem: A): Unit = self.update(n, newelem) + def update(n: Int, newelem: A) { self.update(n, newelem) } /** Removes the element on a given index position. * diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala index e678f7fa5c..c791066398 100644 --- a/src/library/scala/collection/mutable/Stack.scala +++ b/src/library/scala/collection/mutable/Stack.scala @@ -62,7 +62,8 @@ class Stack[A] private (var elems: List[A]) extends scala.collection.Seq[A] with * @param elems the element sequence. * @return the stack with the new elements on top. */ - def push(elem1: A, elem2: A, elems: A*): this.type = this.push(elem1).push(elem2).pushAll(elems) + def push(elem1: A, elem2: A, elems: A*): this.type = + this.push(elem1).push(elem2).pushAll(elems) /** Push all elements in the given traversable object onto * the stack. The last element in the traversable object @@ -134,5 +135,5 @@ class Stack[A] private (var elems: List[A]) extends scala.collection.Seq[A] with // !!! TODO - integrate object Stack { - def apply[A](xs: A*): Stack[A] = new Stack[A] ++= xs + def apply[A](xs: A*): Stack[A] = new Stack[A] pushAll xs } diff --git a/src/library/scala/io/Source.scala b/src/library/scala/io/Source.scala index b5313ef61b..935fe022be 100644 --- a/src/library/scala/io/Source.scala +++ b/src/library/scala/io/Source.scala @@ -114,11 +114,13 @@ object Source { /** Create a <code>Source</code> from array of bytes, assuming * one byte per character (ISO-8859-1 encoding.) */ - def fromRawBytes(bytes: Array[Byte]): Source = fromString(new String(bytes, Codec.ISO8859.name)) + def fromRawBytes(bytes: Array[Byte]): Source = + fromString(new String(bytes, Codec.ISO8859.name)) /** creates <code>Source</code> from file with given file: URI */ - def fromURI(uri: URI)(implicit codec: Codec): BufferedSource = fromFile(new JFile(uri))(codec) + def fromURI(uri: URI)(implicit codec: Codec): BufferedSource = + fromFile(new JFile(uri))(codec) /** same as fromURL(new URL(s))(Codec(enc)) */ @@ -298,8 +300,9 @@ abstract class Source extends Iterator[Char] { def report(pos: Int, msg: String, out: PrintStream) { val line = Position line pos val col = Position column pos + val str = getLines() toIndexedSeq line - out println "%s:%d:%d: %s%s%s^".format(descr, line, col, msg, getLine(line), spaces(col - 1)) + out println "%s:%d:%d: %s%s%s^".format(descr, line, col, msg, str, spaces(col - 1)) } /** @@ -340,8 +343,9 @@ abstract class Source extends Iterator[Char] { } /** The close() method closes the underlying resource. */ - def close(): Unit = + def close() { if (closeFunction != null) closeFunction() + } /** The reset() method creates a fresh copy of this Source. */ def reset(): Source = diff --git a/src/library/scala/runtime/AnyValCompanion.scala b/src/library/scala/runtime/AnyValCompanion.scala index 0a6f93805a..0fba1cfd60 100644 --- a/src/library/scala/runtime/AnyValCompanion.scala +++ b/src/library/scala/runtime/AnyValCompanion.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id$ + package scala.runtime diff --git a/src/partest/scala/tools/partest/nest/Diff.java b/src/partest/scala/tools/partest/nest/Diff.java index f780712b6b..f69fc6858b 100644 --- a/src/partest/scala/tools/partest/nest/Diff.java +++ b/src/partest/scala/tools/partest/nest/Diff.java @@ -49,7 +49,7 @@ public class Diff { an edit script, if desired. */ public Diff(Object[] a,Object[] b) { - Hashtable h = new Hashtable(a.length + b.length); + Hashtable<Object, Integer> h = new Hashtable<Object, Integer>(a.length + b.length); filevec[0] = new file_data(a,h); filevec[1] = new file_data(b,h); } @@ -744,7 +744,7 @@ public class Diff { nondiscarded_lines = j; } - file_data(Object[] data,Hashtable h) { + file_data(Object[] data, Hashtable<Object, Integer> h) { buffered_lines = data.length; equivs = new int[buffered_lines]; @@ -752,9 +752,9 @@ public class Diff { realindexes = new int[buffered_lines]; for (int i = 0; i < data.length; ++i) { - Integer ir = (Integer)h.get(data[i]); + Integer ir = h.get(data[i]); if (ir == null) - h.put(data[i],new Integer(equivs[i] = equiv_max++)); + h.put(data[i], new Integer(equivs[i] = equiv_max++)); else equivs[i] = ir.intValue(); } diff --git a/src/partest/scala/tools/partest/nest/DiffPrint.java b/src/partest/scala/tools/partest/nest/DiffPrint.java index eeb0dd5a09..31f9a1bc79 100644 --- a/src/partest/scala/tools/partest/nest/DiffPrint.java +++ b/src/partest/scala/tools/partest/nest/DiffPrint.java @@ -505,7 +505,7 @@ public class DiffPrint { */ static String[] slurp(String file) throws IOException { BufferedReader rdr = new BufferedReader(new FileReader(file)); - Vector s = new Vector(); + Vector<String> s = new Vector<String>(); for (;;) { String line = rdr.readLine(); if (line == null) break; diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 7797c1095a..931bc5cc13 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -374,7 +374,7 @@ class Worker(val fileManager: FileManager) extends Actor { def isInGroup(f: File, num: Int) = SFile(f).stripExtension endsWith ("_" + num) val groups = (0 to 9).toList map (num => testFiles filter (f => isInGroup(f, num))) - val noGroupSuffix = testFiles -- groups.flatten + val noGroupSuffix = testFiles filterNot (groups.flatten contains) def compileGroup(g: List[File]) { val (scalaFiles, javaFiles) = g partition isScala |