SI-6026 REPL checks for javap before tools.jar

If javap is already available, don't go hunting for tools.jar

This avoids the getResource bug in AbstractFileClassLoader.
[nomaster] SI-6026 backport getResource bug fix

Submitted to master under SI-4936, this fix allows :javap
to work when tools.jar is discovered by REPL.
SI-7295 Fix windows batch file with args containing parentheses

In command scripts, substitution of `FOO` in `if cond ( %FOO% )` happens
*before* the condition is evaluated. One can use delayed expansion with
`if cond (!FOO!)` to get a saner behaviour. Or, as I ended up doing here,
use a goto in the body of the if rather than referring directly to variables
there.

Here's a cut down version to demonstrate the old problem:

    C:\Users\IEUser>type test.cmd
    @echo off

    setlocal enableextensions enabledelayedexpansion

    if [%~1]==[-toolcp] (
      set CP=%~2
      shift
      shift
    )
    echo -toolcp %CP%
    echo %~1 %~2

    C:\Users\IEUser>test.cmd a b
    -toolcp
    a b

    C:\Users\IEUser>test.cmd -toolcp "c:\program files" a b
    -toolcp c:\program files
    a b

    C:\Users\IEUser>test.cmd -toolcp "c:\program files" "a()b" "c()d"
    -toolcp c:\program files
    a()b c()d

    C:\Users\IEUser>test.cmd "a()b" "c()d"
    d was unexpected at this time.

I don't understand exactly why the parentheses only mess things
up in this situation. But regardless, lets find another way.

My first attempt to fix this was based on the suggestion in the ticket.
But, as shown below, this fails to capture the -toolcp.

    C:\Users\IEUser>type test.cmd
    @echo off

    setlocal enableextensions enabledelayedexpansion

    if [%~1]==[-toolcp] (
      set CP=!2!
      shift
      shift
    )
    echo -toolcp %CP%
    echo %~1 %~2
    C:\Users\IEUser>test.cmd "a()b" "c()d"
    -toolcp
    a()b c()d

    C:\Users\IEUser>test.cmd -toolcp "c:\program files" "a()b" "c()d"
    -toolcp
    a()b c()d

Last stop was the goto you'll find in this patch.

With this patch applied, I tested on Windows 8 with the following:

    C:\Users\IEUser>type Desktop\temp.cmd
    ::#!
    @echo off
    call scala %0 %*
    goto :eof
    ::!#
    println("hello, world")
    println(argv.toList)

    C:\Users\IEUser>scala Desktop\temp.cmd "foo(bar)baz"
    "java" -Xmx256M -Xms32M -Dscala.home="C:\PROGRA~3\scala\bin\.."
    -Denv.emacs="" -Dscala.usejavacp=true  -cp "..."
    scala.tools.nsc.MainGenericRunner Desktop\temp.cmd "foo(bar)baz"

    hello, world
    List(foo(bar)baz)

    C:\Users\IEUser>scala -toolcp "c:\program files" Desktop\temp.cmd "foo(bar)baz"
    "java" -Xmx256M -Xms32M -Dscala.home="C:\PROGRA~3\scala\bin\.."
     -Denv.emacs="" -Dscala.usejavacp=true  -cp "...;c:\program files"
     scala.tools.nsc.MainGenericRunner  -toolcp "c:\program files" Desktop\temp.cmd "foo(bar)baz"

    hello, world
    List(foo(bar)baz)
Merge pull request #3065 from retronym/ticket/7295

 Fix windows batch file with args containing parentheses
[nomaster] 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

Cherry picked from 433880e91cba9e1e926e9fcbf04ecd4aeb1d73eb

Conflicts:
	src/compiler/scala/tools/nsc/typechecker/Typers.scala
SI-7519: Additional test case covering sbt/sbt#914

(cherry picked from commit e72c32db03b44d6eaf1c1872765a578c5445e15f)
Merge pull request #3052 from som-snytt/issue/6026-javap-loading

SI-6026 REPL checks for javap before tools.jar
Merge pull request #3053 from som-snytt/issue/6026-AFCL-findresource

[nomaster] SI-6026 backport getResource bug fix
Merge pull request #3072 from retronym/backport/7519

[nomaster] SI-7519 Less brutal attribute resetting in adapt fallback
SI-6546 InnerClasses attribute refers to absent class

At issue is that the optimizer would eliminate closure classes
completely, then neglect to eliminate those classes from the
container's InnerClasses attribute. This breaks tooling which
expects those entries to correspond to real classes.

The code change is essentially mgarcia's - I minimized it and
put the caches in perRunCaches, and added the test case which
verifies that after being compiled under -optimise, there are
no inner classes. Before/after:

  7,8d6
  <   InnerClasses:
  <        public final #22; //class A_1$$anonfun$f$1
  37,45c35,40
  <   #21 = Utf8               A_1$$anonfun$f$1
  <   #22 = Class              #21            //  A_1$$anonfun$f$1
  <   #23 = Utf8               Code
  ---
  >   #21 = Utf8               Code
SI-4012 Mixin and specialization work well

The bug was fixed along with SI-7638 in 504b5f3.
Fix completion after application with implicit arguments

`List(1, 2, 3).map(f).<ctrl-space>` now works; before
the tree had the type `(bf: CanBuildFrom[...]):...` and
did not contribute completions from the result type.

This commit checks if the tree has an implicit method
type, and typechecks it as a qualifier. That is enough
to get to `adaptToImplicitMethod` in the type checker,
infer the implicit arguments, and compute the final result
type accordingly.
Merge pull request #3102 from VladUreche/issue/4012

SI-4012 Mixin and specialization work well
Render relevant properties to buildcharacter.properties
Allow publishing only core (pr validation)
Allow retrieving STARR from non-standard repo for PR validation
Merge pull request #3097 from paulp/issue/6546-for-210

SI-6546 InnerClasses attribute refers to absent class
[backport] SI-7776 post-erasure signature clashes are now macro-aware

"double definition: macro this and method that have same type after erasure"
This error doesn't make sense when macros are involved, because macros
expand at compile-time, where we're not affected by erasure. Moreover,
macros produce no bytecode, which means that we're safe from VerifyErrors.
IDE needs swing/actors/continuations
Merge pull request #3105 from retronym/ticket/completion

Fix completion after application with implicit arguments