From b2abe22c97e0c588f7a5f68e970dbc78f87c6b29 Mon Sep 17 00:00:00 2001 From: michelou Date: Tue, 29 Jun 2010 14:00:36 +0000 Subject: removed warnings (deprecation,unchecked) --- .../scala/tools/nsc/doc/model/Entity.scala | 38 ++++++++++++---------- .../scala/tools/nsc/interpreter/Completion.scala | 9 +++-- .../nsc/symtab/classfile/ClassfileParser.scala | 2 +- .../tools/nsc/transform/SpecializeTypes.scala | 10 +++--- 4 files changed, 33 insertions(+), 26 deletions(-) (limited to 'src/compiler') 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("<") // , , 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, -- cgit v1.2.3