blob: ef5fe94750ef8422dbfbd20168fb8294b8394d73 (
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
44
|
package dotty.tools
package dotc
package config
import io.{AbstractFile,ClassPath,JavaClassPath,MergedClassPath,DeltaClassPath}
import ClassPath.{ JavaContext, DefaultJavaContext }
import core.Contexts._
import core.SymDenotations._, core.Symbols._, core.{SymbolLoader, ClassfileLoader}
class JavaPlatform extends Platform {
private var currentClassPath: Option[MergedClassPath] = None
def classPath(implicit ctx: Context): ClassPath = {
if (currentClassPath.isEmpty)
currentClassPath = Some(new PathResolver(ctx).result)
currentClassPath.get
}
/** Update classpath with a substituted subentry */
def updateClassPath(subst: Map[ClassPath, ClassPath]) =
currentClassPath = Some(new DeltaClassPath(currentClassPath.get, subst))
def rootLoader(implicit ctx: Context): SymbolLoader = new ctx.base.loaders.PackageLoader(classPath)(ctx.condensed)
/** We could get away with excluding BoxedBooleanClass for the
* purpose of equality testing since it need not compare equal
* to anything but other booleans, but it should be present in
* case this is put to other uses.
*/
def isMaybeBoxed(sym: Symbol)(implicit ctx: Context) = {
val d = defn
import d._
(sym == ObjectClass) ||
(sym == JavaSerializableClass) ||
(sym == ComparableClass) ||
(sym isNonBottomSubClass BoxedNumberClass) ||
(sym isNonBottomSubClass BoxedCharClass) ||
(sym isNonBottomSubClass BoxedBooleanClass)
}
def newClassLoader(bin: AbstractFile)(implicit ctx: Context): SymbolLoader =
new ClassfileLoader(bin)(ctx.condensed)
}
|