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
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.
Bump version number to 2.11.2
Merge pull request #3779 from adriaanm/2.11.1

Bump version number to 2.11.2
SI-8617 Avoid rangepos crash for OptManifest materializer

The tree to create a `NoManifest` was unpositioned.
SI-8346: Rebuild invariant sets in #toSet, avoiding CCE.

SI-3953 caused several types of sets' operations to trivially throw
`ClassCastException` after using inherited covariant #toSet method, by
doing an unchecked cast that is only safe for intrinsically covariant
set data structures like `HashSet`, but totally unsafe for others like
`TreeSet` or `Enumeration.ValueSet`.

This change moves the cast to the leaves of the class hierarchy where
that is safe, and incidentally undeprecates overriding Set#toSet.
Merge pull request #3790 from retronym/ticket/8617

SI-8617 Avoid rangepos crash for OptManifest materializer
Eliminate some N^2 performance in type checking

Where N is the number of members of the enclosing package.

Double definition errors for top level classes/objects are issued
elsewhere, as demonstrated by the enclosed test. So we can
omit the call to `checkNoDoubleDefs` in this content.

We can't omit the call to `addSynthetics` for package
class owners (case- and value-class synthetic companions
are added here), but we can make the process cheaper by
moving the expensive-but-usually-true call to `shouldAdd`.

Here's an example of the improvement.

    % rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time scalac-hash v2.11.0 -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala;

    real    0m49.762s
    user    1m12.376s
    sys 0m2.371s

    % rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time qbin/scalac -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala;

    real    0m35.662s
    user    0m58.275s
    sys 0m2.355s

We've still got another source of pathological performance in
creating nested scopes that I'll fix in the next commit.
Optimize nested scope creation

We can copy the hash table from the parent scope, rather
than constructing it from scratch.

This takes us to:

	% rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time qbin/scalac -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala;

	real	0m19.639s  // head~1 was 0m35.662s
	user	0m41.683s  // head~1 was 0m58.275s
	sys	0m1.886s

In more detail, this commit:

  - Removes the unused `fingerprint` constructor parameter from
    scopes. This is a remnant from a previous optimization attempt
  - Leave only one constructor on Scope which creates an empty
    scope
  - Update the factory method, `newNestedScope`, to copy the hash
    table from the parent if it exists. We can rely on the invariant
    that `outer.hashTable != null || outer.size < MIN_HASH)`, so we
    don't need `if (size >= MIN_HASH) createHash()` anymore. This
    used to be needed in `Scope#<init>`, which accepted an aribitrary
    `initElems: ScopeEntry`.
  - Update subclasses and factories of `Scope` in runtime reflection
    to accomodate the change. Pleasingly, we could actually remove
    the override for `newNestedScope`.
  - Unit tests the functionality I'm touching
Fast path in Namer for methods without defaults

Either direct defaults, or directly inherited.

The avoids `addDefaultGetters` in most cases, and the expensive
duplication of trees therein.
Optimize enforcement of dependent method type restrictions

  - No need to check the result type, as dependent method types
    are now enabled unconditionally.
  - This also means we can only need to check methods with two or
    more parameter lists.
SI-8625 fix unreachability analysis for boolean expressions
Merge pull request #3782 from retronym/topic/opt-scope

Compiler optimizations for Scopes, checkDoubleDefs, Namer
Merge pull request #3794 from lrytz/t8625

SI-8625 fix unreachability analysis for boolean expressions
Merge pull request #3733 from retronym/topic/pr-3712-resubmit

SI-8475 Fix off by one in GroupedIterator when Streaming