Merge remote-tracking branch 'origin/2.10.2' into merge/2.10.2-to-2.10.x

Better late than never.

Conflicts:
	src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
SI-7486 More tests for cycles triggered by implicit search

Moved an existing test from `pending` to `pos`. Not sure why
it was moved to `pending` in the first place.

Adds a new test distilled from building Scalaz with 2.10.3-RC1.
SI-942 A test case, five years adrift.

I'm looking at the changes made in 47f35b587, which
prevented cyclic errors in class file parsing. That fix
is insufficient for, or otherwise complicit in, SI-7778, for
which I've enclosed a pending test.
SI-7779 Account for class name compactification in reflection

We have to assume that the classes we are reflecting on were
compiled with the default value for -Xmax-classfile-name (255).

With this assumption, we can apply the same name compactification
as done in the regular compiler.

The REPL is particularly prone to generating long class names
with the '$iw' prefixes, so this is an important fix for runtime
reflection.

Also adds support for getting the runtime class of `O.type` if
`O` is a module.
Merge pull request #2870 from retronym/ticket/7778

SI-942 A test case, five years adrift.
SI-7775 Harden against the shifting sands of System.getProperties

If another thread writes a new system property (which can happen
in pretty innocuous code such as `new Date`!), the compiler startup
could fail with a `ConcurrentModificationException` as it iterated
all bindings in the properties map in search of a boot classpath
property for esoteric JVMs.

This commit uses `Properties#getStringProperties` to get a snapshot
of the keys that isn't backed by the live map, and iterates these
instead. That method will also limit us to bindings with String
values, which is all that we expect.
Merge pull request #2860 from retronym/merge/2.10.2-to-2.10.x

Merge/2.10.2 to 2.10.x
SI-7782 Derive type skolems at the ground level

Rather than at the current value of `skolemizationLevel`,
which could be influenced by an in-flight existential
subtype computation.

This method is called in `PolyTypeCompleter`, which
could be constructed by the lazy type completer of the
enclosing class. So currently it is closing over a mutable
variable; hence the Heisenbug.

This issue was exposed by the changes in b74c33eb860,
which was introduced in Scala 2.10.1.
typedAnnotated no longer emits nulls

Adds a null-check in original synthesis for the result of typedAnnotated.
Previously it was possible for the aforementioned result to look like
TypeTree(<tpe>) setOriginal Annotated(..., null). Not anymore.
Merge pull request #2871 from retronym/ticket/7779

SI-7779 Account for class name compactification in reflection
SI-7269 Rework MapLike#retains to account for desugaring change

`MapLike#retains` contains a for-comprehension that relied on the strict
`filter` by its generator. You can't, in general, iterate a mutable map
and remove items in the same pass.

Here's the history of the desugaring of:

    def retain[A, B](thiz: mutable.Map[A, B])(p: (A, B) => Boolean): thiz.type = {
      thiz.foreach {
        case (k, v) =>
          if (p(k, v)) thiz -= k
      }

Before regression (c82ecabad6~1):

    thiz.filter(((check$ifrefutable$1) => check$ifrefutable$1: @scala.unchecked match {
       case scala.Tuple2((k @ _), (v @ _)) => true
       case _ => false
    })).withFilter(((x$1) => x$1: @scala.unchecked match {
       case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang
    })).foreach(((x$2) => x$2: @scala.unchecked match {
       case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k)
    }));

After regression (c82ecabad6, which incorrectly assumed in the parser that
no filter is required for isInstanceOf[Tuple2])

    thiz.withFilter(((x$1) => x$1: @scala.unchecked match {
       case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang
    })).foreach(((x$2) => x$2: @scala.unchecked match {
      case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k)
    }));

After the reversion of c82ecabad6, v2.10.2
This is also after 365bb2b4e, which uses `withFilter` rather than `filter`.

    thiz.withFilter(((check$q$1) => check$ifrefutable$1: @scala.unchecked match {
       case scala.Tuple2((k @ _), (v @ _)) => true
       case _ => false
    })).withFilter(((x$1) => x$1: @scala.unchecked match {
       case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang
    })).foreach(((x$2) => x$2: @scala.unchecked match {
      case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k)
    }));

