SI-7519 Less brutal attribute resetting in adapt fallback

Prefers `resetLocalAttrs` over `resetAllAttrs`. The latter loses
track of which enclosing class of the given name is referenced by
a `This` node which prefixes the an applied implicit view.

The code that `resetAllAttrs` originally landed in: https://github.com/scala/scala/commit/d4c63b#L6R804
Test for reading JDK 8 (classfile format 52) class files.

This commit includes a test for reading JDK 8 (classfile format 52)
class files, in particular default (aka defender) methods. It uses ASM
to generate an interface with default methods then exercises that
interface from Scala.

Surprisingly no changes are necessary to the Scala code base to support
reading format 52 class files.

Because the test can only run under JDK 8, the JDK version is checked
and the expected output is synthesized for previous versions.
SI-7498 ParTrieMap.foreach no longer crashes

Previously, the `split` method of the `ParTrieMap` iterator threw
an exception when splitting a splitter that iterated over nodes
whose hash codes collide.
This was due to reusing the iterator of the list of colliding keys
rather than creating a new splitter.

This commit changes the `subdivide` method to create a new
iterator using the factory method of the current trie map
iterator rather than returning a `LinearSeqLike` iterator.
SI-6841 Fix bug at the intersection of DelayedInit and named args

The DelayedInit transformation analyses the constructor to partition
regular initialization from calls to super constructors / trait
initializers.

It failed to find such super calls if they were nested in a Block,
which can happens when using named or default arguments.

This commit makes that code peer into Blocks to correctly partition
the constructor statements.

This change doesn't affect the result of run/t4680.scala, which was
mentioned in nearby comments and which chronicles bugs with DelayedInit
when used in inheritance hierarchies.
Refactor testing logic for only running under certain JDK versions

We had several tests designed to only run if the JDK version was at
least some specified version. This commit refactors that common logic
into DirectTest.
SI-7556 Fix runtime reflection involving ScalaLongSignature

Scala type information is stored in classfiles in encoded in a String
in the ScalaSignature annotation. When it is too big for a single
String, it is split into an array of Strings in a different annotation,
ScalaLongSignature.

The enclosed test, with a class containing 3000 methods, uses the latter.
It exposes a bug in the way runtime reflection decodes that data.

It must concatentate and *then* decode, rather that the other way around.
SI-7418 Avoid concurrent use of compiler in REPL startup

Enable the tab completer *after* we're finished binding
$intp and unleashing power mode on the asynchronous
REPL startup thread.

Tested manually:
 - run qbin/scala
 - Paste "".toUp
 - Hit <TAB> like a maniac

Before this patch, the crash was reproducible almost every time.
Afterwards, not the once.
SI-7264 Initialize owner when searching for companion.

From ClassSymbol:

    protected final def companionModule0: Symbol =
      flatOwnerInfo.decl(name.toTermName).suchThat(sym => sym.isModuleNotMethod && (sym isCoDefinedWith this))

    protected final def flatOwnerInfo: Type = {
      if (needsFlatClasses)
        info
      owner.rawInfo
    }

Note the call to `rawInfo`; in the enclosed test case, that gives
us back an uninitialized type for the module class of `Foo`, and
consequently we don't find the companion for `Foo.Values`.

This commit forces the initialization of the owning symbol if it
was compiled in a prior run.

In addition, it adds a special case to `Run#compiles` for early
initialized symbols, which start out in life with the wrong owner.
As best as I can see, that complexity stems from allowing early
initialized members *without* return types to be used as value arguments
to the super call, which in turn is needed to infer parent type arguments.
The situation is described a little further in existing comments of
`typedPrimaryConstrBody`.

