removed warnings (deprecation,unchecked)

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@22418 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
michelou 2010-06-29 14:00:36 +00:00
parent f2269b0c12
commit 8ff71534fb
12 changed files with 78 additions and 62 deletions

View File

@ -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
}

View File

@ -78,20 +78,20 @@ class Completion(val repl: Interpreter) extends CompletionOutput {
def tos(sym: Symbol) = sym.name.decode.toString
def memberNamed(s: String) = members find (x => tos(x) == s)
def hasMethod(s: String) = methods exists (x => tos(x) == s)
// XXX we'd like to say "filterNot (_.isDeprecated)" but this causes the
// compiler to crash for reasons not yet known.
def members = (effectiveTp.nonPrivateMembers ++ anyMembers) filter (_.isPublic)
def methods = members filter (_.isMethod)
def packages = members filter (_.isPackage)
def aliases = members filter (_.isAliasType)
def memberNames = members map tos
def methodNames = methods map tos
def packageNames = packages map tos
def aliasNames = aliases map tos
}
object TypeMemberCompletion {
def apply(tp: Type): TypeMemberCompletion = {
if (tp.typeSymbol.isPackageClass) new PackageCompletion(tp)
@ -99,11 +99,13 @@ 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()
@ -264,7 +266,7 @@ class Completion(val repl: Interpreter) extends CompletionOutput {
val xs = lastResult completionsFor parsed
if (parsed.isEmpty) xs map ("." + _) else xs
}
// chasing down results which won't parse
def execute(line: String): Option[Any] = {
val parsed = Parsed(line)
@ -298,8 +300,9 @@ 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]) =
if (xs.isEmpty) ""

View File

@ -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)

View File

@ -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,

View File

@ -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

View File

@ -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.
*

View File

@ -42,10 +42,10 @@ class Stack[A] private (var elems: List[A]) extends scala.collection.Seq[A] with
* @return true, iff there is no element on the stack
*/
override def isEmpty: Boolean = elems.isEmpty
/** The number of elements in the stack */
override def length = elems.length
/** Retrieve n'th element from stack, where top of stack has index 0 */
override def apply(index: Int) = elems(index)
@ -55,15 +55,16 @@ class Stack[A] private (var elems: List[A]) extends scala.collection.Seq[A] with
* @return the stack with the new element on top.
*/
def push(elem: A): this.type = { elems = elem :: elems; this }
/** Push two or more elements onto the stack. The last element
* of the sequence will be on top of the new stack.
*
* @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
* will be on top of the new stack.
@ -121,10 +122,10 @@ class Stack[A] private (var elems: List[A]) extends scala.collection.Seq[A] with
*/
@migration(2, 8, "Stack iterator and foreach now traverse in FIFO order.")
override def toList: List[A] = elems
@migration(2, 8, "Stack iterator and foreach now traverse in FIFO order.")
override def foreach[U](f: A => U): Unit = super.foreach(f)
/** This method clones the stack.
*
* @return a stack with the same elements.
@ -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
}

View File

@ -107,19 +107,21 @@ object Source {
*/
def fromBytes(bytes: Array[Byte])(implicit codec: Codec): Source =
fromString(new String(bytes, codec.name))
def fromBytes(bytes: Array[Byte], enc: String): Source =
fromBytes(bytes)(Codec(enc))
/** 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))
*/
def fromURL(s: String, enc: String): BufferedSource =
@ -238,7 +240,7 @@ abstract class Source extends Iterator[Char] {
/** Returns next character.
*/
def next: Char = positioner.next
class Positioner {
/** the last character returned by next. */
var ch: Char = _
@ -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
out println "%s:%d:%d: %s%s%s^".format(descr, line, col, msg, getLine(line), spaces(col - 1))
val str = getLines() toIndexedSeq line
out println "%s:%d:%d: %s%s%s^".format(descr, line, col, msg, str, spaces(col - 1))
}
/**
@ -340,9 +343,10 @@ 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 =
if (resetFunction != null) resetFunction()

View File

@ -6,7 +6,7 @@
** |/ **
\* */
// $Id$
package scala.runtime

View File

@ -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();
}

View File

@ -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;

View File

@ -371,10 +371,10 @@ class Worker(val fileManager: FileManager) extends Actor {
def compileFilesIn(dir: File, kind: String, logFile: File, outDir: File) {
val testFiles = dir.listFiles.toList filter isJavaOrScala
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