summaryrefslogtreecommitdiff
path: root/sources/scalac/Global.java
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-03-23 02:36:24 +0000
committerpaltherr <paltherr@epfl.ch>2004-03-23 02:36:24 +0000
commita70044860bbd402c4191038615160fb7168572f7 (patch)
tree4644374257c1a4d50d6ffe12d433b1732407d5ab /sources/scalac/Global.java
parent71ac5a4ad27fd6d3ab4da4d551fefa6ae508ff2e (diff)
downloadscala-a70044860bbd402c4191038615160fb7168572f7.tar.gz
scala-a70044860bbd402c4191038615160fb7168572f7.tar.bz2
scala-a70044860bbd402c4191038615160fb7168572f7.zip
- Split scala.tools.util.AbstractFile into seve...
- Split scala.tools.util.AbstractFile into several files Added - scala.tools.util.DirectoryPath Added scala.tools.util.VirtualDirectory - Changed interface of scala.tools.util.AbstractFile Rewrote - scala.tools.util.ZipArchive (merged ZipArchive and JarArchive) Moved - ClassPath to scala.tools.util Changed ClassPath and PackageParser to - rely on DirectoryPath for file lookups
Diffstat (limited to 'sources/scalac/Global.java')
-rw-r--r--sources/scalac/Global.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java
index 30d385c016..d2d0df060d 100644
--- a/sources/scalac/Global.java
+++ b/sources/scalac/Global.java
@@ -23,6 +23,7 @@ import java.nio.charset.UnsupportedCharsetException;
import java.util.*;
import scala.tools.util.AbstractFile;
+import scala.tools.util.ClassPath;
import scala.tools.util.Position;
import scala.tools.util.SourceFile;
import scala.tools.util.SourceReader;
@@ -299,7 +300,7 @@ public abstract class Global {
/** Reads and returns the source file in file with given name. */
public SourceFile getSourceFile(String filename) throws IOException {
- AbstractFile file = AbstractFile.open(null, filename);
+ AbstractFile file = AbstractFile.getFile(filename);
if (file == null) throw new FileNotFoundException(
"source file '" + filename + "' could not be found");
return getSourceFile(file);
@@ -307,16 +308,14 @@ public abstract class Global {
/** Reads and returns the source file in given abstract file. */
public SourceFile getSourceFile(AbstractFile file) throws IOException {
- if (!file.exists()) throw new FileNotFoundException(
- "source file '" + file + "' could not be found");
return new SourceFile(file, reader.read(file));
}
/** Reads and returns the source file of given clasz. */
public SourceFile getSourceFile(Symbol clasz) throws IOException {
assert clasz.isClass() && clasz.isStatic(): Debug.show(clasz);
- AbstractFile file = classPath.openFile(
- SourceRepresentation.externalizeFileName(clasz, ".scala"));
+ AbstractFile file = classPath.getRoot().lookupPath(
+ SourceRepresentation.externalizeFileName(clasz, ".scala"), false);
if (file == null) throw new FileNotFoundException(
"source file for " + clasz + " could not be found");
return getSourceFile(file);
@@ -324,7 +323,7 @@ public abstract class Global {
/** Returns the root symbol loader. */
public SymbolLoader getRootLoader() {
- return new PackageParser(this);
+ return new PackageParser(this, classPath.getRoot());
}
/** the top-level compilation process