Restrict Import-Package for scala.*

Restrict the Import-Package OSGi manifest entry to match only binary compatible scala.* packages. This is necessary, because the Scala OSGi versions do not match the OSGi semantic versioning policy and are not binary compatible between their OSGi minor versions. This means that e.g. the scala-compiler-2.11 bundle will never work if it imports a scala.* package from 2.10 or 2.12. Thus this patch enforces a tight version range, only accepting versions within the same minor version. E.g. Applied to version 2.11.1 the range would expand to "[2.11,2.12)".

Additionally, a Java 6 execution environment will be enforced for OSGi.

All module bundles need to have their own version numbers. This was not the case before this commit. Although these module bundles were only build for testing, they are needed to be correct, now, that we have stricter package import constraints and some test cases rely on them.
Add JavaSE-1.7 to set of required execution environments.

Without it, Equinox on Java 7 might spit out some warnings, which might lead to the wrong impression, that the Scala bundles are not well supported for newer platforms.
Refined package imports for scala modules.

Made scala.xml.* import optional and removed scala.util.parsing.json import.
Re-added the scala.util.parsing package import, with optional resolution.
SI-8475 Fix off by one in GroupedIterator when Streaming

This also affected sliding and grouped since they defer to GroupedIterator
TypeTree printing modified (SI-8447)
SI-8553 WrappedArray throws exception on lastIndexWhere when index out of range

Adds a check in `IndexedSeqOptimized#lastIndexWhere(A => Boolean, Int)`
to begin searching in the end of the collection if `end` is greater than
the collection's length.

Discussed in
https://groups.google.com/d/topic/scala-internals/-MacXivbY0Q/discussion.
SI-8185 Correct grammar for single-warning compilation run
Bump versions for Scala 2.11.1
Upgrade ASM to 5.0.2

This commit is a squashed version of all commits in PR #3747.

For future upgrades, consult the README and check the commits in
https://github.com/scala/scala/pull/3747/commits

There's one bug in ASM 5.0.2 that breaks scalac:
http://forge.ow2.org/tracker/?func=detail&aid=317200&group_id=23&atid=100023

This bug is fixed in ASM trunk, the patch has been merged into this
commit. A future upgrade of ASM should contain the fix.
SI-8607 Fix erasure for value class inheriting from private class

The fix for SI-4283 added a pre-emptive cast of the qualifier of
a selection `qual.a` to avoid later casting to the owner of `a`
if that owner might be inaccessible at the call site. This fixed
a `LinkageError`.

In the enclosed test, this cast led to the following diff in the
tree shapes (with respect to a version with a public base class).

    [erasure]
    -        new p1.C.<init>(c.$asInstanceOf[scala.this.Int]()).a();
    +        new p1.C.<init>(new p1.C.<init>(c.$asInstanceOf[scala.this.Int]()).$asInstanceOf[ErasedValueType(    class C, scala.this.Int)]().$asInstanceOf[scala.this.Int]()).a();
    [posterasure]
    -        new p1.C.<init>(c).a();
    +        new p1.C.<init>(new p1.C.<init>(c).$asInstanceOf[scala.this.Int]().$asInstanceOf[scala.this.Int]())    .a();
             ()

What we really wanted to end up with is:

    new p1.C.<init>(c).$asInstanceOf[C]().a();

The stray cast leads to the crash:

    error: should have been unboxed by erasure: new p1.C.<init>(c).$asInstanceOf[scala.this.Int]()

Rather than trying to fix this in erasure/posterasure, this commit
instead relies on the fact the owner of `a` cannot be Java defined
if `qual`s type is a derived value class. This follows from the
restrictions we place on value classes.

With this knowledge, we elide the cast altogether in this case.
SI-8607 Generalize previous change to preErase

In the previous commit, we avoided an awkward chain of casts
by exploiting the knowledge that Scala defined classes will
by JVM accessible, and as such immune to `LinkageError`s when
used as the target of a cast.

This commit generalized this to the entire fix for SI-4283,
rather than just for derived value classes.
Merge pull request #3767 from lrytz/opt/asmUpgradeSquash

Upgrade ASM to 5.0.2
SI-8609 Fix flattening of definitions and imports in quasiquotes

Quasiquotes allow to unquote trees with ..$ with block flattening
semantics to simplify composition:

  val onetwo = q"1; 2"
  val onetwothree = q"..$onetwo; 3" // same as q"1; 2; 3"

If there is no block it will be equivalent to $ unquoting:

  val one = q"1"
  val onetwo = q"..$one; 2" // same as q"1; 2"

But the inconsistency here is that currently only terms support
this single-element semantics. This commit extends this functionality
to also support definitions and imports. So that following code works:

  val q1 = q"val x = 1"
  val q2 = q"..$q1; val y = 2" // same as q"val x = 1; val y = 2"
Cleanups for tracing in GenBCode, improve some comments
Minor cleanups and commenting around BType.

Use `length` instead of `size` on arrays in `reflect/internal/Names`.
Cleanups in Names.scala

Enter only fully constructed Name objects into the hash table, this
should make lookupTypeName thread-safe.

Clean up lookupTypeName - the hash code for a type name is the same
as for its correspondent term name.

Going from a type name toTermName should never create a new TermName
instance. Assert that.
Re-use the exsiting range of the name table when using subName.

The sub-name can just point to a smaller range of the array.
More cleanups and commenting in GenBCode
Move class BType to separate component, include it by composition.

Rewire BType in its new location with the rest of the backend.

Remove the now-empty BCodeGlue.