Closed #2726 and added test for #2464 (refs #2464)

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@19945 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
dragos 2009-11-30 16:42:35 +00:00
parent 047f80d094
commit c8831a9eb0
7 changed files with 47 additions and 10 deletions

View File

@ -72,7 +72,7 @@
<entry name="?*.tld" />
<entry name="?*.ftl" />
</wildcardResourcePatterns>
<annotationProcessing enabled="false" useClasspath="true" generatedDirName="generated" />
<annotationProcessing enabled="false" useClasspath="true" />
</component>
<component name="CopyrightManager" default="">
<module2copyright />

View File

@ -408,6 +408,25 @@ abstract class ClassfileParser {
var nameIdx = in.nextChar
externalName = pool.getClassName(nameIdx)
val c = if (externalName.toString.indexOf('$') < 0) pool.getClassSymbol(nameIdx) else clazz
/** Parse parents for Java classes. For Scala, return AnyRef, since the real type will be unpickled.
* Updates the read pointer of 'in'. */
def parseParents: List[Type] = {
if (isScala) {
in.nextChar // skip superclass
val ifaces = in.nextChar
in.bp += ifaces * 2 // .. and iface count interfaces
List(definitions.AnyRefClass.tpe) // dummy superclass, will be replaced by pickled information
} else {
val superType = if (isAnnotation) { in.nextChar; definitions.AnnotationClass.tpe }
else pool.getSuperClass(in.nextChar).tpe
val ifaceCount = in.nextChar
var ifaces = for (i <- List.range(0, ifaceCount)) yield pool.getSuperClass(in.nextChar).tpe
if (isAnnotation) ifaces = definitions.ClassfileAnnotationClass.tpe :: ifaces
superType :: ifaces
}
}
if (c != clazz && externalName.toString.indexOf("$") < 0) {
if ((clazz eq NoSymbol) && (c ne NoSymbol)) clazz = c
else throw new IOException("class file '" + in.file + "' contains wrong " + c)
@ -415,16 +434,10 @@ abstract class ClassfileParser {
addEnclosingTParams(clazz)
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
var ifaces = for (i <- List.range(0, ifaceCount)) yield pool.getSuperClass(in.nextChar).tpe
if (isAnnotation) ifaces = definitions.ClassfileAnnotationClass.tpe :: ifaces
val parents = superType :: ifaces
// get the class file parser to reuse scopes.
// get the class file parser to reuse scopes.
instanceDefs = new Scope
staticDefs = new Scope
val classInfo = ClassInfoType(parents, instanceDefs, clazz)
val classInfo = ClassInfoType(parseParents, instanceDefs, clazz)
val staticInfo = ClassInfoType(List(), staticDefs, statics)
if (!isScala && !isScalaRaw) {
@ -945,7 +958,7 @@ abstract class ClassfileParser {
in.skip(attrLen)
case nme.ScalaATTR =>
isScalaRaw = true
case nme.InnerClassesATTR =>
case nme.InnerClassesATTR if !isScala =>
val entries = in.nextChar.toInt
for (i <- 0 until entries) {
val innerIndex = in.nextChar.toInt

View File

@ -0,0 +1,5 @@
class ClassTwo {
public static class Child {
public void func2() {return ;}
}
}

View File

@ -0,0 +1,6 @@
class ScalaClassOne extends ClassTwo.Child {
def func4() = {
func2
}
}

View File

@ -0,0 +1,3 @@
object Test {
val c1 = new ScalaClassOne
}

View File

@ -0,0 +1,7 @@
class SQLBuilder extends SQLBuilder.Segment
object SQLBuilder {
trait Segment
}

View File

@ -0,0 +1,3 @@
object SQuery2Test {
new SQLBuilder
}