This commit does the same as `SetLike#retains`, and converts the map to
an immutable list before the rest of the operation.
Merge pull request #2868 from retronym/ticket/7775

SI-7775 Harden against the shifting sands of System.getProperties
[nomaster] SI-7790 No ScriptEngine in 2.10 build

The service entry was inadvertendly added in
`e3b5e0ba40447970d621cfeed5cc1770df69884f`,
"Sanity for build.xml: exscriptus&positus delendus est,"
which is ant latin for: "Reduced copy/pasting to the best
of my antabilities."

With that degree of hubris, it was inevitable that the
commit introduced a copy/paste bug.  What is the Attic
Greek for copy/paste?

I'm pretty sure that in fifth century Athens they would
just pound one inscription to rubble using a bigger
inscription. They had slaves for that kind of work.
You never hear about Socrates tweaking the build script.
That's the reason he never wrote anything down.
update typesafe.artifactory-online.com to private-repo
[nomaster] SI-7652 Bad tools fails loudly

A brief message is all that's required to
alleviate the look of consternation on the
face of your user.
[nomaster] SI-7652 REPL extended quest for tools

Javap tries harder and fails louder when
looking for tools.jar

This is a backport of the method as it
was first coded for partest.

If JAVA_HOME is wrong, it will either
fail with a message or succeed after
rooting about.

```
apm@mara:~/tmp/q$ JAVA_HOME=$JAVA7_HOME JAVACMD='/usr/lib/jvm/java-6-openjdk-amd64/bin/java' /home/apm/projects/snytt/build/pack/bin/scala
Welcome to Scala version 2.10.3-20130829-123337-59d6568daa (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :javap
:javap [-lcsvp] [path1 path2 ...]

scala> :javap java.lang.Object
Failed: Could not load javap tool. Check that JAVA_HOME is correct.

apm@mara:~/tmp/q$ JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/jre JAVACMD='/usr/lib/jvm/java-6-openjdk-amd64/bin/java' /home/apm/projects/snytt/build/pack/bin/scala
Welcome to Scala version 2.10.3-20130829-123337-59d6568daa (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.

scala>

scala> :javap
:javap [-lcsvp] [path1 path2 ...]

scala> :javap java.lang.Object
Compiled from "Object.java"
```
Commit .gitignore directly

Rather than relying on the cloner to copy the
provided gitignore.SAMPLE files.

This finishes the job started in c48509598, mostly
by reverting that commit and moving the two existing
SAMPLE files to the final destinations.

Use `.git/info/exclude` to augment the list of patterns
with entries specific to your workflow.
(cherry picked from commit b51cb581270da7021b2ea122dc059847101d56a7)

==============================================
Paring back the scope of our shared .gitignore

Importantly, limit the exclusion of build.properties
to the file in the root directory, paving the way for
the return of an SBT build.

  - Unignores .bak, .jar, and ~
  - limit ignorance of qbin to the root directory

.log files, generated by partest, are still ignored.

To see ignored files in your workspace, try:

    git ls-files --others --ignored --exclude-standard -- test | grep log
    git status --ignored -- test
(cherry picked from commit f0bbd2ca32acb40be37dc382c1f95081deca3f22)
Merge pull request #2897 from retronym/backport/gitignore

[backport] Commit .gitignore directly
Merge pull request #2891 from som-snytt/issue/7790-no-scriptengine

SI-7790 No ScriptEngine in 2.10 build
SI-4760 Parser handles block-ending import

Don't molest the RBRACE.

Updated with additional parse tests suggested
by @retronym.  "What are you lazy?"  Yes, I
must be lazy.  Can't ScalaCheck or Par-Test
generate these tests automatically?  That seems
like a reasonable expectation.