This bug is essentially another case of SI-6976. See the comments in pull
request of that patch (https://github.com/scala/scala/pull/1910) for
commit archaeology that shows why we're reluctant to force the owner
info more broadly than is done in this commit.
SI-7558 Fix capture of free local vars in toolbox compiler

It was creating an `ObjectRef[<notype>]` because of a small
bug in `capturedVariableType`.
SI-6308 Specialize methods that have some unspecialized params

This is a continuation of 1591c14e50, which didn't go far enough
to handle method calls with a mix of specialized and unspecialized
type parameters.

This commit modifies `specSym` to calculate the residual type
of the original method after specialized type parameters have
been removed and the type environment of the candidate specialized
variant has been subsituted.

For example, here is trace of `specSym` when searcing for the
specialized variant of `f4` in the enclosed test:

    tree             = Main.this.f4[Nothing, Int]
    tree.tpe         = (a: Int, b: List[(Int, Nothing)])String
    fun.tpe          = [B, A](a: A, b: List[(A, B)])String
    residualTreeType = [B](a: Int, b: List[(Int, B)])String
    memberType       = [B](a: Int, b: List[(Int, B)])String
    env              = Map(type A -> Int)
    doesConform      = true

A few "todo" tests are included that highlight an endemic
issue with the current specialization implementation: type
parameters that show up after `uncurry` might be clones of
the original symbols from typer, if they have been through
a TypeMap (e.g. within a call to `uncurryTreeType`). So testing
them for existence with the `typeEnv` map is fruitless.

No amount of `atPhase` acrobatics can rescue us from this;
we need to transport this information in a symbol-cloning
resiliant manner. Maybe Symbol Attachments?
Merge pull request #2626 from retronym/ticket/7556

SI-7556 Fix runtime reflection involving ScalaLongSignature
Cleanup of crash output.

I finally ran across the assert (or one of them) which
produces such voluminous output that it scares the cattle.
When you see "decls" in an assert, run.

After silencing that, I extended the journey into quieting
the default crash message down, way down. I assume this
will be met only with sighs of relief. And then most
challenging of all for some reason, I convinced it to only
print the information once.

Volume of crash data generated when reproducing the fsc
bug shown below:

  Before this commit  1158 lines
   After this commit    27 lines

Pretty sure there's more information in the 27 lines.
To reproduce the crash:

  fsc src/library/scala/collection/immutable/IntMap.scala
  fsc src/library/scala/collection/immutable/IntMap.scala

The first compile succeeds quietly; the second throws warnings
out of the gate, then crashes. And the "after" output:

  error: Cannot create static reference to method equals because object GenMapLike$class has no source module
  error: fatal error:
       while compiling: /scala/trunk/src/library/scala/collection/immutable/IntMap.scala
          during phase: globalPhase=mixin, enteringPhase=cleanup
       library version: version 2.11.0-20130606-052937-392858b4f6
      compiler version: version 2.11.0-20130606-055515-1856bec71b
    reconstructed args: -d /tmp

    last tree to typer: Ident(key$2)
         tree position: line 377 of /scala/trunk/src/library/scala/collection/immutable/IntMap.scala
              tree tpe: Int
                symbol: value key$2 (flags: <param> <synthetic>)
     symbol definition: key$2: Int (a TermSymbol)
        symbol package: scala.collection.immutable
         symbol owners: value key$2 -> constructor IntMap$$anonfun$unionWith$2 -> anonymous class anonfun$unionWith$2
             call site: object IntMap$Nil in package immutable in package immutable

  == Source file context for tree position ==

     374       }
     375     case (IntMap.Tip(key, value), x) => x.updateWith[S](key, value, (x, y) => f(key, y, x))
     376     case (x, IntMap.Tip(key, value)) => x.updateWith[S](key, value, (x, y) => f(key, x, y))
     377     case (IntMap.Nil, x) => x
     378     case (x, IntMap.Nil) => x
     379   }
     380
SI-2464 Resiliance against missing InnerClass attributes

A classfile in the wild related to Vaadin lacked the InnerClasses
attribute. As such, our class file parser treated a nested enum
class as top-level, which led to a crash when trying to find its
linked module.

More details of the investigation are available in the JIRA comments.

The test introduces a new facility to rewrite classfiles.

This commit turns this situation into a logged warning, rather
than crashing. Code by @paulp, test by yours truly.
Document exceptions thrown in some conversion methods of String
SI-6811 Remove scala.annotation.cloneable
Fix incorrectly documented exception of toBoolean method of String
SI-7564 Fix detection of reflective calls on Avian

Base_1.scala checks whether reflection was used by inspecting
the stacktrace and looking for “java.lang.reflect.”.

The stacktrace looks differently on Avian and therefore the
test fails.

This change looks for “sun.reflect.” instead, which seems to
work on OpenJDK and Avian.
Merge pull request #2638 from paulp/pr/error-output

Cleanup of crash output.
Merge pull request #2627 from retronym/ticket/7418

SI-7418 Avoid concurrent use of compiler in REPL startup
Eliminate needless Options.

Many of our core types have dedicated sentinels which serve
perfectly to communicate "no value", even more perfectly than
None. Saving a billion allocations is gravy.