summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-09-24 09:30:24 +0000
committerMartin Odersky <odersky@gmail.com>2009-09-24 09:30:24 +0000
commit87a113f132473036e6b975962fdb5cea8364b532 (patch)
tree672c468bb290c2088b9bc90573bcdb61559708b4 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
parent21035aa14125ccc3a9d9366988dc14472320a7a2 (diff)
downloadscala-87a113f132473036e6b975962fdb5cea8364b532.tar.gz
scala-87a113f132473036e6b975962fdb5cea8364b532.tar.bz2
scala-87a113f132473036e6b975962fdb5cea8364b532.zip
moved sortWith from Iterable to Sequence (becau...
moved sortWith from Iterable to Sequence (becaus eit does not make sense for sets or maps). Fixed problem interfacing with Java Array[T] parameters. Made manifests compile under 1.5 by avoiding multi-dimensional Array.newInstance.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 6f264b3c13..25330bd641 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -545,8 +545,14 @@ abstract class ClassfileParser {
val formals = tp.paramTypes
assert(formals.last.typeSymbol == definitions.ArrayClass)
val method = params.last.owner
- val newParams = method.newSyntheticValueParams(formals.init :::
- List(appliedType(definitions.JavaRepeatedParamClass.typeConstructor, List(formals.last.typeArgs.head))))
+ val elemtp = formals.last.typeArgs.head match {
+ case RefinedType(List(t1, t2), _) if (t1.typeSymbol.isAbstractType && t2.typeSymbol == definitions.ObjectClass) =>
+ t1 // drop intersection with Object for abstract types in varargs. UnCurry can handle them.
+ case t =>
+ t
+ }
+ val newParams = method.newSyntheticValueParams(
+ formals.init ::: List(appliedType(definitions.JavaRepeatedParamClass.typeConstructor, List(elemtp))))
MethodType(newParams, rtpe)
case PolyType(tparams, rtpe) =>
PolyType(tparams, arrayToRepeated(rtpe))
@@ -641,7 +647,13 @@ abstract class ClassfileParser {
tpe
case ARRAY_TAG =>
while ('0' <= sig(index) && sig(index) <= '9') index += 1
- appliedType(definitions.ArrayClass.tpe, List(sig2type(tparams, skiptvs)))
+ var elemtp = sig2type(tparams, skiptvs)
+ // make unbounded Array[T] where T is a type variable into Array[T with Object]
+ // (this is necessary because such arrays have a representation which is incompatibe
+ // with arrays of primitive types.
+ if (elemtp.typeSymbol.isAbstractType && !(elemtp <:< definitions.ObjectClass.tpe))
+ elemtp = intersectionType(List(elemtp, definitions.ObjectClass.tpe))
+ appliedType(definitions.ArrayClass.tpe, List(elemtp))
case '(' =>
// we need a method symbol. given in line 486 by calling getType(methodSym, ..)
assert(sym ne null)