summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/runtime/Universe.scala
blob: fd53308d0a5d3da7186e933b826591316450aeb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package scala.reflect
package runtime

import internal.{SomePhase, NoPhase, Phase, TreeGen}

/** The universe for standard runtime reflection from Java.
 *  This type implements all abstract term members in internal.SymbolTable.
 *  It also provides methods to go from Java members to Scala members,
 *  using the code in JavaConversions.
 */
abstract class Universe extends SymbolTable with ToolBoxes {

  type AbstractFileType = AbstractFile

  def picklerPhase = SomePhase

  type TreeGen = internal.TreeGen

  val gen = new TreeGen { val global: Universe.this.type = Universe.this }

  lazy val settings = new Settings
  def forInteractive = false
  def forScaladoc = false

  val phaseWithId: Array[Phase] = Array(NoPhase, SomePhase)
  val currentRunId = 1 // fake a run id so that it is different from NoRunId
  phase = SomePhase // set to a phase different from NoPhase

  def log(msg: => AnyRef): Unit = println(" [] "+msg)

  type TreeCopier = TreeCopierOps
  def newStrictTreeCopier: TreeCopier = new StrictTreeCopier
  def newLazyTreeCopier: TreeCopier = new LazyTreeCopier

  definitions.AnyValClass // force it.

  // establish root association to avoid cyclic dependency errors later
  // don't use classOf[...] here, because it gets serviced by getClass.getClassLoader!
  classToScala(Class.forName("java.lang.Object", true, classLoader)).initialize

//  println("initializing definitions")
  definitions.init()
}