[backport] relax time constraint in duration-tck.scala (for Windows VMs)
(cherry picked from commit 3e0fbc0193f0b6f58dc16dae3824677e9902dc7b)
Removed redundant `retypedMethod` in `Duplicators`

It was never used since its introduction in 3ee6b3653 by @dragos.

Review by @dragos or @axel22 or @paulp.
SI-7343 Fixed phase ordering in specialization

Specialization rewires class parents during info transformation, and
the new info then guides the tree changes. But if a symbol is created
during duplication, which runs after specialization, its info is not
visited and thus the corresponding tree is not specialized.

One manifestation is the following:
```
object Test {

  class Parent[@specialized(Int) T]

  def spec_method[@specialized(Int) T](t: T, expectedXSuper: String) = {
     class X extends Parent[T]()
     // even in the specialized variant, the local X class
     // doesn't extend Parent$mcI$sp, since its symbol has
     // been created after specialization and was not seen
     // by specialzation's info transformer.
     ...
  }
}
```
We can fix this by forcing duplication to take place before specialization.

Review by @dragos, @paulp or @axel22.
SI-7584 Fix typer regression with by-name parameter types

It regressed in fada1ef6b#L4L614. Partially reverting just
this change restores the correct behaviour:

```
-        if (sym.isStable && pre.isStable && !isByNameParamType(tree.tpe) &&
+        if (treeInfo.admitsTypeSelection(tree) &&
```

This patch embeds the check for by-name parameter types into
`TreeInfo.isStableIdentifier`. That code already checks for
`Symbol#isStable`, which exludes direct references to by-name
parameters. But the additional check is required to deal with
by-name parameters in function types, e.g `(=> Int) => Any`.

Open question: should we go further and embed this check in `isStable`?

Currently:

    final def isStable        = isTerm && !isMutable && !(hasFlag(BYNAMEPARAM)) && (!isMethod || hasStableFlag)

Such function types are an underspecified corner of the language,
albeit one that is pretty useful writing, for example, in the
signature of a lazy foldRight that can operate over infinite
structures:

    def foldRight[A, B](fa: F[A], z: => B)(f: (A, => B) => B): B

The next commit subjects them to a little testing.
SI-7584 Test and spurious warning fix for by-name closures

The enclosed test case exercises by-name closures, which were
the subject of the previous commit. In the process, a spurious
warning was eliminated.
Merge pull request #2656 from gkossakowski/junit

Add JUnit support
Merge pull request #2646 from retronym/topic/duration-relax-2.10.x

[backport] relax time constraint in duration-tck.scala (for Windows VMs)
Merge pull request #2651 from VladUreche/issue/7343-2

SI-7343 Fixed phase ordering in specialization
SI-7571 Allow nesting of anonymous classes in value classes

5d9cde105e added deep prohibition of nested classes within
a value class. This has the undesirable side effect of
prohibiting partial functions literals in method bodies
of a value class.

The intention of that prohibition was to avoid problems
in code using Type Tests, such as:

    class C(val inner: A) extends AnyVal {
      class D
    }
    def foo(a: Any, other: C) = a match { case _ : other.D }

Here, the pattern usually checks that `a.$outer == other`.
But that is incongruent with the way that `other` is erased
to `A`.

However, not all nested classes could lead us into this trap.
This commit slightly relaxes the restriction to allow anonymous
classes, which can't appear in a type test.

The test shows that the translation generates working code.
Cleaning up method implementations in Future
    Optimizations:
    1) Avoiding isDefinedAt + apply and using applyOrElse to allow for optimizations later
    2) Reducing method sizes to be more JIT + inliner friendly
    3) Reusing core combinators to reuse inliner/JIT optimizations and be more code-cache friendly
Refactoring to the scala-concurrent-tck.scala
  - there were numerous logical issues with the former implementation
    - failed assertions may not fail the build
  - there was a lot of ceremony and noise
SI-6855: REPL emits error on partial pastie

If pasted code is interpreted with an incomplete result,
attempt to compile it to display an error.

Unfancily, the code is wrapped in an object for compilation.
SI-3936 - add test case to show that SI-3936 is already fixed

These are exactly the examples given by Lukas Rytz in SI-3936.
They fail with 2.10.1 and compile with 2.10.2 as well as current master.
SI-7600 [Avian] Skip tests r/stream_length and r/t4294

The issue is that Avian's GC is currently not precise enough to
determine the exact lifetime of each local/stack reference, and
therefore considers the this reference to be reachable in situations
where it could have been collected.

This can cause issues (as seen in run/stream_length and run/t4294:
`java.lang.OutOfMemoryError`) if code relies on the garbage collection
of these values to keep memory consumption constant.

This commit simply skips these two tests on Avian until the GC
implementation is fixed.
Get rid of raw types which cause unnecessary warnings
SI-7603 Speculative fix for annotation binding error

Reports of:

    error: trait Test is abstract; cannot be instantiated
    11:09:50 [ant:scalac] @Test def testClientRequestNum = {
    11:09:50 [ant:scalac] ^

Suggest that the deferred processing of a LazyAnnotationInfo is binding
the identifier `Test` to the wrong symbol. Inspection of the code shows
that the closure also defers capture of the (mutable) field
`Namer#typer.context`.

This commit captures the context eagerly, and adds logging to let us
know if that eagerly captured context ever differs from the its value
at the point when the annotation info is forced.

I spent a few hours trying to craft a test to back this up, but to no
avail. Here's what the log output will look like:

    [log typer] The var `typer.context` in scala.tools.nsc.typechecker.Namers$NormalNamer@1f5ebb08 was mutated before the annotation new a() was forced.

    current value  = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false)
    original value = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false)

    This confirms the hypothesis for the cause of SI-7603. If you see this message, please comment on that ticket.
Merge pull request #2511 from viktorklang/wip-cleaner-Future-method-implementations-2.10-√

General SIP-14 Future method implementation cleanup
SI-7344 Specialize methods in private scopes

This performs method specialization inside a scope other than a {class,
trait, object}: could be another method or a value. This specialization
is much simpler, since there is no need to record the new members in
the class signature, their signatures are only visible locally.
It works according to the usual logic:
 - we use normalizeMember to create the specialized symbols
 - we leave DefDef stubs in the tree that are later filled in by tree
duplication and adaptation

The solution is limited by SI-7579: since the duplicator loses the sym
annotations when duplicating, this expansion and rewiring can only take
place in code that has not been subject to duplication. You can see the
test case for an example.

Review by @dragos, @paulp or @axel22.
Remove dependency on combinators from CommandLinerParser.

tools.cmd.CommandLineParser uses a small hand-rolled parser

TODO: replace partest's usage of scala.tools.nsc.util.CommandLine
by scala.tools.cmd.CommandLine
Merge pull request #2648 from retronym/ticket/7571

SI-7571 Allow nesting of anonymous classes in value classes