diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2008-09-04 17:41:10 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2008-09-04 17:41:10 +0000 |
commit | 12bceb22fdc5ba8295b8980aa6ca069cb74308e4 (patch) | |
tree | 92171fea60036ebb2b56b8743552c3e1eaf52150 /src/compiler | |
parent | 97db00dadafd438a7d69f9bc1e80dccf9dc41a37 (diff) | |
download | scala-12bceb22fdc5ba8295b8980aa6ca069cb74308e4.tar.gz scala-12bceb22fdc5ba8295b8980aa6ca069cb74308e4.tar.bz2 scala-12bceb22fdc5ba8295b8980aa6ca069cb74308e4.zip |
Fixed #1249.
Diffstat (limited to 'src/compiler')
5 files changed, 14 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index 9a554b0649..20e473f7b0 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -167,7 +167,7 @@ abstract class TypeFlowAnalysis { assert(visited.contains(b), "Block " + b + " in " + this.method + " has input equal to bottom -- not visited? .." + visited)); } - println("iterations: " + iterations + " for " + method.code.blocks.size) + //println("iterations: " + iterations + " for " + method.code.blocks.size) } def blockTransfer(b: BasicBlock, in: lattice.Elem): lattice.Elem = { diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 680f973f19..7bfedd634b 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -126,6 +126,8 @@ abstract class GenJVM extends SubComponent { currentRun.symData -= sym.linkedSym //System.out.println("Generated ScalaSig Attr for " + sym)//debug case _ => + val markerAttr = fjbgContext.JOtherAttribute(jclass, jclass, nme.ScalaATTR.toString, new Array[Byte](0), 0) + jclass.addAttribute(markerAttr) log("Could not find pickle information for " + sym) } if (!(jclass.getName().endsWith("$") && sym.isModuleClass)) diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala index 8583a3c4a4..c230cb5ab0 100644 --- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala +++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala @@ -432,6 +432,7 @@ trait StdNames { val RuntimeAnnotationATTR = newTermName("RuntimeVisibleAnnotations") val ClassfileAnnotationATTR = newTermName("RuntimeInvisibleAnnotations") val RuntimeParamAnnotationATTR = newTermName("RuntimeVisibleParameterAnnotations") + val ScalaATTR = newTermName("Scala") } def encode(str: String): Name = newTermName(NameTransformer.encode(str)) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index aa6a13ebc4..9d4f979666 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -36,6 +36,7 @@ abstract class ClassfileParser { protected var staticDefs: Scope = _ // the scope of all static definitions protected var pool: ConstantPool = _ // the classfile's constant pool protected var isScala: Boolean = _ // does class file describe a scala class? + protected var isScalaRaw: Boolean = _ // this class file is a scala class with no pickled info protected var hasMeta: Boolean = _ // does class file contain jaco meta attribute?s protected var busy: Boolean = false // lock to detect recursive reads private var externalName: Name = _ // JVM name of the current class @@ -354,7 +355,7 @@ abstract class ClassfileParser { var nameIdx = in.nextChar externalName = pool.getClassName(nameIdx) val c = pool.getClassSymbol(nameIdx) - if (c != clazz && c.nameString.indexOf("$") < 0) { + if (c != clazz && externalName.toString.indexOf("$") < 0) { if ((clazz eq NoSymbol) && (c ne NoSymbol)) { // XXX: needed for build compiler, so can't protect with inIDE clazz = c } else if (inIDE) { @@ -479,7 +480,7 @@ abstract class ClassfileParser { assert(restpe.typeSymbol == definitions.UnitClass) // if this is a non-static inner class, remove the explicit outer parameter val newFormals = innerClasses.get(externalName) match { - case Some(entry) if (entry.jflags & JAVA_ACC_STATIC) == 0 => + case Some(entry) if !isScalaRaw && (entry.jflags & JAVA_ACC_STATIC) == 0 => assert(formals.head.typeSymbol == clazz.owner, formals.head.typeSymbol + ": " + clazz.owner) formals.tail case _ => @@ -686,7 +687,7 @@ abstract class ClassfileParser { val attrLen = in.nextInt attrName match { case nme.SignatureATTR => - if (!isScala && global.settings.target.value == "jvm-1.5") { + if (!isScala && !isScalaRaw && global.settings.target.value == "jvm-1.5") { val sig = pool.getExternalName(in.nextChar) val newType = sigToType(sym, sig) sym.setInfo(newType) @@ -713,6 +714,8 @@ abstract class ClassfileParser { unpickler.unpickle(in.buf, in.bp, clazz, staticModule, in.file.toString()) in.skip(attrLen) this.isScala = true + case nme.ScalaATTR => + isScalaRaw = true case nme.JacoMetaATTR => val meta = pool.getName(in.nextChar).toString().trim() metaParser.parse(meta, sym, symtype) @@ -874,6 +877,8 @@ abstract class ClassfileParser { case nme.ScalaSignatureATTR => isScala = true in.skip(attrLen) + case nme.ScalaATTR => + isScalaRaw = true case nme.InnerClassesATTR if !isScala => for (i <- 0 until in.nextChar) { val innerIndex = in.nextChar diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index daaaf9bf49..6606214970 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -43,6 +43,7 @@ abstract class ICodeReader extends ClassfileParser { def readClass(cls: Symbol): (IClass, IClass) = { var classFile: AbstractFile = null; var sym = cls + sym.info // ensure accurate type information isScalaModule = cls.isModule && !cls.hasFlag(JAVA) log("Reading class: " + cls + " isScalaModule?: " + isScalaModule) val name = cls.fullNameString(java.io.File.separatorChar) + (if (sym.hasFlag(MODULE)) "$" else "") @@ -81,6 +82,7 @@ abstract class ICodeReader extends ClassfileParser { val c = pool.getClassSymbol(in.nextChar) // if (c != clazz) // throw new IOException("class file '" + in.file + "' contains " + c + "instead of " + clazz) + parseInnerClasses() in.skip(2) // super class in.skip(2 * in.nextChar) // interfaces |