summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scala-lang.ipr2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala29
-rw-r--r--test/files/pos/t2464/JavaOne.java5
-rw-r--r--test/files/pos/t2464/ScalaOne_1.scala6
-rw-r--r--test/files/pos/t2464/t2464_2.scala3
-rw-r--r--test/files/pos/t2726/SQLBuilder_1.scala7
-rw-r--r--test/files/pos/t2726/test_2.scala3
7 files changed, 46 insertions, 9 deletions
diff --git a/scala-lang.ipr b/scala-lang.ipr
index dced049dcc..750442f47d 100644
--- a/scala-lang.ipr
+++ b/scala-lang.ipr
@@ -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 />
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 2abaf50d10..dd6b5d4948 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -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.
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
diff --git a/test/files/pos/t2464/JavaOne.java b/test/files/pos/t2464/JavaOne.java
new file mode 100644
index 0000000000..ff36868a0e
--- /dev/null
+++ b/test/files/pos/t2464/JavaOne.java
@@ -0,0 +1,5 @@
+class ClassTwo {
+ public static class Child {
+ public void func2() {return ;}
+ }
+}
diff --git a/test/files/pos/t2464/ScalaOne_1.scala b/test/files/pos/t2464/ScalaOne_1.scala
new file mode 100644
index 0000000000..1caf8ecae4
--- /dev/null
+++ b/test/files/pos/t2464/ScalaOne_1.scala
@@ -0,0 +1,6 @@
+class ScalaClassOne extends ClassTwo.Child {
+ def func4() = {
+ func2
+ }
+}
+
diff --git a/test/files/pos/t2464/t2464_2.scala b/test/files/pos/t2464/t2464_2.scala
new file mode 100644
index 0000000000..13a52c952b
--- /dev/null
+++ b/test/files/pos/t2464/t2464_2.scala
@@ -0,0 +1,3 @@
+object Test {
+ val c1 = new ScalaClassOne
+}
diff --git a/test/files/pos/t2726/SQLBuilder_1.scala b/test/files/pos/t2726/SQLBuilder_1.scala
new file mode 100644
index 0000000000..8d07a88265
--- /dev/null
+++ b/test/files/pos/t2726/SQLBuilder_1.scala
@@ -0,0 +1,7 @@
+class SQLBuilder extends SQLBuilder.Segment
+
+object SQLBuilder {
+ trait Segment
+}
+
+
diff --git a/test/files/pos/t2726/test_2.scala b/test/files/pos/t2726/test_2.scala
new file mode 100644
index 0000000000..e738143aeb
--- /dev/null
+++ b/test/files/pos/t2726/test_2.scala
@@ -0,0 +1,3 @@
+object SQuery2Test {
+ new SQLBuilder
+}