summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sources/scala/tools/nsc/backend/icode/GenICode.scala4
-rw-r--r--sources/scala/tools/nsc/backend/jvm/GenJVM.scala15
2 files changed, 16 insertions, 3 deletions
diff --git a/sources/scala/tools/nsc/backend/icode/GenICode.scala b/sources/scala/tools/nsc/backend/icode/GenICode.scala
index 1b84f0250c..dd1bfa4189 100644
--- a/sources/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/sources/scala/tools/nsc/backend/icode/GenICode.scala
@@ -604,7 +604,7 @@ abstract class GenICode extends SubComponent {
var invokeStyle =
if (isStaticSymbol(sym))
Static(false)
- else if (sym hasFlag Flags.PRIVATE)
+ else if (sym.hasFlag(Flags.PRIVATE) || sym.isClassConstructor)
Static(true)
else
Dynamic;
@@ -617,7 +617,7 @@ abstract class GenICode extends SubComponent {
ctx1 = genLoadArguments(args, fun.symbol.info.paramTypes, ctx1);
ctx1.bb.emit(CALL_METHOD(sym, invokeStyle), tree.pos);
- generatedType = toTypeKind(sym.info.resultType);
+ generatedType = if (sym.isClassConstructor) UNIT else toTypeKind(sym.info.resultType);
ctx1
}
diff --git a/sources/scala/tools/nsc/backend/jvm/GenJVM.scala b/sources/scala/tools/nsc/backend/jvm/GenJVM.scala
index 971fff3eda..5416e42abd 100644
--- a/sources/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/sources/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -695,12 +695,25 @@ abstract class GenJVM extends SubComponent {
/** Return the a name of this symbol that can be used on the Java
* platform. It removes spaces from names.
+ *
+ * Special handling: scala.All and scala.AllRef are 'erased' to
+ * scala.All$ and scala.AllRef$. This is needed because they are
+ * not real classes, and they mean 'abrupt termination upon evaluation
+ * of that expression' or 'null' respectively. This handling is
+ * done already in GenICode, but here we need to remove references
+ * from method signatures to these types, because such classes can
+ * not exist in the classpath: the type checker will be very confused.
*/
- def javaName(sym: Symbol) = {
+ def javaName(sym: Symbol): String = {
val suffix = if (sym.hasFlag(Flags.MODULE) && !sym.isMethod &&
!sym.isImplClass &&
!sym.hasFlag(Flags.JAVA)) "$" else "";
+ if (sym == definitions.AllClass)
+ return "scala.All$"
+ else if (sym == definitions.AllRefClass)
+ return "scala.AllRef$";
+
(if (sym.isClass || (sym.isModule && !sym.isMethod))
sym.fullNameString('/')
else