Fix for SI-5385.

Nodes which hit EOF with no whitespace afterward had
wrong position.
Implement @static annotation on singleton object fields.

This commit introduces the `@static` annotation on fields of static singleton objects.

A static singleton object is a top-level singleton object or an object nested within
a static singleton object.

The field annotated with `@static` is generated as a true static field in the companion
class of the object. The initialization of the field is done in the static initializer of the
companion class, instead of the object itself.

Here's an example. This:

    object Foo {
      @static val FIELD = 123
    }
    class Foo

generates :

   object Foo {
     def FIELD(): Int = Foo.FIELD
   }
   class Foo {
     <static> val FIELD = 123
   }

The accessor in `object Foo` is changed to return the static
field in `class Foo` (the companion class is generated if it is
not already present, and the same is done for getters if `FIELD`
is a `var`).

Furthermore, all the callsites to accessor `Foo.FIELD` are rewritten
to access the static field directly.

It is illegal to annotate a field in the singleton object as `@static` if there is
already a member of the same name in `class Foo`.

This allows better Java interoperability with frameworks which rely on static fields being
present in the class.
The `AtomicReferenceFieldUpdater`s are one such example. Instead of having
a Java base class holding the `volatile` mutable field `f` and a static field containing
a reference to the `AtomicReferenceFieldUpdater` that mutates `f` atomically,
and extending this Java base class from Scala, we can now simply do:

    object Foo {
      @static val arfu = AtomicReferenceUpdater.newUpdater(
        classOf[Foo], classOf[String], "f"
      )
    }
    class Foo {
      @volatile var f = null
      import Foo._
      def CAS(ov: String, nv: String) = arfu.compareAndSet(this, null, "")
    }

In summary, this commit introduces the following:
- adds the `@static` annotation
- for objects without a companion class and `@static` members, creates a companion class
(this is done in `CleanUp`)
- checks for conflicting names and if `@static` is used on static singleton object member
- creates the `static` field in the companion class for `@static` members
- moves the field initialization from the companion object to the static initializer of
the class (the initialization of `@static` members is bypassed in the `Constructors` phase,
and added to static ctors in `CleanUp`)
- all callsites to the accessors of `@static` are rewritten to access the static fields directly
(this is done in `GenICode`)
- getters and setters to `@static` fields access the static field directly, and the field in the
singleton object is not emitted (this is done in `GenICode`)
- changes in `GenJVM`, `GenASM` - now computing local var indices in static initializers
as well - this was an oversight before, now is necessary

Future work: allow the `@static` annotation on methods as well - this will
be added in a future commit.

Review by @odersky, @dragos, @paulp, @heathermiller.
SI-6104 support This pattern

This(name) is treated just like Ident(name)

apparently this pattern was used in 2.9 code,
though I'm not sure it's spec'ed
WIP add private/lazy checks and a few tests.
Updated list of targets allowed in Ant's scalac.

It looks like scala.tools.ant.Scalac class had
a stale list of allowed targets. Made it in sync
with what compiler supports.
Better debugging output in GenASM.

When assertion fails, let's provide
the context.
Deprecate all JVM 1.5 targets and make 1.6 default.

Add a check if deprecated target is being used. I put
that check into `checkDeprecatedSettings`. I tried to
invent some general mechanism for deprecating choices
in ChoiceSetting but I gave up eventually. It wasn't
worth it the complexity. Also, with current approach
I'm able to provide nice, customized deprecation
warning.

Make `jvm-1.6` a default backend.

Altered test for SI-5957 because it crashes the backend.
However, the problem is not with backend but with symbol
creation. We get two different symbols with the same
internal name and both are used in trees that reach
GenASM. See SI-6109 for details.

Review by @magarciaEPFL and @paulp.
Switch to 1.6 target for all javac invocations.

Switch to 1.6 target for all javac invocations
we perform in build.xml. This way we do not
emit java 1.5 byte-code either from scalac
or javac. This commit should complete the move
off java 1.5 byte-code.
SI-6031 customizable budget for patmat analyses

read the scalac.patmat.analysisBudget system property to decide how much time to spend on unreachability/exhaustivity
the default value is 256, and you can turn it off entirely using -Dscalac.patmat.analysisBudget=off

when the budget is exhausted, an unchecked warning is emitted

stack overflows in CNF conversion are caught and treated as analysis budget violations
update docs for (partial) fun synth in uncurry
Use `findMember` to lookup the static field in the host class.

The upcoming `findMember` optimizations should ensure that this
is fast enough.
Removes redundant outers

Widens the criterion when outer fields can be omitted. It used to be that sub- and superclass had to be enclosed by the same outer class. Only in that case was the outer field of the class omitted. We now omit if subclass is contained in an outer class that is itself a subclass of the superclasses outer class.

See test case "outertest.scala" for an example.
SIP-14 - Fix critical Java compatibility issue in scala.concurrent.Await

Patch contributed by @viktorklang
SI-1832 consistent symbols in casedef's pattern&body

the only change to typedBind in this commit (beyond refactoring to keep my eyes from bleeding),
is explained by the added comment:

have to imperatively set the symbol for this bind to keep it in sync with the symbols used in the body of a case
when type checking a case we imperatively update the symbols in the body of the case
those symbols are bound by the symbols in the Binds in the pattern of the case,
so, if we set the symbols in the case body, but not in the patterns,
then re-type check the casedef (for a second try in typedApply for example -- SI-1832),
we are no longer in sync: the body has symbols set that do not appear in the patterns
since body1 is not necessarily equal to body, we must return a copied tree,
but we must still mutate the original bind
address "this would catch all throwables" warnings

original patch by @odersky in #955 -- criterion for the refactor:
"catch Throwable as long as there's no obvious control flow exception going through the catch
and the caught exception is processed further"

rebased & updated with review comments in #955 and #954
Merge pull request #941 from adriaanm/ticket-6104

SI-6104 support This pattern
Merge pull request #953 from adriaanm/ticket-6031

SI-6031 customizable budget for patmat analyses
Merge pull request #956 from phaller/topic/sip14-critical-fix-await

SIP-14 - Fix critical Java compatibility issue in scala.concurrent.Await
Merge pull request #894 from axel22/topic/static-annot-cherry-2.10.x

Implement @static annotation on singleton object fields.
Merge pull request #948 from gkossakowski/target-1.6

Deprecate all JVM 1.5 targets and make 1.6 default.