summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-05-30 07:44:27 -0700
committerJames Iry <jamesiry@gmail.com>2013-05-30 07:44:27 -0700
commit60d462ef6e0dba5f9a7c4cc81255fcb9fba7939a (patch)
treeb09a66b379c0065579a29d1fe4b3cab73148f06b
parentd16786d1ec75c50a9934eb4d9203bc551c51e2d1 (diff)
parent75251f76001d3c781b0630c2061603ebb250a787 (diff)
downloadscala-60d462ef6e0dba5f9a7c4cc81255fcb9fba7939a.tar.gz
scala-60d462ef6e0dba5f9a7c4cc81255fcb9fba7939a.tar.bz2
scala-60d462ef6e0dba5f9a7c4cc81255fcb9fba7939a.zip
Merge pull request #2608 from retronym/ticket/7532v2.10.2-RC2v2.10.2
SI-7532 Fix regression in Java inner classfile reader
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala8
-rw-r--r--test/files/pos/t7532/A_1.java6
-rw-r--r--test/files/pos/t7532/B_2.scala5
-rw-r--r--test/files/pos/t7532b/A_1.scala7
-rw-r--r--test/files/pos/t7532b/B_2.scala8
5 files changed, 30 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index da117540b4..47a8b1f947 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -44,8 +44,6 @@ abstract class ClassfileParser {
def srcfile = srcfile0
- private def currentIsTopLevel = !(currentClass.decodedName containsChar '$')
-
private object unpickler extends scala.reflect.internal.pickling.UnPickler {
val global: ClassfileParser.this.global.type = ClassfileParser.this.global
}
@@ -515,8 +513,10 @@ abstract class ClassfileParser {
}
}
- val c = if (currentIsTopLevel) pool.getClassSymbol(nameIdx) else clazz
- if (currentIsTopLevel) {
+ val isTopLevel = !(currentClass containsChar '$') // Java class name; *don't* try to to use Scala name decoding (SI-7532)
+
+ val c = if (isTopLevel) pool.getClassSymbol(nameIdx) else clazz
+ if (isTopLevel) {
if (c != clazz) {
if ((clazz eq NoSymbol) && (c ne NoSymbol)) clazz = c
else mismatchError(c)
diff --git a/test/files/pos/t7532/A_1.java b/test/files/pos/t7532/A_1.java
new file mode 100644
index 0000000000..1ade76cc70
--- /dev/null
+++ b/test/files/pos/t7532/A_1.java
@@ -0,0 +1,6 @@
+class R {
+ public class attr { // Will have the bytecode name `R$attr`, not to be confused with `R@tr`!
+ }
+ public static class attr1 {
+ }
+}
diff --git a/test/files/pos/t7532/B_2.scala b/test/files/pos/t7532/B_2.scala
new file mode 100644
index 0000000000..ee7ce7751f
--- /dev/null
+++ b/test/files/pos/t7532/B_2.scala
@@ -0,0 +1,5 @@
+object Test {
+ val r = new R
+ new r.attr() // Was: error while loading attr, class file '.../t7532-pos.obj/R$attr.class' has location not matching its contents: contains class
+ new R.attr1
+} \ No newline at end of file
diff --git a/test/files/pos/t7532b/A_1.scala b/test/files/pos/t7532b/A_1.scala
new file mode 100644
index 0000000000..e8f9540609
--- /dev/null
+++ b/test/files/pos/t7532b/A_1.scala
@@ -0,0 +1,7 @@
+package pack
+class R {
+ class attr // Will have the bytecode name `R$attr`, not to be confused with `R@tr`!
+ class `@`
+}
+
+class `@` \ No newline at end of file
diff --git a/test/files/pos/t7532b/B_2.scala b/test/files/pos/t7532b/B_2.scala
new file mode 100644
index 0000000000..1555a5daa7
--- /dev/null
+++ b/test/files/pos/t7532b/B_2.scala
@@ -0,0 +1,8 @@
+import pack._
+
+object Test {
+ val r = new R
+ new r.attr()
+ new r.`@`
+ new `@`
+} \ No newline at end of file