From c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa Mon Sep 17 00:00:00 2001 From: michelou Date: Wed, 20 Jul 2011 21:52:50 +0000 Subject: 4th round of clean ups (see r25293, r25285, r25... 4th round of clean ups (see r25293, r25285, r25292) --- .../reflect/internal/ClassfileConstants.scala | 49 ++--- src/compiler/scala/tools/ant/FastScalac.scala | 52 +++--- src/compiler/scala/tools/ant/Pack200Task.scala | 29 ++- src/compiler/scala/tools/ant/Same.scala | 27 +-- src/compiler/scala/tools/ant/ScalaTool.scala | 58 +++--- src/compiler/scala/tools/ant/Scalac.scala | 208 ++++++++++----------- .../scala/tools/nsc/backend/ScalaPrimitives.scala | 38 ++-- src/library/scala/PartialFunction.scala | 32 ++-- src/library/scala/collection/Iterator.scala | 15 +- .../scala/collection/immutable/StringLike.scala | 70 +++---- .../scala/collection/mutable/OpenHashMap.scala | 136 +++++++------- src/library/scala/reflect/NoManifest.scala | 4 +- src/library/scala/runtime/RichBoolean.scala | 2 +- src/library/scala/runtime/RichByte.scala | 2 +- src/library/scala/runtime/RichDouble.scala | 3 +- src/library/scala/runtime/RichException.scala | 2 - src/library/scala/runtime/RichInt.scala | 22 ++- .../scala/util/parsing/combinator/Parsers.scala | 62 +++--- src/library/scala/xml/HasKeyValue.scala | 15 +- 19 files changed, 381 insertions(+), 445 deletions(-) diff --git a/src/compiler/scala/reflect/internal/ClassfileConstants.scala b/src/compiler/scala/reflect/internal/ClassfileConstants.scala index 839bfe90b8..18eba416f5 100644 --- a/src/compiler/scala/reflect/internal/ClassfileConstants.scala +++ b/src/compiler/scala/reflect/internal/ClassfileConstants.scala @@ -12,35 +12,26 @@ object ClassfileConstants { final val JAVA_MAJOR_VERSION = 45 final val JAVA_MINOR_VERSION = 3 - /**

- * (see http://java.sun.com/docs/books/jvms/second_edition/jvms-clarify.html) - *

- *

- * If the ACC_INTERFACE flag is set, the ACC_ABSTRACT - * flag must also be set (ch. 2.13.1). - *

- *

- * A class file cannot have both its ACC_FINAL and - * ACC_ABSTRACT flags set (ch. 2.8.2). - *

- *

- * A field may have at most one of its ACC_PRIVATE, - * ACC_PROTECTED, ACC_PUBLIC flags set (ch. 2.7.4). - *

- *

- * A field may not have both its ACC_FINAL and - * ACC_VOLATILE flags set (ch. 2.9.1). - *

- *

- * If a method has its ACC_ABSTRACT flag set it must not - * have any of its ACC_FINAL, ACC_NATIVE, - * ACC_PRIVATE, ACC_STATIC, ACC_STRICT, - * or ACC_SYNCHRONIZED flags set (ch. 2.13.3.2). - *

- *

- * All interface methods must have their ACC_ABSTRACT and - * ACC_PUBLIC flags set. - *

+ /** (see http://java.sun.com/docs/books/jvms/second_edition/jvms-clarify.html) + * + * If the `ACC_INTERFACE` flag is set, the `ACC_ABSTRACT` flag must also + * be set (ch. 2.13.1). + * + * A class file cannot have both its `ACC_FINAL` and `ACC_ABSTRACT` flags + * set (ch. 2.8.2). + * + * A field may have at most one of its `ACC_PRIVATE`, `ACC_PROTECTED`, + * `ACC_PUBLIC` flags set (ch. 2.7.4). + * + * A field may not have both its `ACC_FINAL` and `ACC_VOLATILE` flags set + * (ch. 2.9.1). + * + * If a method has its `ACC_ABSTRACT` flag set it must not have any of its + * `ACC_FINAL`, `ACC_NATIVE`, `ACC_PRIVATE`, `ACC_STATIC`, `ACC_STRICT`, + * or `ACC_SYNCHRONIZED` flags set (ch. 2.13.3.2). + * + * All interface methods must have their `ACC_ABSTRACT` and + * `ACC_PUBLIC` flags set. */ // Class Field Method final val JAVA_ACC_PUBLIC = 0x0001 // X X X final val JAVA_ACC_PRIVATE = 0x0002 // X X diff --git a/src/compiler/scala/tools/ant/FastScalac.scala b/src/compiler/scala/tools/ant/FastScalac.scala index a2a7496824..ca60a55f02 100644 --- a/src/compiler/scala/tools/ant/FastScalac.scala +++ b/src/compiler/scala/tools/ant/FastScalac.scala @@ -6,21 +6,15 @@ ** |/ ** \* */ - package scala.tools.ant -/**

- * An Ant task to compile with the fast Scala compiler (fsc). - *

- *

- * In addition to the attributes shared with the Scalac - * task, this task also accepts the following attributes: - *

- * +/** An Ant task to compile with the fast Scala compiler (`fsc`). + * + * In addition to the attributes shared with the `Scalac` task, this task + * also accepts the following attributes: + * - `reset` + * - `server` + * - `shutdown` * * @author Stephane Micheloud */ @@ -36,27 +30,23 @@ class FastScalac extends Scalac { ** Properties setters ** \*============================================================================*/ - /** Sets the reset attribute. Used by Ant. + /** Sets the `reset` attribute. Used by [[http://ant.apache.org Ant]]. * - * @param input The value for reset. + * @param input The value for `reset`. */ - def setReset(input: Boolean): Unit = - resetCaches = input + def setReset(input: Boolean) { resetCaches = input } - /** Sets the server attribute. Used by Ant. + /** Sets the `server` attribute. Used by [[http://ant.apache.org Ant]]. * - * @param input The value for server. + * @param input The value for `server`. */ - def setServer(input: String): Unit = { - serverAddr = Some(input) - } + def setServer(input: String) { serverAddr = Some(input) } - /** Sets the shutdown attribute. Used by Ant. + /** Sets the `shutdown` attribute. Used by [[http://ant.apache.org Ant]]. * - * @param input The value for shutdown. + * @param input The value for `shutdown`. */ - def setShutdown(input: Boolean): Unit = - shutdownServer = input + def setShutdown(input: Boolean) { shutdownServer = input } /*============================================================================*\ ** The execute method ** @@ -75,10 +65,10 @@ class FastScalac extends Scalac { reset.value = resetCaches shutdown.value = shutdownServer - /** XXX Since fsc is largely unmaintained, the set of options being individually - * assessed here is likely to bear little relationship to the current set of options. - * Most likely this manifests in confusing and very difficult to debug behavior in fsc. - * We should warn or fix. + /** XXX Since fsc is largely unmaintained, the set of options being + * individually assessed here is likely to bear little relationship to + * the current set of options. Most likely this manifests in confusing + * and very difficult to debug behavior in fsc. We should warn or fix. */ val stringSettings = List(s.outdir, s.classpath, s.bootclasspath, s.extdirs, s.encoding) flatMap (x => List(x.name, x.value)) @@ -107,7 +97,7 @@ class FastScalac extends Scalac { buildError("Compile failed; see the compiler error output for details.") } catch { - case exception: Throwable if (exception.getMessage ne null) => + case exception: Throwable if exception.getMessage ne null => exception.printStackTrace() buildError("Compile failed because of an internal compiler error (" + exception.getMessage + "); see the error output for details.") diff --git a/src/compiler/scala/tools/ant/Pack200Task.scala b/src/compiler/scala/tools/ant/Pack200Task.scala index 5d74cff862..ff18ddff91 100644 --- a/src/compiler/scala/tools/ant/Pack200Task.scala +++ b/src/compiler/scala/tools/ant/Pack200Task.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ -// $Id$ - package scala.tools.ant import java.io.{BufferedOutputStream, File, FileInputStream, @@ -18,18 +16,17 @@ import java.util.jar.Pack200.Packer._ import org.apache.tools.ant.{BuildException, DirectoryScanner} import org.apache.tools.ant.types.FileSet -/**

- * An Ant task that applies the pack200 encoding to a JAR file. - *

+/** An [[http://ant.apache.org Ant]] task that applies the pack200 encoding + * to a JAR file. + * + * - `destdir` (mandatory), + * - `dir` (defaults to project's basedir), + * - `effort` (default 9), + * - `keepFileOrder` (default `'''false'''`), + * - `keepModificationTime` (default `'''false'''`), + * - `repack` (default false), + * - `segmentLimit` (default `-1` for no limit), + * - `suffix` (default ".pack") * * @author James Matlik */ @@ -69,8 +66,8 @@ class Pack200Task extends ScalaMatchingTask { /** Set the flag to specify if file reordering should be performed. Reordering * is used to remove empty packages and improve pack200 optimization. * @param keep - * true to retain file ordering. - * false to optimize directory structure (DEFAULT). */ + * `'''true'''` to retain file ordering. + * `'''false'''` to optimize directory structure (DEFAULT). */ def setKeepFileOrder(x: Boolean) { keepFileOrder = x } /** If false, a single modification time is used for all contained files */ diff --git a/src/compiler/scala/tools/ant/Same.scala b/src/compiler/scala/tools/ant/Same.scala index 52bc440756..23210174ac 100644 --- a/src/compiler/scala/tools/ant/Same.scala +++ b/src/compiler/scala/tools/ant/Same.scala @@ -6,7 +6,6 @@ ** |/ ** \* */ - package scala.tools.ant import java.io.{File, FileInputStream} @@ -16,18 +15,20 @@ import org.apache.tools.ant.util.{FileNameMapper, IdentityMapper} import org.apache.tools.ant.types.Mapper -/**

- * An Ant task that, for a set of files, tests them for byte-to-byte - * equality with one or more other files. - * This task supports the following parameters as attributes: - *

- *

It also support the following nested elements:

- *

This task itself defines a fileset that represents the set of original files.

+/** An Ant task that, for a set of files, tests them for byte-to-byte + * equality with one or more other files. + * + * This task supports the following parameters as attributes: + * - `dir` + * - `todir` + * - `resultproperty` (a property to be set when all tested files pairs are + * equal, if not set, the task will fail instead), + * - `failing` (whether to stop if all files are not equal). + * + * It also support the following nested elements: + * - `mapper` (a mapper from original files to test files). + * + * This task itself defines a fileset that represents the set of original files. * * @author Gilles Dubochet * @version 1.0 */ diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala index ffe67b8229..35e26bd9f5 100644 --- a/src/compiler/scala/tools/ant/ScalaTool.scala +++ b/src/compiler/scala/tools/ant/ScalaTool.scala @@ -6,25 +6,23 @@ ** |/ ** \* */ - package scala.tools.ant import java.io.{File, InputStream, FileWriter} import org.apache.tools.ant.BuildException import org.apache.tools.ant.types.{Path, Reference} -/**

- * An Ant task that generates a shell or batch script to execute a - * Scala program. - * This task can take the following parameters as attributes: - *

+/** An Ant task that generates a shell or batch script to execute a + * Scala program. + * + * This task can take the following parameters as attributes: + * - `file` (mandatory), + * - `class` (mandatory), + * - `platforms`, + * - `classpath`, + * - `properties`, + * - `javaflags`, + * - `toolflags`. * * @author Gilles Dubochet * @version 1.1 @@ -48,36 +46,36 @@ class ScalaTool extends ScalaMatchingTask { val values = List("unix", "windows") } - /** The path to the exec script file. ".bat" will be appended for the + /** The path to the exec script file. `".bat"` will be appended for the * Windows BAT file, if generated. */ private var file: Option[File] = None /** The main class to run. */ private var mainClass: Option[String] = None - /** Supported platforms for the script. Either "unix" or "windows". + /** Supported platforms for the script. Either `"unix"` or `"windows"`. * Defaults to both. */ private var platforms: List[String] = List("unix", "windows") /** An (optional) path to all JARs that this script depend on. Paths must be * relative to the scala home directory. If not set, all JAR archives and - * folders in "lib/" are automatically added. */ + * folders in `"lib/"` are automatically added. */ private var classpath: List[String] = Nil /** An (optional) path to JARs that this script depends on relative to the - * ant project's basedir. */ + * ant project's `basedir`. */ private var classpathPath: Path = emptyPath /** Comma-separated Java system properties to pass to the JRE. Properties - * are formatted as name=value. Properties scala.home, scala.tool.name and - * scala.tool.version are always set. */ + * are formatted as `name=value`. Properties `scala.home`, `scala.tool.name` + * and `scala.tool.version` are always set. */ private var properties: List[(String, String)] = Nil - /** Additional flags passed to the JRE ("java [javaFlags] class"). */ + /** Additional flags passed to the JRE (`"java [javaFlags] class"`). */ private var javaFlags: String = "" - /** Additional flags passed to the tool ("java class [toolFlags]"). Can only - * be set when a main class is defined. */ + /** Additional flags passed to the tool (`"java class [toolFlags]"`). + * Can only be set when a main class is defined. */ private var toolFlags: String = "" /*============================================================================*\ @@ -104,14 +102,14 @@ class ScalaTool extends ScalaMatchingTask { } } - /** - * Sets the classpath with which to run the tool. - * Note that this mechanism of setting the classpath is generally preferred - * for general purpose scripts, as this does not assume all elements are - * relative to the ant basedir. Additionally, the platform specific demarcation - * of any script variables (e.g. `${SCALA_HOME}` or `%SCALA_HOME%`) can be specified - * in a platform independant way (e.g. `@SCALA_HOME@`) and automatically translated - * for you. + /** Sets the classpath with which to run the tool. + * + * Note that this mechanism of setting the classpath is generally preferred + * for general purpose scripts, as this does not assume all elements are + * relative to the Ant `basedir`. Additionally, the platform specific + * demarcation of any script variables (e.g. `${SCALA_HOME}` or + * `%SCALA_HOME%`) can be specified in a platform independant way (e.g. + * `@SCALA_HOME@`) and automatically translated for you. */ def setClassPath(input: String) { classpath = classpath ::: input.split(",").toList diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index f8d5f74f50..01e35ac70a 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -6,7 +6,6 @@ ** |/ ** \* */ - package scala.tools.ant import java.io.{File,PrintWriter,BufferedWriter,FileWriter} @@ -20,51 +19,43 @@ import org.apache.tools.ant.util.{FileUtils, GlobPatternMapper, import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} -/**

- * An Ant task to compile with the new Scala compiler (NSC). - *

- *

- * This task can take the following parameters as attributes: - *

- * - *

- * It also takes the following parameters as nested elements: - *

- * +/** An Ant task to compile with the new Scala compiler (NSC). + * + * This task can take the following parameters as attributes: + * - `srcdir` (mandatory), + * - `srcref`, + * - `destdir`, + * - `classpath`, + * - `classpathref`, + * - `sourcepath`, + * - `sourcepathref`, + * - `bootclasspath`, + * - `bootclasspathref`, + * - `extdirs`, + * - `extdirsref`, + * - `encoding`, + * - `target`, + * - `force`, + * - `fork`, + * - `logging`, + * - `logphase`, + * - `debuginfo`, + * - `addparams`, + * - `scalacdebugging`, + * - `deprecation`, + * - `optimise`, + * - `unchecked`, + * - `failonerror`, + * - `scalacdebugging`, + * - `assemname`, + * - `assemrefs`. + * + * It also takes the following parameters as nested elements: + * - `src` (for `srcdir`), + * - `classpath`, + * - `sourcepath`, + * - `bootclasspath`, + * - `extdirs`. * * @author Gilles Dubochet, Stephane Micheloud */ @@ -96,13 +87,12 @@ class Scalac extends ScalaMatchingTask with ScalacShared { "terminal") } - /** Defines valid values for the target property. */ + /** Defines valid values for the `target` property. */ object Target extends PermissibleValue { val values = List("jvm-1.5", "msil") } - /** Defines valid values for the deprecation and - * unchecked properties. */ + /** Defines valid values for the `deprecation` and `unchecked` properties. */ object Flag extends PermissibleValue { val values = List("yes", "no", "on", "off", "true", "false") def toBoolean(flag: String) = @@ -191,137 +181,137 @@ class Scalac extends ScalaMatchingTask with ScalacShared { \*============================================================================*/ - /** Sets the srcdir attribute. Used by Ant. - * @param input The value of origin. */ + /** Sets the srcdir attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `origin`. */ def setSrcdir(input: Path) { origin = setOrAppend(origin, input) } - /** Sets the origin as a nested src Ant parameter. + /** Sets the `origin` as a nested src Ant parameter. * @return An origin path to be configured. */ def createSrc(): Path = createNewPath(origin _, p => origin = p) - /** Sets the origin as an external reference Ant parameter. + /** Sets the `origin` as an external reference Ant parameter. * @param input A reference to an origin path. */ def setSrcref(input: Reference) = createSrc().setRefid(input) - /** Sets the destdir attribute. Used by Ant. - * @param input The value of destination. */ + /** Sets the `destdir` attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `destination`. */ def setDestdir(input: File) { destination = Some(input) } - /** Sets the classpath attribute. Used by Ant. - * @param input The value of classpath. */ + /** Sets the `classpath` attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `classpath`. */ def setClasspath(input: Path) { classpath = setOrAppend(classpath, input) } - /** Sets the compilerPath attribute. Used by Ant. - * @param input The value of compilerPath. */ + /** Sets the `compilerPath` attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `compilerPath`. */ def setCompilerPath(input : Path) { compilerPath = setOrAppend(compilerPath, input) } def createCompilerPath: Path = createNewPath(compilerPath _, p => compilerPath = p) - /** Sets the compilerpathref attribute. Used by Ant. - * @param input The value of compilerpathref. */ + /** Sets the `compilerpathref` attribute. Used by Ant. + * @param input The value of `compilerpathref`. */ def setCompilerPathRef(input: Reference) { createCompilerPath.setRefid(input) } - /** Sets the classpath as a nested classpath Ant parameter. + /** Sets the `classpath` as a nested classpath Ant parameter. * @return A class path to be configured. */ def createClasspath(): Path = createNewPath(classpath _, p => classpath = p) - /** Sets the classpath as an external reference Ant parameter. + /** Sets the `classpath` as an external reference Ant parameter. * @param input A reference to a class path. */ def setClasspathref(input: Reference) { createClasspath().setRefid(input) } - /** Sets the sourcepath attribute. Used by Ant. - * @param input The value of sourcepath. */ + /** Sets the `sourcepath` attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `sourcepath`. */ def setSourcepath(input: Path) { sourcepath = setOrAppend(sourcepath, input) } - /** Sets the sourcepath as a nested sourcepath Ant parameter. + /** Sets the `sourcepath` as a nested sourcepath Ant parameter. * @return A source path to be configured. */ def createSourcepath(): Path = createNewPath(sourcepath _, p => sourcepath = p) - /** Sets the sourcepath as an external reference Ant parameter. + /** Sets the `sourcepath` as an external reference Ant parameter. * @param input A reference to a source path. */ def setSourcepathref(input: Reference) { createSourcepath().setRefid(input) } - /** Sets the boot classpath attribute. Used by Ant. + /** Sets the boot classpath attribute. Used by [[http://ant.apache.org Ant]]. * - * @param input The value of bootclasspath. */ + * @param input The value of `bootclasspath`. */ def setBootclasspath(input: Path) { bootclasspath = setOrAppend(bootclasspath, input) } - /** Sets the bootclasspath as a nested sourcepath Ant + /** Sets the `bootclasspath` as a nested sourcepath Ant * parameter. * @return A source path to be configured. */ def createBootclasspath(): Path = createNewPath(bootclasspath _, p => bootclasspath = p) - /** Sets the bootclasspath as an external reference Ant + /** Sets the `bootclasspath` as an external reference Ant * parameter. * @param input A reference to a source path. */ def setBootclasspathref(input: Reference) = createBootclasspath().setRefid(input) /** Sets the external extensions path attribute. Used by Ant. - * @param input The value of extdirs. */ + * @param input The value of `extdirs`. */ def setExtdirs(input: Path) = extdirs = setOrAppend(extdirs, input) - /** Sets the extdirs as a nested sourcepath Ant parameter. + /** Sets the `extdirs` as a nested sourcepath Ant parameter. * @return An extensions path to be configured. */ def createExtdirs(): Path = createNewPath(extdirs _, p => extdirs = p) - /** Sets the extdirs as an external reference Ant parameter. + /** Sets the `extdirs` as an external reference Ant parameter. * @param input A reference to an extensions path. */ def setExtdirsref(input: Reference) = createExtdirs().setRefid(input) - /** Sets the encoding attribute. Used by Ant. - * @param input The value of encoding. */ + /** Sets the `encoding` attribute. Used by Ant. + * @param input The value of `encoding`. */ def setEncoding(input: String): Unit = encoding = Some(input) - /** Sets the target attribute. Used by Ant. - * @param input The value for target. */ + /** Sets the `target` attribute. Used by Ant. + * @param input The value for `target`. */ def setTarget(input: String): Unit = if (Target.isPermissible(input)) backend = Some(input) else buildError("Unknown target '" + input + "'") - /** Sets the force attribute. Used by Ant. - * @param input The value for force. */ + /** Sets the `force` attribute. Used by Ant. + * @param input The value for `force`. */ def setForce(input: Boolean) { force = input } - /** Sets the fork attribute. Used by Ant. - * @param input The value for fork. */ + /** Sets the `fork` attribute. Used by Ant. + * @param input The value for `fork`. */ def setFork(input : Boolean) { fork = input } /** - * Sets the jvmargs attribute. Used by Ant. - * @param input The value for jvmargs + * Sets the `jvmargs` attribute. Used by Ant. + * @param input The value for `jvmargs` */ def setJvmargs(input : String) { jvmArgs = Some(input) } /** Sets the logging level attribute. Used by Ant. - * @param input The value for logging. */ + * @param input The value for `logging`. */ def setLogging(input: String) { if (LoggingLevel.isPermissible(input)) logging = Some(input) else buildError("Logging level '" + input + "' does not exist.") } - /** Sets the logphase attribute. Used by Ant. - * @param input The value for logPhase. */ + /** Sets the `logphase` attribute. Used by Ant. + * @param input The value for `logPhase`. */ def setLogPhase(input: String) { logPhase = input.split(",").toList.flatMap { s: String => val st = s.trim() @@ -333,38 +323,38 @@ class Scalac extends ScalaMatchingTask with ScalacShared { } } - /** Set the debug info attribute. - * @param input The value for debug. */ + /** Set the `debug` info attribute. + * @param input The value for `debug`. */ def setDebuginfo(input: String) { debugInfo = Some(input) } - /** Set the addparams info attribute. - * @param input The value for addparams. */ + /** Set the `addparams` info attribute. + * @param input The value for `addparams`. */ def setAddparams(input: String) { addParams = input } - /** Set the deprecation info attribute. - * @param input One of the flags yes/no or on/off. */ + /** Set the `deprecation` info attribute. + * @param input One of the flags `yes/no` or `on/off`. */ def setDeprecation(input: String) { deprecation = Flag toBoolean input orElse buildError("Unknown deprecation flag '" + input + "'") } - /** Set the optimise info attribute. - * @param input One of the flags yes/no or on/off. */ + /** Set the `optimise` info attribute. + * @param input One of the flags `yes/no` or `on/off`. */ def setOptimise(input: String) { optimise = Flag toBoolean input orElse buildError("Unknown optimisation flag '" + input + "'") } - /** Set the unchecked info attribute. - * @param input One of the flags yes/no or on/off. */ + /** Set the `unchecked` info attribute. + * @param input One of the flags `yes/no` or `on/off`. */ def setUnchecked(input: String) { unchecked = Flag toBoolean input orElse buildError("Unknown unchecked flag '" + input + "'") } - /** Sets the force attribute. Used by Ant. - * @param input The value for force. */ + /** Sets the `force` attribute. Used by Ant. + * @param input The value for `force`. */ def setFailonerror(input: Boolean) { failonerror = input } - /** Set the scalacdebugging info attribute. If set to - * true, the scalac ant task will print out the filenames + /** Set the `scalacdebugging` info attribute. If set to + * `'''true'''`, the scalac ant task will print out the filenames * being compiled. * @param input The specified flag */ def setScalacdebugging(input: Boolean) { scalacDebugging = input } @@ -376,34 +366,34 @@ class Scalac extends ScalaMatchingTask with ScalacShared { ** Properties getters ** \*============================================================================*/ - /** Gets the value of the classpath attribute in a + /** Gets the value of the `classpath` attribute in a * Scala-friendly form. * @return The class path as a list of files. */ protected def getClasspath: List[File] = pathAsList(classpath, "classpath") - /** Gets the value of the origin attribute in a + /** Gets the value of the `origin` attribute in a * Scala-friendly form. * @return The origin path as a list of files. */ protected def getOrigin: List[File] = pathAsList(origin, "origin") - /** Gets the value of the destination attribute in a + /** Gets the value of the `destination` attribute in a * Scala-friendly form. * @return The destination as a file. */ protected def getDestination: File = if (destination.isEmpty) buildError("Member 'destination' is empty.") else existing(getProject().resolveFile(destination.get.toString)) - /** Gets the value of the sourcepath attribute in a + /** Gets the value of the `sourcepath` attribute in a * Scala-friendly form. * @return The source path as a list of files. */ protected def getSourcepath: List[File] = pathAsList(sourcepath, "sourcepath") - /** Gets the value of the bootclasspath attribute in a + /** Gets the value of the `bootclasspath` attribute in a * Scala-friendly form. * @return The boot class path as a list of files. */ protected def getBootclasspath: List[File] = pathAsList(bootclasspath, "bootclasspath") - /** Gets the value of the extdirs attribute in a + /** Gets the value of the `extdirs` attribute in a * Scala-friendly form. * @return The extensions path as a list of files. */ protected def getExtdirs: List[File] = pathAsList(extdirs, "extdirs") @@ -441,13 +431,13 @@ class Scalac extends ScalaMatchingTask with ScalacShared { /** Transforms a path into a Scalac-readable string. * @param path A path to convert. - * @return A string-representation of the path like a.jar:b.jar. */ + * @return A string-representation of the path like `a.jar:b.jar`. */ protected def asString(path: List[File]): String = path.map(asString).mkString(File.pathSeparator) /** Transforms a file into a Scalac-readable string. * @param path A file to convert. - * @return A string-representation of the file like /x/k/a.scala. */ + * @return A string-representation of the file like `/x/k/a.scala`. */ protected def asString(file: File): String = file.getAbsolutePath() diff --git a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala index 0948e072b4..05571b2424 100644 --- a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala +++ b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala @@ -3,38 +3,28 @@ * @author Martin Odersky */ - package scala.tools.nsc package backend import scala.tools.nsc.backend.icode._ import scala.collection.{ mutable, immutable } -/** - * Scala primitive operations are represented as methods in Any and - * AnyVal subclasses. Here we demultiplex them by providing a mapping - * from their symbols to integers. Different methods exist for - * different value types, but with the same meaning (like plus, minus, - * etc.). They will all be mapped to the same int. +/** Scala primitive operations are represented as methods in `Any` and + * `AnyVal` subclasses. Here we demultiplex them by providing a mapping + * from their symbols to integers. Different methods exist for + * different value types, but with the same meaning (like plus, minus, + * etc.). They will all be mapped to the same int. * - *

Note: The three equal methods have the following semantics:

- * + * Note: The three equal methods have the following semantics: + * - `"=="` checks for `null`, and if non-null, calls + * `java.lang.Object.equals` + * `(class: Any; modifier: final)`. Primitive: `EQ` + * - `"eq"` usual reference comparison + * `(class: AnyRef; modifier: final)`. Primitive: `ID` + * - `"equals"` user-defined equality (Java semantics) + * `(class: Object; modifier: none)`. Primitive: `EQUALS` * - * Inspired from the scalac compiler. + * Inspired from the `scalac` compiler. */ abstract class ScalaPrimitives { val global: Global diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala index 3e6c363acc..b8e20c2de1 100644 --- a/src/library/scala/PartialFunction.scala +++ b/src/library/scala/PartialFunction.scala @@ -6,14 +6,12 @@ ** |/ ** \* */ - - package scala -/** A partial function of type `PartialFunction[A, B]` is a - * unary function where the domain does not necessarily include all values of type - * `A`. The function `isDefinedAt` allows to - * test dynamically if a value is in the domain of the function. +/** A partial function of type `PartialFunction[A, B]` is a unary function + * where the domain does not necessarily include all values of type `A`. + * The function `isDefinedAt` allows to test dynamically if a value is in + * the domain of the function. * * @author Martin Odersky * @version 1.0, 16/07/2003 @@ -23,12 +21,12 @@ trait PartialFunction[-A, +B] extends (A => B) { /** Checks if a value is contained in the function's domain. * * @param x the value to test - * @return `true`, iff `x` is in the domain of this function, `false` otherwise. + * @return `'''true'''`, iff `x` is in the domain of this function, `'''false'''` otherwise. */ def isDefinedAt(x: A): Boolean - /** Composes this partial function with a fallback partial function which gets applied where this partial function - * is not defined. + /** Composes this partial function with a fallback partial function which + * gets applied where this partial function is not defined. * * @param that the fallback function * @tparam A1 the argument type of the fallback function @@ -46,8 +44,8 @@ trait PartialFunction[-A, +B] extends (A => B) { else that.apply(x) } - /** Composes this partial function with a transformation function that gets applied - * to results of this partial function. + /** Composes this partial function with a transformation function that + * gets applied to results of this partial function. * @param k the transformation function * @tparam C the result type of the transformation function. * @return a partial function with the same domain as this partial function, which maps @@ -70,8 +68,7 @@ trait PartialFunction[-A, +B] extends (A => B) { /** A few handy operations which leverage the extra bit of information * available in partial functions. Examples: - * - *
+ *  {{{
  *  import PartialFunction._
  *
  *  def strangeConditional(other: Any): Boolean = cond(other) {
@@ -79,7 +76,7 @@ trait PartialFunction[-A, +B] extends (A => B) {
  *    case x: Int => true
  *  }
  *  def onlyInt(v: Any): Option[Int] = condOpt(v) { case x: Int => x }
- * 
+ * }}} * * @author Paul Phillips * @since 2.8 @@ -98,9 +95,10 @@ object PartialFunction (pf isDefinedAt x) && pf(x) /** Transforms a PartialFunction[T, U] `pf` into Function1[T, Option[U]] `f` - * whose result is Some(x) if the argument is in pf's domain and None otherwise, - * and applies it to the value `x`. In effect, it is a `match` statement - * which wraps all case results in Some(_) and adds `case _ => None` to the end. + * whose result is `Some(x)` if the argument is in `pf`'s domain and `None` + * otherwise, and applies it to the value `x`. In effect, it is a + * `'''match'''` statement which wraps all case results in `Some(_)` and + * adds `'''case''' _ => None` to the end. * * @param x the value to test * @param pf the PartialFunction[T, U] diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index 8880127a3d..705ef4e0ed 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -887,8 +887,7 @@ trait Iterator[+A] extends TraversableOnce[A] { /** Returns an iterator which groups this iterator into fixed size * blocks. Example usages: - * - *
+   *  {{{
    *    // Returns List(List(1, 2, 3), List(4, 5, 6), List(7)))
    *    (1 to 7).iterator grouped 3 toList
    *    // Returns List(List(1, 2, 3), List(4, 5, 6))
@@ -897,7 +896,7 @@ trait Iterator[+A] extends TraversableOnce[A] {
    *    // Illustrating that withPadding's argument is by-name.
    *    val it2 = Iterator.iterate(20)(_ + 5)
    *    (1 to 7).iterator grouped 3 withPadding it2.next toList
-   *  
+ * }}} */ def grouped[B >: A](size: Int): GroupedIterator[B] = new GroupedIterator[B](self, size, size) @@ -905,9 +904,8 @@ trait Iterator[+A] extends TraversableOnce[A] { /** Returns an iterator which presents a "sliding window" view of * another iterator. The first argument is the window size, and * the second is how far to advance the window on each iteration; - * defaults to 1. Example usages: - * - *
+   *  defaults to `1`.  Example usages:
+   *  {{{
    *    // Returns List(List(1, 2, 3), List(2, 3, 4), List(3, 4, 5))
    *    (1 to 5).iterator.sliding(3).toList
    *    // Returns List(List(1, 2, 3, 4), List(4, 5))
@@ -918,7 +916,7 @@ trait Iterator[+A] extends TraversableOnce[A] {
    *    // Illustrating that withPadding's argument is by-name.
    *    val it2 = Iterator.iterate(20)(_ + 5)
    *    (1 to 5).iterator.sliding(4, 3).withPadding(it2.next).toList
-   *  
+ * }}} */ def sliding[B >: A](size: Int, step: Int = 1): GroupedIterator[B] = new GroupedIterator[B](self, size, step) @@ -1028,7 +1026,8 @@ trait Iterator[+A] extends TraversableOnce[A] { else Stream.empty[A] /** Converts this iterator to a string. - * @return `"empty iterator"` or `"non-empty iterator"`, depending on whether or not the iterator is empty. + * @return `"empty iterator"` or `"non-empty iterator"`, depending on + * whether or not the iterator is empty. */ override def toString = (if (hasNext) "non-empty" else "empty")+" iterator" diff --git a/src/library/scala/collection/immutable/StringLike.scala b/src/library/scala/collection/immutable/StringLike.scala index 02e74a3a64..d989206a18 100644 --- a/src/library/scala/collection/immutable/StringLike.scala +++ b/src/library/scala/collection/immutable/StringLike.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala.collection package immutable @@ -81,12 +79,11 @@ self => * Strip trailing line end character from this string if it has one. * * A line end character is one of - * - * If a line feed character LF is preceded by a carriage return CR - * (0x0D hex), the CR character is also stripped (Windows convention). + * - `LF` - line feed (`0x0A` hex) + * - `FF` - form feed (`0x0C` hex) + * + * If a line feed character `LF` is preceded by a carriage return `CR` + * (`0x0D` hex), the `CR` character is also stripped (Windows convention). */ def stripLineEnd: String = { val len = toString.length @@ -100,18 +97,14 @@ self => } } - /** - * Return all lines in this string in an iterator, including trailing - * line end characters. + /** Return all lines in this string in an iterator, including trailing + * line end characters. * - * The number of strings returned is one greater than the number of line - * end characters in this string. For an empty string, a single empty - * line is returned. A line end character is one of - * - * + * The number of strings returned is one greater than the number of line + * end characters in this string. For an empty string, a single empty + * line is returned. A line end character is one of + * - `LF` - line feed (`0x0A` hex) + * - `FF` - form feed (`0x0C` hex) */ def linesWithSeparators: Iterator[String] = new Iterator[String] { val str = self.toString @@ -177,13 +170,10 @@ self => toString.replaceAll(arg1, arg2) } - /** - * For every line in this string: + /** For every line in this string: * - *
- * Strip a leading prefix consisting of blanks or control characters - * followed by `marginChar` from the line. - *
+ * Strip a leading prefix consisting of blanks or control characters + * followed by `marginChar` from the line. */ def stripMargin(marginChar: Char): String = { val buf = new StringBuilder @@ -197,13 +187,10 @@ self => buf.toString } - /** - * For every line in this string: + /** For every line in this string: * - *
- * Strip a leading prefix consisting of blanks or control characters - * followed by `|` from the line. - *
+ * Strip a leading prefix consisting of blanks or control characters + * followed by `|` from the line. */ def stripMargin: String = stripMargin('|') @@ -218,8 +205,7 @@ self => toString.split(re) } - /** You can follow a string with `.r`, turning - * it into a Regex. E.g. + /** You can follow a string with `.r`, turning it into a `Regex`. E.g. * * """A\w*""".r is the regular expression for identifiers starting with `A`. */ @@ -250,30 +236,26 @@ self => case x => x.asInstanceOf[AnyRef] } - /** - * Uses the underlying string as a pattern (in a fashion similar to + /** Uses the underlying string as a pattern (in a fashion similar to * printf in C), and uses the supplied arguments to fill in the * holes. * * The interpretation of the formatting patterns is described in * * `java.util.Formatter`, with the addition that - * classes deriving from `ScalaNumber` (such as `scala.BigInt` and - * `scala.BigDecimal`) are unwrapped to pass a type which `Formatter` + * classes deriving from `ScalaNumber` (such as [[scala.BigInt]] and + * [[scala.BigDecimal]]) are unwrapped to pass a type which `Formatter` * understands. * - * * @param args the arguments used to instantiating the pattern. - * @throws java.lang.IllegalArgumentException + * @throws `java.lang.IllegalArgumentException` */ def format(args : Any*): String = java.lang.String.format(toString, args map unwrapArg: _*) - /** - * Like `format(args*)` but takes an initial `Locale` parameter + /** Like `format(args*)` but takes an initial `Locale` parameter * which influences formatting as in `java.lang.String`'s format. * - * * The interpretation of the formatting patterns is described in * * `java.util.Formatter`, with the addition that @@ -281,12 +263,10 @@ self => * `scala.BigDecimal`) are unwrapped to pass a type which `Formatter` * understands. * - * * @param locale an instance of `java.util.Locale` * @param args the arguments used to instantiating the pattern. - * @throws java.lang.IllegalArgumentException + * @throws `java.lang.IllegalArgumentException` */ def formatLocal(l: java.util.Locale, args: Any*): String = java.lang.String.format(l, toString, args map unwrapArg: _*) } - diff --git a/src/library/scala/collection/mutable/OpenHashMap.scala b/src/library/scala/collection/mutable/OpenHashMap.scala index 72e729f370..a9bd0b0b1c 100644 --- a/src/library/scala/collection/mutable/OpenHashMap.scala +++ b/src/library/scala/collection/mutable/OpenHashMap.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -29,10 +29,11 @@ object OpenHashMap { private[mutable] def nextPowerOfTwo(i : Int) = highestOneBit(i) << 1; } -/** A mutable hash map based on an open hashing scheme. The precise scheme is undefined, - * but it should make a reasonable effort to ensure that an insert with consecutive hash - * codes is not unneccessarily penalised. In particular, mappings of consecutive integer - * keys should work without significant performance loss. +/** A mutable hash map based on an open hashing scheme. The precise scheme is + * undefined, but it should make a reasonable effort to ensure that an insert + * with consecutive hash codes is not unneccessarily penalised. In particular, + * mappings of consecutive integer keys should work without significant + * performance loss. * * @tparam Key type of the keys in this map. * @tparam Value type of the values in this map. @@ -53,82 +54,81 @@ extends Map[Key, Value] import OpenHashMap.OpenEntry private type Entry = OpenEntry[Key, Value] - /** - * A default constructor creates a hashmap with initial size 8. + /** A default constructor creates a hashmap with initial size `8`. */ - def this() = this(8); + def this() = this(8) override def empty: OpenHashMap[Key, Value] = OpenHashMap.empty[Key, Value] - private[this] val actualInitialSize = OpenHashMap.nextPowerOfTwo(initialSize); + private[this] val actualInitialSize = OpenHashMap.nextPowerOfTwo(initialSize) - private var mask = actualInitialSize - 1;; - private var table : Array[Entry] = new Array[Entry](actualInitialSize); - private var _size = 0; - private var deleted = 0; + private var mask = actualInitialSize - 1 + private var table : Array[Entry] = new Array[Entry](actualInitialSize) + private var _size = 0 + private var deleted = 0 // Used for tracking inserts so that iterators can determine in concurrent modification has occurred. - private[this] var modCount = 0; + private[this] var modCount = 0 - override def size = _size; - private[this] def size_=(s : Int) = _size = s; + override def size = _size + private[this] def size_=(s : Int) { _size = s } /** Returns a mangled hash code of the provided key. */ - protected def hashOf(key : Key) = { + protected def hashOf(key: Key) = { var h = key.## h ^= ((h >>> 20) ^ (h >>> 12)); h ^ (h >>> 7) ^ (h >>> 4); } private[this] def growTable() = { - val oldSize = mask + 1; - val newSize = 4 * oldSize; - val oldTable = table; - table = new Array[Entry](newSize); - mask = newSize - 1; + val oldSize = mask + 1 + val newSize = 4 * oldSize + val oldTable = table + table = new Array[Entry](newSize) + mask = newSize - 1 oldTable.foreach( entry => if (entry != null && entry.value != None) addEntry(entry)); - deleted = 0; + deleted = 0 } - private[this] def findIndex(key : Key) : Int = findIndex(key, hashOf(key)); + private[this] def findIndex(key: Key) : Int = findIndex(key, hashOf(key)) - private[this] def findIndex(key : Key, hash : Int) : Int = { - var j = hash; + private[this] def findIndex(key: Key, hash: Int): Int = { + var j = hash - var index = hash & mask; - var perturb = index; + var index = hash & mask + var perturb = index while(table(index) != null && !(table(index).hash == hash && table(index).key == key)){ - j = 5 * j + 1 + perturb; - perturb >>= 5; - index = j & mask; + j = 5 * j + 1 + perturb + perturb >>= 5 + index = j & mask } - index; + index } - private[this] def addEntry(entry : Entry) = - if (entry != null) table(findIndex(entry.key, entry.hash)) = entry; + private[this] def addEntry(entry: Entry) = + if (entry != null) table(findIndex(entry.key, entry.hash)) = entry - override def update(key : Key, value : Value) { - put(key, hashOf(key), value); + override def update(key: Key, value: Value) { + put(key, hashOf(key), value) } def += (kv: (Key, Value)): this.type = { put(kv._1, kv._2); this } def -= (key: Key): this.type = { remove(key); this } - override def put(key : Key, value : Value): Option[Value] = + override def put(key: Key, value: Value): Option[Value] = put(key, hashOf(key), value) - private def put(key : Key, hash : Int, value : Value): Option[Value] = { - if (2 * (size + deleted) > mask) growTable; - val index = findIndex(key, hash); - val entry = table(index); + private def put(key: Key, hash: Int, value: Value): Option[Value] = { + if (2 * (size + deleted) > mask) growTable + val index = findIndex(key, hash) + val entry = table(index) if (entry == null) { table(index) = new OpenEntry(key, hash, Some(value)); - modCount += 1; - size += 1; + modCount += 1 + size += 1 None } else { val res = entry.value @@ -139,23 +139,23 @@ extends Map[Key, Value] } override def remove(key : Key): Option[Value] = { - val index = findIndex(key); + val index = findIndex(key) if (table(index) != null && table(index).value != None){ val res = table(index).value - table(index).value = None; - size -= 1; - deleted += 1; + table(index).value = None + size -= 1 + deleted += 1 res } else None } def get(key : Key) : Option[Value] = { - val hash = hashOf(key); + val hash = hashOf(key) - var j = hash; - var index = hash & mask; - var perturb = index; - var entry = table(index); + var j = hash + var index = hash & mask + var perturb = index + var entry = table(index) while(entry != null){ if (entry.hash == hash && entry.key == key){ @@ -167,30 +167,30 @@ extends Map[Key, Value] index = j & mask; entry = table(index); } - None; + None } - /** An iterator over the elements of this map. Use of this iterator follows the same - * contract for concurrent modification as the foreach method. + /** An iterator over the elements of this map. Use of this iterator follows + * the same contract for concurrent modification as the foreach method. * * @return the iterator */ def iterator = new Iterator[(Key, Value)]{ - var index = 0; - val initialModCount = modCount; + var index = 0 + val initialModCount = modCount private[this] def advance() { if (initialModCount != modCount) sys.error("Concurrent modification"); while((index <= mask) && (table(index) == null || table(index).value == None)) index+=1; } - def hasNext = {advance; index <= mask; } + def hasNext = {advance(); index <= mask } def next = { - advance; - val result = table(index); - index += 1; - (result.key, result.value.get); + advance() + val result = table(index) + index += 1 + (result.key, result.value.get) } } @@ -200,16 +200,12 @@ extends Map[Key, Value] it } - /** - * Loop over the key, value mappings of this map. + /** Loop over the key, value mappings of this map. * * The behaviour of modifying the map during an iteration is as follows: - * - * + * - Deleting a mapping is always permitted. + * - Changing the value of mapping which is already present is permitted. + * - Anything else is not permitted. It will usually, but not always, throw an exception. * * @tparam U The return type of the specified function `f`, return result of which is ignored. * @param f The function to apply to each key, value mapping. diff --git a/src/library/scala/reflect/NoManifest.scala b/src/library/scala/reflect/NoManifest.scala index f791cd419f..191e46ae39 100644 --- a/src/library/scala/reflect/NoManifest.scala +++ b/src/library/scala/reflect/NoManifest.scala @@ -6,11 +6,9 @@ ** |/ ** \* */ - - package scala.reflect -/**

One of the branches of an OptManifest +/** One of the branches of an [[scala.reflect.OptManifest]]. */ object NoManifest extends OptManifest[Nothing] with Serializable { override def toString = "" diff --git a/src/library/scala/runtime/RichBoolean.scala b/src/library/scala/runtime/RichBoolean.scala index d44868708d..a14160a71e 100644 --- a/src/library/scala/runtime/RichBoolean.scala +++ b/src/library/scala/runtime/RichBoolean.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ diff --git a/src/library/scala/runtime/RichByte.scala b/src/library/scala/runtime/RichByte.scala index fa24bd6d8a..c42a2dd183 100644 --- a/src/library/scala/runtime/RichByte.scala +++ b/src/library/scala/runtime/RichByte.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ diff --git a/src/library/scala/runtime/RichDouble.scala b/src/library/scala/runtime/RichDouble.scala index 1414fb73bc..0a9cda40ec 100644 --- a/src/library/scala/runtime/RichDouble.scala +++ b/src/library/scala/runtime/RichDouble.scala @@ -24,8 +24,7 @@ final class RichDouble(val self: Double) extends FractionalProxy[Double] { def toRadians: Double = math.toRadians(self) /** Converts an angle measured in radians to an approximately equivalent - * angle measured in degrees - * + * angle measured in degrees. * @param x angle, in radians * @return the measurement of the angle x in degrees. */ diff --git a/src/library/scala/runtime/RichException.scala b/src/library/scala/runtime/RichException.scala index 5dd89531be..bb20ec61bb 100644 --- a/src/library/scala/runtime/RichException.scala +++ b/src/library/scala/runtime/RichException.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala.runtime import compat.Platform.EOL diff --git a/src/library/scala/runtime/RichInt.scala b/src/library/scala/runtime/RichInt.scala index 347e8c8e86..cf5aab0be4 100644 --- a/src/library/scala/runtime/RichInt.scala +++ b/src/library/scala/runtime/RichInt.scala @@ -6,7 +6,6 @@ ** |/ ** \* */ - package scala.runtime import scala.collection.immutable.Range @@ -18,20 +17,23 @@ final class RichInt(val self: Int) extends ScalaNumberProxy[Int] with RangedProx type ResultWithoutStep = Range /** - * @return `true` if this number has no decimal component. Always returns true for `RichInt`. + * @return `'''true'''` if this number has no decimal component. + * Always returns `'''true'''` for `RichInt`. */ def isWhole() = true /** * @param end The final bound of the range to make. - * @return A [[Range]] from `this` up to but not including `end`. + * @return A [[scala.collection.immutable.Range]] from `this` up to but + * not including `end`. */ def until(end: Int): Range = Range(self, end) /** * @param end The final bound of the range to make. * @param step The number to increase by for each step of the range. - * @return A [[Range]] from `this` up to but not including `end`. + * @return A [[scala.collection.immutable.Range]] from `this` up to but + * not including `end`. */ def until(end: Int, step: Int): Range = Range(self, end, step) @@ -41,14 +43,16 @@ final class RichInt(val self: Int) extends ScalaNumberProxy[Int] with RangedProx /** like `until`, but includes the last index */ /** * @param end The final bound of the range to make. - * @return A [[Range]] from `this` up to and including `end`. + * @return A [[scala.collection.immutable.Range]] from `'''this'''` up to + * and including `end`. */ def to(end: Int): Range.Inclusive = Range.inclusive(self, end) /** * @param end The final bound of the range to make. * @param step The number to increase by for each step of the range. - * @return A [[Range]] from `this` up to and including `end`. + * @return A [[scala.collection.immutable.Range]] from `'''this'''` up to + * and including `end`. */ def to(end: Int, step: Int): Range.Inclusive = Range.inclusive(self, end, step) @@ -56,17 +60,17 @@ final class RichInt(val self: Int) extends ScalaNumberProxy[Int] with RangedProx // def to(end: Int): Range with Range.ByOne = new Range.Inclusive(self, end, 1) with Range.ByOne /** - * @return `this` if `this < that` or `that` otherwise + * @return `'''this'''` if `'''this''' < that` or `that` otherwise */ override def min(that: Int): Int = if (self < that) self else that /** - * @return `this` if `this > that` or `that` otherwise + * @return `'''this'''` if `'''this''' > that` or `that` otherwise */ override def max(that: Int): Int = if (self > that) self else that /** - * Computes the absolute value of `this`. + * Computes the absolute value of `'''this'''`. */ override def abs: Int = if (self < 0) -self else self diff --git a/src/library/scala/util/parsing/combinator/Parsers.scala b/src/library/scala/util/parsing/combinator/Parsers.scala index bb73b28ea8..084a849037 100644 --- a/src/library/scala/util/parsing/combinator/Parsers.scala +++ b/src/library/scala/util/parsing/combinator/Parsers.scala @@ -6,7 +6,6 @@ ** |/ ** \* */ - package scala.util.parsing.combinator import scala.util.parsing.input._ @@ -70,10 +69,12 @@ trait Parsers { /** Partial functional composition of ParseResults. * * @param `f` the partial function to be lifted over this result - * @param error a function that takes the same argument as `f` and produces an error message - * to explain why `f` wasn't applicable (it is called when this is the case) - * @return if `f` f is defined at the result in this `ParseResult`, `f` applied to the result - * of this `ParseResult`, packaged up as a new `ParseResult`. If `f` is not defined, `Failure`. + * @param error a function that takes the same argument as `f` and + * produces an error message to explain why `f` wasn't applicable + * (it is called when this is the case) + * @return if `f` f is defined at the result in this `ParseResult`, `f` + * applied to the result of this `ParseResult`, packaged up as + * a new `ParseResult`. If `f` is not defined, `Failure`. */ def mapPartial[U](f: PartialFunction[T, U], error: T => String): ParseResult[U] @@ -210,10 +211,11 @@ trait Parsers { * * `p ~ q` succeeds if `p` succeeds and `q` succeeds on the input left over by `p`. * - * @param q a parser that will be executed after `p` (this parser) succeeds -- evaluated at most once, and only when necessary - * @return a `Parser` that -- on success -- returns a `~` (like a Pair, but easier to pattern match on) - * that contains the result of `p` and that of `q`. - * The resulting parser fails if either `p` or `q` fails. + * @param q a parser that will be executed after `p` (this parser) + * succeeds -- evaluated at most once, and only when necessary. + * @return a `Parser` that -- on success -- returns a `~` (like a `Pair`, + * but easier to pattern match on) that contains the result of `p` and + * that of `q`. The resulting parser fails if either `p` or `q` fails. */ @migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") def ~ [U](q: => Parser[U]): Parser[~[T, U]] = { lazy val p = q // lazy argument @@ -224,7 +226,8 @@ trait Parsers { * * `p ~> q` succeeds if `p` succeeds and `q` succeeds on the input left over by `p`. * - * @param q a parser that will be executed after `p` (this parser) succeeds -- evaluated at most once, and only when necessary + * @param q a parser that will be executed after `p` (this parser) + * succeeds -- evaluated at most once, and only when necessary. * @return a `Parser` that -- on success -- returns the result of `q`. */ @migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") @@ -234,8 +237,8 @@ trait Parsers { /** A parser combinator for sequential composition which keeps only the left result. * - *

`p <~ q` succeeds if `p` succeeds and `q` succeeds on the input - * left over by `p`.

+ * `p <~ q` succeeds if `p` succeeds and `q` succeeds on the input + * left over by `p`. * * @note <~ has lower operator precedence than ~ or ~>. * @@ -272,9 +275,9 @@ trait Parsers { * * @param q a parser that will be executed if `p` (this parser) fails (and allows back-tracking) * @return a `Parser` that returns the result of the first parser to succeed (out of `p` and `q`) - * The resulting parser succeeds if (and only if) + * The resulting parser succeeds if (and only if) + * - `p` succeeds, ''or'' + * - if `p` fails allowing back-tracking and `q` succeeds. */ def | [U >: T](q: => Parser[U]): Parser[U] = append(q).named("|") @@ -356,18 +359,23 @@ trait Parsers { */ def ^? [U](f: PartialFunction[T, U]): Parser[U] = ^?(f, r => "Constructor function not defined at "+r) - /** A parser combinator that parameterizes a subsequent parser with the result of this one. + /** A parser combinator that parameterizes a subsequent parser with the + * result of this one. * - * Use this combinator when a parser depends on the result of a previous parser. `p` should be - * a function that takes the result from the first parser and returns the second parser. + * Use this combinator when a parser depends on the result of a previous + * parser. `p` should be a function that takes the result from the first + * parser and returns the second parser. * - * `p into fq` (with `fq` typically `{x => q}`) first applies `p`, and then, if `p` successfully - * returned result `r`, applies `fq(r)` to the rest of the input. + * `p into fq` (with `fq` typically `{x => q}`) first applies `p`, and + * then, if `p` successfully returned result `r`, applies `fq(r)` to the + * rest of the input. * * ''From: G. Hutton. Higher-order functions for parsing. J. Funct. Program., 2(3):323--343, 1992.'' * - * @param fq a function that, given the result from this parser, returns the second parser to be applied - * @return a parser that succeeds if this parser succeeds (with result `x`) and if then `fq(x)` succeeds + * @param fq a function that, given the result from this parser, returns + * the second parser to be applied + * @return a parser that succeeds if this parser succeeds (with result `x`) + * and if then `fq(x)` succeeds */ def into[U](fq: T => Parser[U]): Parser[U] = flatMap(fq) @@ -544,8 +552,8 @@ trait Parsers { /** A parser generator for non-empty repetitions. * - *

rep1(p) repeatedly uses `p` to parse the input until `p` fails -- `p` must succeed at least - * once (the result is a `List` of the consecutive results of `p`)

+ * `rep1(p)` repeatedly uses `p` to parse the input until `p` fails -- `p` must succeed at least + * once (the result is a `List` of the consecutive results of `p`) * * @param p a `Parser` that is to be applied successively to the input * @return A parser that returns a list of results produced by repeatedly applying `p` to the input @@ -555,9 +563,9 @@ trait Parsers { /** A parser generator for non-empty repetitions. * - *

rep1(f, p) first uses `f` (which must succeed) and then repeatedly uses `p` to - * parse the input until `p` fails - * (the result is a `List` of the consecutive results of `f` and `p`)

+ * `rep1(f, p)` first uses `f` (which must succeed) and then repeatedly + * uses `p` to parse the input until `p` fails + * (the result is a `List` of the consecutive results of `f` and `p`) * * @param first a `Parser` that parses the first piece of input * @param p0 a `Parser` that is to be applied successively to the rest of the input (if any) -- evaluated at most once, and only when necessary diff --git a/src/library/scala/xml/HasKeyValue.scala b/src/library/scala/xml/HasKeyValue.scala index 29c3f584c4..55ac63e201 100644 --- a/src/library/scala/xml/HasKeyValue.scala +++ b/src/library/scala/xml/HasKeyValue.scala @@ -6,16 +6,15 @@ ** |/ ** \* */ - package scala.xml -/**

- * Use this class to match on (unprefixed) attribute values - *

- *  val hasName = new HasKeyValue("name")
- *  node match {
- *    case Node("foo", hasName(x), _*) => x // foo had attribute with key "name" and with value x
- *  }
+/** Use this class to match on (unprefixed) attribute values + * {{{ + * val hasName = new HasKeyValue("name") + * node match { + * case Node("foo", hasName(x), _*) => x // foo had attribute with key "name" and with value x + * } + * }}} * * @author Burak Emir */ -- cgit v1.2.3