diff options
author | Josh Suereth <joshua.suereth@gmail.com> | 2011-12-06 08:01:53 -0500 |
---|---|---|
committer | Josh Suereth <joshua.suereth@gmail.com> | 2011-12-06 08:01:53 -0500 |
commit | 57eb3abad07a5a8e07f84312857098e0bb22bcf4 (patch) | |
tree | 73bbc19dbad5ff6927da5e3fe5a8fbe46b2f72f5 | |
parent | 47fb0d381022bda800b7f8ee234224aa20020e4a (diff) | |
parent | 6a33a206196d95d931b5569b466275c19426e5b2 (diff) | |
download | scala-57eb3abad07a5a8e07f84312857098e0bb22bcf4.tar.gz scala-57eb3abad07a5a8e07f84312857098e0bb22bcf4.tar.bz2 scala-57eb3abad07a5a8e07f84312857098e0bb22bcf4.zip |
Merge branch 'master' into xsbt
30 files changed, 93 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala b/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala index 70aa8ff54e..865bacffaa 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala @@ -7,7 +7,7 @@ package scala.tools.nsc package backend.jvm import ch.epfl.lamp.fjbg._ -import java.io.{ DataOutputStream, OutputStream, File => JFile } +import java.io.{ DataOutputStream, FileOutputStream, OutputStream, File => JFile } import scala.tools.nsc.io._ import scala.tools.nsc.util.ScalaClassLoader import scala.tools.util.JavapClass @@ -85,7 +85,7 @@ trait BytecodeWriters { emitJavap(bytes, javapFile) } } - + trait ClassBytecodeWriter extends BytecodeWriter { def writeClass(label: String, jclass: JClass, sym: Symbol) { val outfile = getFile(sym, jclass, ".class") @@ -96,4 +96,20 @@ trait BytecodeWriters { informProgress("wrote '" + label + "' to " + outfile) } } + + trait DumpBytecodeWriter extends BytecodeWriter { + val baseDir = Directory(settings.Ydumpclasses.value).createDirectory() + + abstract override def writeClass(label: String, jclass: JClass, sym: Symbol) { + super.writeClass(label, jclass, sym) + + val pathName = jclass.getName() + var dumpFile = pathName.split("[./]").foldLeft(baseDir: Path) (_ / _) changeExtension "class" toFile; + dumpFile.parent.createDirectory() + val outstream = new DataOutputStream(new FileOutputStream(dumpFile.path)) + + try jclass writeTo outstream + finally outstream.close() + } + } } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 3fa5158a4a..78fab859a3 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -129,7 +129,12 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with new DirectToJarfileWriter(f.file) case _ => - if (settings.Ygenjavap.isDefault) new ClassBytecodeWriter { } + if (settings.Ygenjavap.isDefault) { + if(settings.Ydumpclasses.isDefault) + new ClassBytecodeWriter { } + else + new ClassBytecodeWriter with DumpBytecodeWriter { } + } else new ClassBytecodeWriter with JavapBytecodeWriter { } } diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 6be15e4e98..7fcfb6fc6d 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -139,6 +139,7 @@ trait ScalaSettings extends AbsScalaSettings val Yshowsyms = BooleanSetting ("-Yshow-syms", "Print the AST symbol hierarchy after each phase.") val skip = PhasesSetting ("-Yskip", "Skip") val Ygenjavap = StringSetting ("-Ygen-javap", "dir", "Generate a parallel output directory of .javap files.", "") + val Ydumpclasses = StringSetting ("-Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "") val Ynosqueeze = BooleanSetting ("-Yno-squeeze", "Disable creation of compact code in matching.") val Ystatistics = BooleanSetting ("-Ystatistics", "Print compiler statistics.") . withPostSetHook(set => util.Statistics.enabled = set.value) diff --git a/src/library/scala/collection/immutable/BitSet.scala b/src/library/scala/collection/immutable/BitSet.scala index ce4d688707..4e2f5e45b5 100644 --- a/src/library/scala/collection/immutable/BitSet.scala +++ b/src/library/scala/collection/immutable/BitSet.scala @@ -17,6 +17,9 @@ import mutable.{ Builder, SetBuilder } /** A class for immutable bitsets. * $bitsetinfo + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_21.html "The Scala 2.8 Collections API"]] + * section on `Immutable BitSets` for more information. + * * @define Coll immutable.BitSet * @define coll immutable bitset */ diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala index 79ee067d63..358a085e86 100644 --- a/src/library/scala/collection/immutable/HashMap.scala +++ b/src/library/scala/collection/immutable/HashMap.scala @@ -25,6 +25,8 @@ import parallel.immutable.ParHashMap * @author Tiark Rompf * @version 2.8 * @since 2.3 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_19.html "The Scala 2.8 Collections API"]] + * section on `Hash Tries` for more information. * @define Coll immutable.HashMap * @define coll immutable hash map * @define mayNotTerminateInf diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index d5e5f2aee0..b6714f9dde 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -57,6 +57,9 @@ import annotation.tailrec * @author Martin Odersky and others * @version 2.8 * @since 1.0 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_13.html "The Scala 2..8 Collections API"]] + * section on `Lists` for more information. + * * @tparam A the type of the list's elements * diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala index b2b933c51a..2231da510a 100644 --- a/src/library/scala/collection/immutable/ListMap.scala +++ b/src/library/scala/collection/immutable/ListMap.scala @@ -16,6 +16,9 @@ import annotation.{tailrec, bridge} /** $factoryInfo * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_22.html "The Scala 2.8 Collections API"]] + * section on `List Maps` for more information. + * * @define Coll immutable.ListMap * @define coll immutable list map */ diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala index 6e73eef101..53ed227e51 100644 --- a/src/library/scala/collection/immutable/Queue.scala +++ b/src/library/scala/collection/immutable/Queue.scala @@ -27,6 +27,9 @@ import annotation.tailrec * @author Erik Stenman * @version 1.0, 08/07/2003 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_17.html "The Scala 2.8 Collections API"]] + * section on `Ummutable Queues` for more information. + * * @define Coll immutable.Queue * @define coll immutable queue * @define mayNotTerminateInf diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala index 3736096f36..f089298350 100644 --- a/src/library/scala/collection/immutable/Range.scala +++ b/src/library/scala/collection/immutable/Range.scala @@ -31,6 +31,9 @@ import annotation.bridge * @author Paul Phillips * @version 2.8 * @since 2.5 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_18.html "The Scala 2.8 Collections API"]] + * section on `Ranges` for more information. + * * @define Coll Range * @define coll range * @define mayNotTerminateInf diff --git a/src/library/scala/collection/immutable/Stack.scala b/src/library/scala/collection/immutable/Stack.scala index d65300ecb7..4de0f9e8f4 100644 --- a/src/library/scala/collection/immutable/Stack.scala +++ b/src/library/scala/collection/immutable/Stack.scala @@ -34,6 +34,9 @@ object Stack extends SeqFactory[Stack] { * @author Matthias Zenger * @version 1.0, 10/07/2003 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_16.html "The Scala 2.8 Collections API"]] + * section on `Immutable stacks` for more information. + * * @define Coll immutable.Stack * @define coll immutable stack * @define orderDependent diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala index 7bae387ad2..cb387c6316 100644 --- a/src/library/scala/collection/immutable/Stream.scala +++ b/src/library/scala/collection/immutable/Stream.scala @@ -172,6 +172,9 @@ import Stream.cons * @author Martin Odersky, Matthias Zenger * @version 1.1 08/08/03 * @since 2.8 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_14.html "The Scala 2.8 Collections API"]] + * section on `Streams` for more information. + * @define naturalsEx def naturalsFrom(i: Int): Stream[Int] = i #:: naturalsFrom(i + 1) * @define Coll Stream * @define coll stream diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala index a46583c541..66f8763a8d 100644 --- a/src/library/scala/collection/immutable/TreeMap.scala +++ b/src/library/scala/collection/immutable/TreeMap.scala @@ -36,6 +36,9 @@ object TreeMap extends ImmutableSortedMapFactory[TreeMap] { * @author Matthias Zenger * @version 1.1, 03/05/2004 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_20.html "The Scala 2.8 Collections API"]] + * section on `Red-Black Trees` for more information. + * * @define Coll immutable.TreeMap * @define coll immutable tree map * @define orderDependent diff --git a/src/library/scala/collection/immutable/TreeSet.scala b/src/library/scala/collection/immutable/TreeSet.scala index 3fa1213359..966e03b984 100644 --- a/src/library/scala/collection/immutable/TreeSet.scala +++ b/src/library/scala/collection/immutable/TreeSet.scala @@ -36,6 +36,9 @@ object TreeSet extends ImmutableSortedSetFactory[TreeSet] { * @author Martin Odersky * @version 2.0, 02/01/2007 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_20.html "The Scala 2.8 Collections API"]] + * section on `Red-Black Trees` for more information. + * * @define Coll immutable.TreeSet * @define coll immutable tree set * @define orderDependent diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala index ab12300097..03cd98d20e 100644 --- a/src/library/scala/collection/immutable/Vector.scala +++ b/src/library/scala/collection/immutable/Vector.scala @@ -35,6 +35,9 @@ object Vector extends SeqFactory[Vector] { * endian bit-mapped vector trie with a branching factor of 32. Locality is very good, but not * contiguous, which is good for very large sequences. * + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_15.html "The Scala 2.8 Collections API"]] + * section on `Vectors` for more information. + * * @tparam A the element type * * @define Coll Vector diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala index ea56eee395..503ada0153 100644 --- a/src/library/scala/collection/mutable/ArrayBuffer.scala +++ b/src/library/scala/collection/mutable/ArrayBuffer.scala @@ -23,6 +23,9 @@ import parallel.mutable.ParArray * @author Martin Odersky * @version 2.8 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_38.html "The Scala 2.8 Collections API"]] + * section on `Concrete Mutable Collection Classes` for more information. + * * @tparam A the type of this arraybuffer's elements. * diff --git a/src/library/scala/collection/mutable/ArraySeq.scala b/src/library/scala/collection/mutable/ArraySeq.scala index 414d80b462..3f7066b40f 100644 --- a/src/library/scala/collection/mutable/ArraySeq.scala +++ b/src/library/scala/collection/mutable/ArraySeq.scala @@ -21,6 +21,8 @@ import parallel.mutable.ParArray * @author Martin Odersky * @version 2.8 * @since 2.8 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_31.html "The Scala 2.8 Collections API"]] + * section on `Array Sequences` for more information. * * @tparam A type of the elements contained in this array sequence. * @param length the length of the underlying array. diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala index c46955477b..faa22b948e 100644 --- a/src/library/scala/collection/mutable/ArrayStack.scala +++ b/src/library/scala/collection/mutable/ArrayStack.scala @@ -46,6 +46,8 @@ object ArrayStack extends SeqFactory[ArrayStack] { * * @author David MacIver * @since 2.7 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_33.html "The Scala 2.8 Collections API"]] + * section on `Array Stacks` for more information. * * @tparam T type of the elements contained in this array stack. * diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala index 9dce3ff9e2..03228f91b1 100644 --- a/src/library/scala/collection/mutable/BitSet.scala +++ b/src/library/scala/collection/mutable/BitSet.scala @@ -18,6 +18,9 @@ import BitSetLike.{LogWL, updateArray} * * $bitsetinfo * + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_37.html "The Scala 2.8 Collections API"]] + * section on `Mutable Bitsets` for more information. + * * @define Coll BitSet * @define coll bitset * @define thatinfo the class of the returned collection. In the standard library configuration, diff --git a/src/library/scala/collection/mutable/ConcurrentMap.scala b/src/library/scala/collection/mutable/ConcurrentMap.scala index 7e526fd4ea..be7718591b 100644 --- a/src/library/scala/collection/mutable/ConcurrentMap.scala +++ b/src/library/scala/collection/mutable/ConcurrentMap.scala @@ -14,6 +14,8 @@ package mutable * $concurrentmapinfo * * @since 2.8 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_36.html "The Scala 2.8 Collections API"]] + * section on `Concurrent Maps` for more information. * * @tparam A the key type of the map * @tparam B the value type of the map diff --git a/src/library/scala/collection/mutable/DoubleLinkedList.scala b/src/library/scala/collection/mutable/DoubleLinkedList.scala index dd111b3800..0934cfa081 100644 --- a/src/library/scala/collection/mutable/DoubleLinkedList.scala +++ b/src/library/scala/collection/mutable/DoubleLinkedList.scala @@ -20,6 +20,9 @@ import generic._ * @author Martin Odersky * @version 2.8 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_28.html "The Scala 2.8 Collections API"]] + * section on `Double Linked Lists` for more information. + * * @tparam A the type of the elements contained in this double linked list. * diff --git a/src/library/scala/collection/mutable/HashMap.scala b/src/library/scala/collection/mutable/HashMap.scala index c86ee39256..3c26ef0ab6 100644 --- a/src/library/scala/collection/mutable/HashMap.scala +++ b/src/library/scala/collection/mutable/HashMap.scala @@ -15,6 +15,8 @@ import scala.collection.parallel.mutable.ParHashMap /** This class implements mutable maps using a hashtable. * * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_34.html "The Scala 2.8 Collections API"]] + * section on `Hash Tables` for more information. * * @tparam A the type of the keys contained in this hash map. * @tparam B the type of the values assigned to keys in this hash map. diff --git a/src/library/scala/collection/mutable/HashSet.scala b/src/library/scala/collection/mutable/HashSet.scala index 6a6964609c..7834c93ac4 100644 --- a/src/library/scala/collection/mutable/HashSet.scala +++ b/src/library/scala/collection/mutable/HashSet.scala @@ -22,6 +22,8 @@ import collection.parallel.mutable.ParHashSet * @author Martin Odersky * @version 2.0, 31/12/2006 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_34.html "The Scala 2.8 Collections API"]] + * section on `Hash Tables` for more information. * * @define Coll mutable.HashSet * @define coll mutable hash set diff --git a/src/library/scala/collection/mutable/LinearSeq.scala b/src/library/scala/collection/mutable/LinearSeq.scala index e29d6bf3e6..9f7443da0e 100644 --- a/src/library/scala/collection/mutable/LinearSeq.scala +++ b/src/library/scala/collection/mutable/LinearSeq.scala @@ -19,6 +19,8 @@ import generic._ * * @define Coll LinearSeq * @define coll linear sequence + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_29.html "The Scala 2.8 Collections API"]] + * section on `Mutable Lists` for more information. */ trait LinearSeq[A] extends Seq[A] with scala.collection.LinearSeq[A] diff --git a/src/library/scala/collection/mutable/LinkedList.scala b/src/library/scala/collection/mutable/LinkedList.scala index 65391f5884..6311a01b65 100644 --- a/src/library/scala/collection/mutable/LinkedList.scala +++ b/src/library/scala/collection/mutable/LinkedList.scala @@ -33,6 +33,8 @@ import generic._ * @author Martin Odersky * @version 2.8 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_27.html "The Scala 2.8 Collections API"]] + * section on `Linked Lists` for more information. * * @tparam A the type of the elements contained in this linked list. * diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala index 233544c4ca..812b4010b4 100644 --- a/src/library/scala/collection/mutable/ListBuffer.scala +++ b/src/library/scala/collection/mutable/ListBuffer.scala @@ -21,6 +21,8 @@ import immutable.{List, Nil, ::} * @author Martin Odersky * @version 2.8 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_25.html "The Scala 2.8 Collections API"]] + * section on `List Buffers` for more information. * * @tparam A the type of this list buffer's elements. * diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala index 20910e48f4..de7f82095e 100644 --- a/src/library/scala/collection/mutable/MutableList.scala +++ b/src/library/scala/collection/mutable/MutableList.scala @@ -23,6 +23,8 @@ import immutable.{List, Nil} * @author Martin Odersky * @version 2.8 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_29.html "The Scala 2.8 Collections API"]] + * section on `Mutable Lists` for more information. */ @SerialVersionUID(5938451523372603072L) class MutableList[A] diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala index e1723241f5..875ad12363 100644 --- a/src/library/scala/collection/mutable/Queue.scala +++ b/src/library/scala/collection/mutable/Queue.scala @@ -20,6 +20,8 @@ import generic._ * @author Martin Odersky * @version 2.8 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_30.html "The Scala 2.8 Collections API"]] + * section on `Queues` for more information. * * @define Coll mutable.Queue * @define coll mutable queue diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala index c795609b67..0b4578dcc9 100644 --- a/src/library/scala/collection/mutable/Stack.scala +++ b/src/library/scala/collection/mutable/Stack.scala @@ -44,6 +44,8 @@ object Stack extends SeqFactory[Stack] { * @author Martin Odersky * @version 2.8 * @since 1 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_32.html "The Scala 2.8 Collections API"]] + * section on `Array Sequences` for more information. * @define Coll Stack * @define coll stack * @define orderDependent diff --git a/src/library/scala/collection/mutable/StringBuilder.scala b/src/library/scala/collection/mutable/StringBuilder.scala index 6fb4b839ef..27c1404e3e 100644 --- a/src/library/scala/collection/mutable/StringBuilder.scala +++ b/src/library/scala/collection/mutable/StringBuilder.scala @@ -21,6 +21,8 @@ import immutable.StringLike * @author Martin Odersky * @version 2.8 * @since 2.7 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_26.html "The Scala 2.8 Collections API"]] + * section on `StringBuilders` for more information. */ @SerialVersionUID(0 - 8525408645367278351L) final class StringBuilder(private val underlying: JavaStringBuilder) diff --git a/src/library/scala/collection/mutable/WeakHashMap.scala b/src/library/scala/collection/mutable/WeakHashMap.scala index be2daa05ce..188cca2917 100644 --- a/src/library/scala/collection/mutable/WeakHashMap.scala +++ b/src/library/scala/collection/mutable/WeakHashMap.scala @@ -23,6 +23,9 @@ import generic._ * @tparam B type of values associated with the keys * * @since 2.8 + * @see [[http://www.scala-lang.org/docu/files/collections-api/collections_34.html "The Scala 2.8 Collections API"]] + * section on `Hash Tables` for more information. + * * @define Coll WeakHashMap * @define coll weak hash map * @define thatinfo the class of the returned collection. In the standard library configuration, |