scala/scala — pull request #1264 by xeno-by (2012-09-06 10:21:15+00:00)
Title: SI-6277 decorates runtime symbols with auto-init

A non-invasive solution that makes runtime reflection symbols
auto-initialize themselves when certain methods are called.
This is done in such a way that compile-time reflection is
totally unaffected.

The auto-initializing methods are:
1) `isXXX` tests, except for:
1.1) `isLocal` (not determined by flags)
1.2) `isSkolem` (transient, never created during unpickling)
1.3) `isErroneous` (transient, erroneous stuff doesn't get pickled)
1.4) `isAbstractType` (created by pickler as such)
1.5) `isAliasType` (created by pickler as such)
1.6) `isPrimitive` (not determined by flags)
1.7) `isNumeric` (not determined by flags)
1.8) `isPrimaryConstructor` (not determined by flags)
2) `privateWithin`
3) `annotations`

Previous implementation of synchronized decorators had a fatal flaw.
It was overriding creation methods by mixing in decorator methods
in creation methods. In this model, a symbol gets decorated if its parent
is decorated, all the way to the roots. However roots were never decorated,
because they are declared as final objects.

I evaluated a few options (-Yoverride-objects is experimental, so I dismissed
it right away, delegating root children creation to universe-wide methods does
not involve core changes, but it produces so much boilerplate that I wouldn't
be able to look Paul in the eye afterwards), but the best one appears to be
moving creators from Symbol to SymbolTable.

This introduces another indirection into symbol creation, so I will ask Greg
to test the performance right away, but at a glance symbol creation is already
riddled with indirections, so an extra one shouldn't hurt.