SI-8925, SI-7407 test cases, fixed in new backend

Given that the issues are old (2.10) and we move to the new backend
in 2.12, I don't plan to fix them in GenASM.

The test case for 7407 existed already, this commit just adds
`-Yopt:l:none` to the flags to make no dead code is eliminated.
SI-6502 Reenables loading jars into the running REPL (regression in 2.10)

Fixes SI-6502, reenables loading jars into the running REPL
(regression in 2.10). This PR allows adding a jar to the compile
and runtime classpaths without resetting the REPL state (crucial
for Spark SPARK-3257).

This follows the lead taken by @som-snytt in PR #3986, which
differentiates two jar-loading behaviors (muddled by cp):

  - adding jars and replaying REPL expressions (using replay)
  - adding jars without resetting the REPL (deprecated cp,
    introduced require) This PR implements require (left
    unimplemented in #3986)

This PR is a simplification of a similar approach taken by
@gkossakowski in #3884. In this attempt, we check first to make
sure that a jar is only added if it only contains new
classes/traits/objects, otherwise we emit an error. This differs
from the old invalidation approach which also tracked deleted
classpath entries.
SI-6502 Addressing review comments
SI-6502 Addresses @som-snytt's feedback
SI-6502 Addresses comments by @som-snytt
Adds tests that programatically generate jars
Addresses review comments
SI-6502 Moving methods concerned with the state of Global from IMain to Global
SI-8967 Only add JARs and dirs from $SCALA_HOME/lib to classpath

That's all we ship in that directory, but it seems that some
JVMs freak out with a core dump if something else ends up
in that directory and we add it to the boot classpath.

Testing on unix:

    % rm ./build/pack/bin.complete; ant
    % touch /Users/jason/code/scala/build/pack/lib/foo.txt
    % mkdir /Users/jason/code/scala/build/pack/lib/dir
    % bash -x ./build/pack/bin/scala -version
    ...
    /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java -Xmx256M -Xms32M -Xbootclasspath/a:/Users/jason/code/scala/build/pack/lib/dir:/Users/jason/code/scala/build/pack/lib/jline.jar:/Users/jason/code/scala/build/pack/lib/scala-actors.jar:/Users/jason/code/scala/build/pack/lib/scala-compiler.jar:/Users/jason/code/scala/build/pack/lib/scala-continuations-library_2.11-1.0.2.jar:/Users/jason/code/scala/build/pack/lib/scala-continuations-plugin_2.11.2-1.0.2.jar:/Users/jason/code/scala/build/pack/lib/scala-library.jar:/Users/jason/code/scala/build/pack/lib/scala-parser-combinators_2.11-1.0.2.jar:/Users/jason/code/scala/build/pack/lib/scala-partest-extras.jar:/Users/jason/code/scala/build/pack/lib/scala-partest-javaagent.jar:/Users/jason/code/scala/build/pack/lib/scala-reflect.jar:/Users/jason/code/scala/build/pack/lib/scala-swing_2.11-1.0.1.jar:/Users/jason/code/scala/build/pack/lib/scala-xml_2.11-1.0.2.jar:/Users/jason/code/scala/build/pack/lib/scalap.jar -classpath '""' -Dscala.home=/Users/jason/code/scala/build/pack -Dscala.usejavacp=true -Denv.emacs= scala.tools.nsc.MainGenericRunner -version

The boot classpath contains `build/pack/lib/dir` but not `foo.txt`.

I will seek a Windows test of the same during PR review.
SI-8534 Avoid crash in erroneous SelectFromTypeTree

PR #2374 changed the behaviour of `typedSingletonTypeTree` in the
presence of an error typed reference tree. It incorrectly
returns the reference tree in case on an error. However, this is
a term tree, which is an inconsistent result with the input type
tree. Consequently, a `typedSelectInternal` later fails when
using this as the qualifier of a `SelectFromTypeTree`.

Both test cases enclosed show this symptom.

This commit:

  - Returns `tree` rather than `refTyped` when `refTyped` is
    error typed or when it isn't suitable as a stable prefix.
  - Avoids issuing a cascading "not a stable prefix" error if the
    `refTyped` is error typed.
  - Adds an extra layer of defense in `typedSelectFromTypeTree`
    to bail out quickly if the qualifier is error typed.

The last measure is not necessary to fix this bug.
SI-8449 Fix spurious error with Java raw type over a Scala class

When the Scala typechecker typechecks signatures in Java sources,
it must enable use of a type constructor without applied type
arguments (a raw type).

However, the check in `adaptType::properTypeRequired` was too
restricive: it only allows raw types given a) we are typechecking a
Java source file and b) the type constructor itself is Java defined.

The second check does not make sense; it is perfectly legal to define
a Java raw type for over a Scala defined type constructor. This commit
removes it.

The bug was noticed in the Scaladoc context, as it explores the
signatures of all Java sources so it can document them. But the
enclosed test demonstrates the underlying bug under normal
compilation.
SI-6502 Refactorings suggested by review
- Moves mergeUrlsIntoClassPath from Global into ClassPath
- Revises and documents AbstractFile.getURL
SI-8932 Fix dropRight/takeRight implementations

I looked up at all the overrides of `IterableLike#takeRight` and
`IterableLike#dropRight` and replaced usages of its argument `n` with
`math.max(n, 0)` every time it was being used in an index subtraction.

Fixes [SI-8932](https://issues.scala-lang.org/browse/SI-8932).
SI-8835 Iterator tests can be junit

Without loss of generality or convenience, but helps
reduce the number of files in test/files and may reduce
compile times for test suite.

This commit includes the fix from #3963 and an extra
test of that fix that ensures the stack doesn't grow
on chained drops.
SI-8977 remove duplicate decoder.properties from scalap

All .properties files in sources folder are already included in the
packed jar (see line 1028), so there is no need to add it again.
SI-8835 Update iterator tests

Addressing feedback from the collections test czar,
updated a few of the primitive tests.  Avoided testing
addition and just asserted.

Updated indexOf test to test Iterator.indexOf.
Add curly brace (zero-or-more) in grammar for Bindings

Missing closing curly brace as reported by Andre at https://groups.google.com/forum/#!topic/scala-language/4Zb6dc6EEFM.
Merge pull request #4113 from retronym/ticket/8967

SI-8967 Only add JARs and dirs from $SCALA_HOME/lib to classpath
Merge pull request #4114 from retronym/ticket/8534

SI-8534 Avoid crash in erroneous SelectFromTypeTree
Merge pull request #4117 from retronym/ticket/8449

SI-8449 Fix spurious error with Java raw type over a Scala class