diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-10-26 09:56:33 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-10-26 09:56:33 +0000 |
commit | ee02ad59ce2c42758712a1385f33ce962ae4107c (patch) | |
tree | 850dc44bd9947303242c4fcc10f341427ce7eb15 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | |
parent | 2270544a9c416efab073cf70360098ff961f976a (diff) | |
download | scala-ee02ad59ce2c42758712a1385f33ce962ae4107c.tar.gz scala-ee02ad59ce2c42758712a1385f33ce962ae4107c.tar.bz2 scala-ee02ad59ce2c42758712a1385f33ce962ae4107c.zip |
new classpaths.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 12e53934ed..389de79d47 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -14,7 +14,7 @@ import java.lang.Integer.toHexString import scala.collection.immutable.{Map, ListMap} import scala.collection.mutable.{ListBuffer, ArrayBuffer} import scala.tools.nsc.io.AbstractFile -import scala.tools.nsc.util.{Position, NoPosition} +import scala.tools.nsc.util.{Position, NoPosition, ClassRep} import scala.annotation.switch /** This abstract class implements a class file parser. @@ -23,8 +23,6 @@ import scala.annotation.switch * @version 1.0 */ abstract class ClassfileParser { - def sourcePath : AbstractFile = null - val global: Global import global._ @@ -416,7 +414,7 @@ abstract class ClassfileParser { } addEnclosingTParams(clazz) - parseInnerClasses() + parseInnerClasses() // also sets the isScala / isScalaRaw / hasMeta flags, see r15956 val superType = if (isAnnotation) { in.nextChar; definitions.AnnotationClass.tpe } else pool.getSuperClass(in.nextChar).tpe val ifaceCount = in.nextChar @@ -424,8 +422,8 @@ abstract class ClassfileParser { if (isAnnotation) ifaces = definitions.ClassfileAnnotationClass.tpe :: ifaces val parents = superType :: ifaces // get the class file parser to reuse scopes. - instanceDefs = newClassScope(clazz) - staticDefs = newClassScope(statics) + instanceDefs = new Scope + staticDefs = new Scope val classInfo = ClassInfoType(parents, instanceDefs, clazz) val staticInfo = ClassInfoType(List(), staticDefs, statics) @@ -778,20 +776,7 @@ abstract class ClassfileParser { val meta = pool.getName(in.nextChar).toString().trim() metaParser.parse(meta, sym, symtype) this.hasMeta = true - case nme.SourceFileATTR => - assert(attrLen == 2) - val source = pool.getName(in.nextChar) - if (sourcePath ne null) { - val sourceFile0 = sourcePath.lookupPath(source.toString(), false) - if ((sourceFile0 ne null) && (clazz.sourceFile eq null)) { - clazz.sourceFile = sourceFile0 - } - // XXX: removing only in IDE test. Also needs to be tested in the build compiler. - if (staticModule.moduleClass != NoSymbol) { - staticModule.moduleClass.sourceFile = clazz.sourceFile - } - } - // Attribute on methods of java annotation classes when that method has a default + // Attribute on methods of java annotation classes when that method has a default case nme.AnnotationDefaultATTR => sym.addAnnotation(AnnotationInfo(definitions.AnnotationDefaultAttr.tpe, List(), List(), NoPosition)) in.skip(attrLen) @@ -926,10 +911,11 @@ abstract class ClassfileParser { for (entry <- innerClasses.valuesIterator) { // create a new class member for immediate inner classes if (entry.outerName == externalName) { - val file = global.classPath.lookupPath( - entry.externalName.replace('.', java.io.File.separatorChar).toString, false) - assert(file ne null, entry.externalName) - enterClassAndModule(entry, new global.loaders.ClassfileLoader(file, null, null), entry.jflags) + val file = global.classPath.findClass(entry.externalName.toString) match { + case Some(ClassRep(Some(binary: AbstractFile), _)) => binary + case _ => throw new AssertionError(entry.externalName) + } + enterClassAndModule(entry, new global.loaders.ClassfileLoader(file), entry.jflags) } } } |