summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-05-23 10:00:50 -0700
committerPaul Phillips <paulp@improving.org>2013-05-23 12:07:45 -0700
commitd8b96bb8583161e59180527bab0283f783466426 (patch)
treea12ecf17379a579d5a2f4bda7a16819001eadb77 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
parentb8641a97d669c945a1b9f47b4e8934aa6c98ffd7 (diff)
downloadscala-d8b96bb8583161e59180527bab0283f783466426.tar.gz
scala-d8b96bb8583161e59180527bab0283f783466426.tar.bz2
scala-d8b96bb8583161e59180527bab0283f783466426.zip
Concision contribution.
We have lots of core classes for which we need not go through the symbol to get the type: ObjectClass.tpe -> ObjectTpe AnyClass.tpe -> AnyTpe I updated everything to use the concise/direct version, and eliminated a bunch of noise where places were calling typeConstructor, erasedTypeRef, and other different-seeming methods only to always wind up with the same type they would have received from sym.tpe. There's only one Object type, before or after erasure, with or without type arguments. Calls to typeConstructor were especially damaging because (see previous commit) it had a tendency to cache a different type than the type one would find via other means. The two types would compare =:=, but possibly not == and definitely not eq. (I still don't understand what == is expected to do with types.)
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 9afa1ba10d..69111f9b0c 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -478,7 +478,7 @@ abstract class ClassfileParser {
u2 // skip superclass
val ifaces = u2
in.bp += ifaces * 2 // .. and iface count interfaces
- List(AnyRefClass.tpe) // dummy superclass, will be replaced by pickled information
+ List(AnyRefTpe) // dummy superclass, will be replaced by pickled information
}
else raiseLoaderLevel {
val superType = if (jflags.isAnnotation) { u2; AnnotationClass.tpe }
@@ -657,15 +657,15 @@ abstract class ClassfileParser {
def sig2type(tparams: immutable.Map[Name,Symbol], skiptvs: Boolean): Type = {
val tag = sig.charAt(index); index += 1
tag match {
- case BYTE_TAG => ByteClass.tpe
- case CHAR_TAG => CharClass.tpe
- case DOUBLE_TAG => DoubleClass.tpe
- case FLOAT_TAG => FloatClass.tpe
- case INT_TAG => IntClass.tpe
- case LONG_TAG => LongClass.tpe
- case SHORT_TAG => ShortClass.tpe
- case VOID_TAG => UnitClass.tpe
- case BOOL_TAG => BooleanClass.tpe
+ case BYTE_TAG => ByteTpe
+ case CHAR_TAG => CharTpe
+ case DOUBLE_TAG => DoubleTpe
+ case FLOAT_TAG => FloatTpe
+ case INT_TAG => IntTpe
+ case LONG_TAG => LongTpe
+ case SHORT_TAG => ShortTpe
+ case VOID_TAG => UnitTpe
+ case BOOL_TAG => BooleanTpe
case 'L' =>
def processInner(tp: Type): Type = tp match {
case TypeRef(pre, sym, args) if (!sym.isStatic) =>
@@ -739,8 +739,8 @@ abstract class ClassfileParser {
// NOTE that the comparison to Object only works for abstract types bounded by classes that are strict subclasses of Object
// if the bound is exactly Object, it will have been converted to Any, and the comparison will fail
// see also RestrictJavaArraysMap (when compiling java sources directly)
- if (elemtp.typeSymbol.isAbstractType && !(elemtp <:< ObjectClass.tpe)) {
- elemtp = intersectionType(List(elemtp, ObjectClass.tpe))
+ if (elemtp.typeSymbol.isAbstractType && !(elemtp <:< ObjectTpe)) {
+ elemtp = intersectionType(List(elemtp, ObjectTpe))
}
arrayType(elemtp)
@@ -761,7 +761,7 @@ abstract class ClassfileParser {
case 'T' =>
val n = subName(';'.==).toTypeName
index += 1
- if (skiptvs) AnyClass.tpe
+ if (skiptvs) AnyTpe
else tparams(n).typeConstructor
}
} // sig2type(tparams, skiptvs)